diff --git a/README.md b/README.md index 3119005..4a75847 100644 --- a/README.md +++ b/README.md @@ -40,6 +40,13 @@ Defaults: # - /opt/.*/java needrestart_blacklist_bin: [] + # Custom needrestart scripts + # Example: + # needrestart_restartd: + # - name: unbound + # script: "systemctl restart unbound.service" + needrestart_restartd: [] + Download -------- diff --git a/defaults/main.yml b/defaults/main.yml index fd5711d..47e138a 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -38,3 +38,10 @@ needrestart_checkmk_mrpe: False # Override old needrestart.conf needrestart_update_needrestart_conf: False + +# Register custom restart scripts +# Example: +# needrestart_restartd: +# - name: unbound +# script: "systemctl restart unbound.service" +needrestart_restartd: [] \ No newline at end of file diff --git a/tasks/main.yml b/tasks/main.yml index 2433236..123dfa4 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -98,3 +98,12 @@ regexp: '^NEEDRESTART\s+sudo -n -- /usr/sbin/needrestart -p' state: absent when: not (needrestart_checkmk_mrpe | default(False)) + +- name: Register custom restart scripts + ansible.builtin.copy: + content: "{{ item.script }}" + dest: "/etc/needrestart/restart.d/{{ item.service_name }}.service" + owner: root + group: root + mode: "0755" + loop: "{{ needrestart_restartd }}"