guilieb.update

ansible-role-update: Update System and Set Up Automatic Updates

This role updates the system (all packages) and installs an automatic package updater (yum-cron for CentOS 7/RHEL 7 or dnf-automatic for later versions and Fedora).

Role Variables

  • For CentOS 7 or RHEL 7, the role installs yum-cron. Here’s how to configure it:
yum_automatic:
  base:
    debuglevel: -2
    mdpolicy: 'group:main'
  commands:
    apply_updates: false
    download_updates: true
    random_sleep: 0
    update_cmd: default
    update_messages: true
  email:
    email_from: root@localhost
    email_host: localhost
    email_to: root
  emitters:
    emit_via: stdio
    output_width: 80
    system_name: None
  groups:
    group_list: None
    package_types:
      - mandatory
      - default
  • For CentOS or RHEL versions above 7 and Fedora, it uses dnf-automatic. Here's the configuration for that:
dnf_automatic:
  commands:
    apply_updates: false
    download_updates: false
    random_sleep: 0
    upgrade_type: default
  command:
    command_format: cat
    stdin_format: '"{body}"'
  command_email:
    command_format: '"mail -s {subject} -r {email_from} {email_to}"'
    stdin_format: '"{body}"'
    email_from: root
    email_to: root
  emitters:
    emit_via: stdio
    system_name: None
  email:
    email_from: root
    email_host: localhost
    email_to: root

Note: If you only want to change specific settings, check the hash_behaviour documentation.

Example Playbook

---
- hosts: localhost
  become: true
  connection: local

  vars:
    dnf_automatic:
      commands:
        download_updates: true
      command_email:
        email_to: [email protected]

  roles:
    - guilieb.update

Author Information

Informazioni sul progetto

A simple Ansible role to update the system and configure yum-cron or dnf-automatic.

Installa
ansible-galaxy install guilieb.update
Licenza
gpl-3.0
Download
108
Proprietario
Software Engineer & Data Scientist @ MAIF