Role to install & maintain needrestart
Defaults:
# Admins should be informed via email
needrestart_notifyd_disable_email: 0
# All other notifications should be disabled
needrestart_notifyd_disable_write_tty: 1
needrestart_notifyd_disable_needrestart_session: 1
needrestart_notifyd_disable_notify_send: 1
# Restart services (l)ist only, (i)nteractive or (a)utomatically.
needrestart_action: l
# Email which will be notified
needrestart_mail_address: $NR_USERNAME
# Services which should be ignored
needrestart_ignorelist: []
# Services blacklisted as regex
# Example:
# needrestart_blacklist_rc:
#   - cron\.service
needrestart_blacklist_rc: []
# Blacklist binaries as regex
# Example:
# needrestart_blacklist_bin:
#   - /opt/.*/java
needrestart_blacklist_bin: []
# Custom needrestart scripts
# Example:
# needrestart_restartd:
#   - name: unbound
#     script: "systemctl restart unbound.service"
needrestart_restartd: []
Download latest release with ansible-galaxy
ansible-galaxy install systemli.needrestart
- hosts: servers
  roles:
     - { role: systemli.needrestart }
# Admins should be informed via email
needrestart_notifyd_disable_email: 0 
## Restart services (l)ist only, (i)nteractive or (a)utomatically. 
needrestart_action: a
# Email which will be notified, when a service should be restarted 
needrestart_mail_address: admin@mydomain.com
# Ignore services below during automatic restart
needrestart_ignorelist:
  groupname:
     - servicename
  Databases:
     - mysql
     - mongodb
  Mail:
     - exim4
     - dovecot
  Webservers:
    - apache2
Molecule, Docker and Github Actions is used for continous testing. On the local environment you can easily test the role with
molecule test 
This requires Molecule, Vagrant and python-vagrant to be installed.
GPLv3