exploide.dnf-automatic
ansible-role: dnf-automatic
此角色通过 Ansible 在使用 dnf 包管理器的主机上安装、配置和激活 dnf-automatic
。一个可能的使用案例是自动安装安全更新。
有关 dnf-automatic
的更多信息,请参见 https://dnf.readthedocs.org/en/latest/automatic.html。
角色变量
变量名称大多是自解释的。除了名称以角色名称作为前缀之外,名称与 dnf-automatic
配置文件的偏好设置相同。有关详细信息,请参见 https://dnf.readthedocs.org/en/latest/automatic.html#configuration-file-format。
特别是,以下变量(包括其默认值)被使用:
dnf_automatic_apply_updates: true
dnf_automatic_download_updates: true
dnf_automatic_network_online_timeout: 60
dnf_automatic_random_sleep: 0
dnf_automatic_upgrade_type: security
dnf_automatic_emit_via: stdio
dnf_automatic_system_name: "{{ ansible_nodename }}"
dnf_automatic_send_error_messages: false
dnf_automatic_command_format: cat
dnf_automatic_stdin_format: "{body}"
dnf_automatic_email_command_format: "mail -Ssendwait -s {subject} -r {email_from} {email_to}"
dnf_automatic_email_stdin_format: "{body}"
dnf_automatic_email_from: root
dnf_automatic_email_host: localhost
dnf_automatic_email_port: 25
dnf_automatic_email_tls: "no"
dnf_automatic_email_to: root
dnf_automatic_base_overrides: {}
此默认配置将 dnf-automatic
设置为自动下载和安装仅安全更新。
请注意,dnf_automatic_base_overrides
字典可用于覆盖 dnf-automatic
的基础 dnf 配置文件中的任意首选项。
此外,可以将 dnf_automatic_reboot
设置为 true,以便在安装的更新需要时执行自动重启:
dnf_automatic_reboot: false
dnf_automatic_reboot_dependencies: yum-utils
dnf_automatic_reboot_OnCalendar: "03:00"
dnf_automatic_reboot_AccuracySec: "15s"
dnf_automatic_reboot_Description: "dnf-automatic-reboot"
dnf_automatic_reboot_ExecStart: "/bin/bash -c '/bin/needs-restarting -r || /sbin/reboot'"
依赖项
不需要任何依赖项。
示例剧本
此示例剧本在所有主机上部署 dnf-automatic
,并配置为自动安装所有更新,而不仅仅是安全更新。
- name: 示例剧本
hosts: all
remote_user: root
roles:
- { role: exploide.dnf-automatic, dnf_automatic_upgrade_type: default }
此示例剧本部署 dnf-automatic
仅安装安全更新,并在需要时部署额外的计时器在早上 4:00 自动重启:
- name: 带自动重启的示例剧本
hosts: all
remote_user: root
roles:
- { role: exploide.dnf-automatic, dnf_automatic_reboot: true, dnf_automatic_reboot_time: "04:00" }
许可证
MIT
关于项目
This role installs, configures and activates dnf-automatic via Ansible on hosts which use the dnf package manager.
安装
ansible-galaxy install exploide.dnf-automatic
许可证
mit
下载
100.5k
拥有者
IT Security guy, open-source enthusiast, likes to keep things simple, <3 Python