Skip to content

MonolithProjects/ansible-system_update

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

System update

This role will update all packages on RHEL/CentOS and Debian/Ubuntu systems.
Optionally it can update the packages to specific distro release version (by default it is latest). Another feature is the smart reboot where system will be rebooted after the package you specified in smart_reboot_pkg: list will be updated.

Requirements

System must have access to the packages repository (Internet, Red Hat Satellite, etc.).

Role Variables

This is a copy from defaults/main.yml

# Autoremove unused dependency packages for all modules.
autoremove_pkgs: no

# Reboot server if specific packages are updated
# smart_reboot_pkg:
#     - kernel
#     - dbus

# Specifies the Linux distro release from which all packages will be installed.
# By default the packages will be updated to the latest distro release.

# Debian or Ubuntu release version (example: xenial)
# deb_release_ver:

# RHEL/CentOS release version (example 6.10)
# el6_release_ver:

# RHEL/CentOS release version (exanple: 7.6.1810)
# el7_release_ver:

# RHEL/CentOS release version (example: 8.1.1911)
# el8_release_ver:

Example Playbook

Simple example. All packages will be updated to the latest version.

---
- name: Example
  hosts: all
  become: true
  roles:
    - role: ansible-system_update

In this example el7 system (RHEL7 or CentOS7) packages will be updated to the version same as for release 7.7.1908. Using autoremove_pkgs the dependencies which are no longer needed will be autoremoved. System will be rebooted if kernel or dbus package is updated.

---
- name: Example
  hosts: all
  become: true
  vars:
    el7_release_ver: "7.7.1908"
    autoremove_pkgs: true
    smart_reboot_pkg:
      - kernel
      - dbus
  roles:
    - role: ansible-system_update

License

MIT

Author Information

Created in 2020 by Michal Muransky