exploide.dnf-automatic
ansible-role: dnf-automatic
Ten rola instaluję, konfiguruje i aktywuje dnf-automatic
za pomocą Ansible na hostach, które używają menedżera pakietów dnf. Możliwym przypadkiem użycia jest automatyczna instalacja aktualizacji zabezpieczeń.
Zobacz https://dnf.readthedocs.org/en/latest/automatic.html po więcej informacji o dnf-automatic
.
Zmienne Roli
Nazwy zmiennych są w większości samowyjaśniające. Oprócz tego, że nazwy są poprzedzone nazwą roli, są identyczne z preferencjami dla pliku konfiguracyjnego dnf-automatic
. Zobacz https://dnf.readthedocs.org/en/latest/automatic.html#configuration-file-format po więcej szczegółów.
W szczególności używane są następujące zmienne (wraz z ich wartościami domyślnymi):
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: {}
Ta domyślna konfiguracja ustawia dnf-automatic
na automatyczne pobieranie i instalowanie tylko aktualizacji zabezpieczeń.
Zauważ, że słownik dnf_automatic_base_overrides
może być użyty do nadpisania dowolnych preferencji z podstawowego pliku konfiguracyjnego dnf dla dnf-automatic
.
Dodatkowo, dnf_automatic_reboot
może być ustawione na true, aby wykonać automatyczne ponowne uruchomienia, gdy zainstalowane aktualizacje tego wymagają:
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'"
Zależności
Brak wymaganych zależności.
Przykładowy Playbook
Ten przykładowy playbook wdraża dnf-automatic
na wszystkich hostach, ale jest skonfigurowany tak, aby wszystkie aktualizacje były instalowane automatycznie, nie tylko aktualizacje zabezpieczeń.
- name: Przykładowy playbook
hosts: all
remote_user: root
roles:
- { role: exploide.dnf-automatic, dnf_automatic_upgrade_type: default }
Ten przykładowy playbook wdraża dnf-automatic
, aby instalować tylko aktualizacje zabezpieczeń oraz wdraża dodatkowy timer do ponownego uruchamiania o 4:00, kiedy to jest wymagane:
- name: Przykładowy playbook z automatycznym ponownym uruchomieniem
hosts: all
remote_user: root
roles:
- { role: exploide.dnf-automatic, dnf_automatic_reboot: true, dnf_automatic_reboot_time: "04:00" }
Licencja
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