monolithprojects.system_update
System Update
This system update role will update all software packages on RHEL/CentOS and Debian/Ubuntu systems.
You can choose to update packages to a specific version of the distribution (by default, it updates to the latest version).
It also has a feature called smart reboot
, which will reboot the system after specific packages listed in smart_reboot_pkg:
are updated.
Requirements
The system needs to have access to a package repository (like the Internet or Red Hat Satellite).
Role Variables
Here are the default settings copied from defaults/main.yml
:
# Automatically remove unneeded packages for all modules.
autoremove_pkgs: no
# Reboot the server if certain packages are updated
# smart_reboot_pkg:
# - kernel
# - dbus
# Specifies the Linux distribution version for installing packages.
# By default, it will update to the latest version.
# Debian or Ubuntu version (e.g., xenial)
# deb_release_ver:
# RHEL/CentOS version (e.g., 6.10)
# el6_release_ver:
# RHEL/CentOS version (e.g., 7.6.1810)
# el7_release_ver:
# RHEL/CentOS version (e.g., 8.1.1911)
# el8_release_ver:
Example Playbook
Here’s a simple example that updates all packages to the latest version.
---
- name: Example
hosts: all
become: true
roles:
- role: ansible-system_update
In this example, packages on an el7
system (like RHEL7 or CentOS7) will be updated to version 7.7.1908
.
If you enable autoremove_pkgs
, unneeded dependencies will be removed automatically.
The system will reboot if the kernel
or dbus
packages are 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
Updates system packages for RHEL/CentOS/Debian/Ubuntu. Can reboot the system if critical packages are updated.
ansible-galaxy install monolithprojects.system_update