Skip to content

Commit

Permalink
Add option for custom restart scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
mabezi committed Feb 20, 2024
1 parent 885deaa commit ffaeee9
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ Defaults:
# - /opt/.*/java
needrestart_blacklist_bin: []

# Custom needrestart scripts
# Example:
# needrestart_restartd:
# - name: unbound
# script: "systemctl restart unbound.service"
needrestart_restard: []

Download
--------

Expand Down
8 changes: 8 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,11 @@ 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_restard: []

9 changes: 9 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.template:
src: "{{ item.script }}"
dest: "/etc/needrestart/restart.d/{{ item.service_name }}.service"
owner: root
group: root
mode: "0755"
loop: "{{ needrestart_restartd }}"

0 comments on commit ffaeee9

Please sign in to comment.