systemli.needrestart

Ansible Role for Needrestart

Build Status Ansible Galaxy

This role installs and manages Needrestart.

Role Variables

Default Settings:

  • Email Notifications for Admins:

    • needrestart_notifyd_disable_email: 0 (Set to 1 to disable)
  • Other Notifications:

    • needrestart_notifyd_disable_write_tty: 1 (Disable output to terminal)
    • needrestart_notifyd_disable_needrestart_session: 1 (Disable session-based notifications)
    • needrestart_notifyd_disable_notify_send: 1 (Disable send notifications)
  • Action for Restarting Services:

    • needrestart_action: l (Choose: list only, interactive, or automatic)
  • Notification Email Address:

    • needrestart_mail_address: $NR_USERNAME
  • Ignored Services:

    • needrestart_ignorelist: []
  • Blacklisted Services (using regex):

    • Example:
      • needrestart_blacklist_rc:
        • - cron\.service
  • Blacklisted Binaries (using regex):

    • Example:
      • needrestart_blacklist_bin:
        • - /opt/.*/java
  • Custom Scripts for Restarting Services:

    • Example:
      • needrestart_restartd:
        • - name: unbound
        • script: "systemctl restart unbound.service"

Download

To download the latest version, use the following command:

ansible-galaxy install systemli.needrestart

Example Playbook

- hosts: servers
  roles:
    - { role: systemli.needrestart }

Extended Variables Example

# Email Notifications for Admins
needrestart_disable_email: 0 

# Action for Restarting Services
needrestart_action: a 

# Notification Email Address
needrestart_mail_address: [email protected]

# Services to Ignore During Automatic Restart
needrestart_ignorelist:
  groupname:
    - servicename
  Databases:
    - mysql
    - mongodb
  Mail:
    - exim4
    - dovecot
  Webservers:
    - apache2

Testing & Development

Tests

We use Molecule, Docker, and GitHub Actions for continuous testing. To test the role locally, run:

molecule test 

Make sure you have Molecule, Vagrant, and python-vagrant installed.

License

GPLv3

Author Information

For more information, visit systemli.org.

Informazioni sul progetto

Install and maintain needrestart software, to check which daemons need to be restarted after library upgrades. Contains tests for Molecule.

Installa
ansible-galaxy install systemli.needrestart
Licenza
gpl-3.0
Download
11.4k
Proprietario
Your friendly tech collective