systemli.needrestart

ansible-role-needrestart

构建状态 Ansible Galaxy

用于安装和维护 needrestart 的角色

角色变量

默认值:

# 管理员应通过电子邮件通知
needrestart_notifyd_disable_email: 0

# 其他所有通知应禁用
needrestart_notifyd_disable_write_tty: 1
needrestart_notifyd_disable_needrestart_session: 1
needrestart_notifyd_disable_notify_send: 1

# 重新启动服务的方式:仅列出(l),交互式(i)或自动(a)。
needrestart_action: l

# 将接收通知的电子邮件地址
needrestart_mail_address: $NR_USERNAME

# 应该忽略的服务
needrestart_ignorelist: []

# 按正则表达式列出的黑名单服务
# 示例:
# needrestart_blacklist_rc:
#   - cron\.service
needrestart_blacklist_rc: []

# 按正则表达式列出的黑名单二进制文件
# 示例:
# needrestart_blacklist_bin:
#   - /opt/.*/java
needrestart_blacklist_bin: []

# 自定义 needrestart 脚本
# 示例:
# needrestart_restartd:
#   - name: unbound
#     script: "systemctl restart unbound.service"
needrestart_restartd: []

下载

使用 ansible-galaxy 下载最新版本

ansible-galaxy install systemli.needrestart

示例剧本

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

扩展变量示例

# 管理员应通过电子邮件通知
needrestart_disable_email: 0 

## 重新启动服务的方式:仅列出(l),交互式(i)或自动(a)。 
needrestart_action: a

# 服务应重新启动时通知的电子邮件地址 
needrestart_mail_address: [email protected]

# 在自动重启期间忽略以下服务
needrestart_ignorelist:
  groupname:
     - servicename
  数据库:
     - mysql
     - mongodb
  邮件:
     - exim4
     - dovecot
  网页服务器:
    - apache2

测试与开发

测试

Molecule、Docker 和 GitHub Actions 用于持续测试。 在本地环境中,您可以轻松测试角色,使用命令:

molecule test 

这需要安装 Molecule、Vagrant 和 python-vagrant

许可证

GPLv3

作者信息

https://www.systemli.org

关于项目

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

安装
ansible-galaxy install systemli.needrestart
许可证
gpl-3.0
下载
11.4k
拥有者
Your friendly tech collective