guilieb.update

ansible-role-update: 更新系统并配置自动更新

更新系统(所有)并根据目标操作系统安装自动包更新器(yum-crondnf-automatic)。

角色变量

如果目标系统是 CentOS 7 或 RHEL 7,将安装 yum-cron,配置如下:

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

如果目标系统是 CentOS 或 RHEL > 7 或 Fedora,将使用 dnf-automatic,配置如下:

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

注意:要仅覆盖您希望更改的参数,请查看 hash_behaviour 设置。

示例剧本

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

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

  roles:
    - guilieb.update

作者信息

关于项目

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

安装
ansible-galaxy install guilieb.update
许可证
gpl-3.0
下载
108
拥有者
Software Engineer & Data Scientist @ MAIF