exploide.dnf-automatic
ansible-role: dnf-automatic
This role sets up dnf-automatic
using Ansible on hosts that use the dnf package manager. A common use for this is to automatically install security updates.
For more details about dnf-automatic
, visit this link.
Role Variables
The variable names are mostly clear. Besides being prefixed with the role name, they match the settings in the dnf-automatic
configuration file. For more information, check this configuration guide.
Here are some key variables and their default values:
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: {}
This default setup ensures dnf-automatic
automatically downloads and installs only security updates.
You can use the dnf_automatic_base_overrides
to change other settings from the base dnf configuration for dnf-automatic
.
You can also set dnf_automatic_reboot
to true to automatically restart the system when needed updates are installed:
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'"
Dependencies
No dependencies are required.
Example Playbook
This example playbook installs dnf-automatic
on all hosts, set to install all updates automatically, not just security updates:
- name: Example playbook
hosts: all
remote_user: root
roles:
- { role: exploide.dnf-automatic, dnf_automatic_upgrade_type: default }
This example playbook installs dnf-automatic
for security updates only and sets up an automatic reboot at 4:00 am when necessary:
- name: Example playbook with auto reboot
hosts: all
remote_user: root
roles:
- { role: exploide.dnf-automatic, dnf_automatic_reboot: true, dnf_automatic_reboot_time: "04:00" }
License
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