gotmax23.update
Ansible Role: Update
This Ansible role checks for system updates and can install them. It can also list packages that can be upgraded without actually performing the upgrade.
Beta Warning
This role is currently in beta. It is not meant for production use. Changes may occur between releases, so please read the release notes carefully.
Requirements
This role needs certain collections not included in ansible-core.
To install the required collections, create a requirements.yml
file like this:
---
collections:
- name: community.general
Then, if you are using ansible-base/ansible-core 2.10 or newer, run this command:
ansible-galaxy install -r requirements.yml
If you are using Ansible 2.9, use this command instead:
ansible-galaxy collection install -r requirements.yml
Role Variables
Here are the default settings for this role, which you can change in defaults/main.yml
:
---
# Default settings for update
# Options:
# - `check`: List upgradeable packages without updating
# - `full`: List upgradeable packages and update them
# - `run`: Update all packages without listing them first
mode: full
# Option to set the type of apt upgrade. Options: `dist`, `full`, `safe`, `true`.
update_apt_upgrade_type: true
# State key for the zypper module: Choose `latest` for a regular upgrade or `dist-upgrade`.
update_zypper_state: latest
# Whether zypper should allow vendor change
update_zypper_allow_vendor_change: false
# Whether to automatically remove unneeded dependencies. Applies to dnf, yum, and apt.
update_autoremove: false
Example Playbook
Here is an example of how to use this role in a playbook:
---
- name: Update System
hosts: all
become: true
tasks:
- name: "Run update"
ansible.builtin.include_role:
name: gotmax23.update
Compatibility
This role is tested with the latest version of ansible-core and the latest collections from Ansible Galaxy. It officially supports only this version, but offers best-effort support for older versions.
The role is compatible with these distributions:
Distro | Versions |
---|---|
Archlinux | any |
Debian | buster, bullseye, bookworm |
EL | 7, 8 |
Fedora | 34, 35, 36 |
OpenSUSE | 15.3, tumbleweed |
Ubuntu | bionic, focal |
License
Author
Maxwell G (@gotmax23)
Ansible role that checks for and optionally installs system updates. It also has to the option to print upgradeable packages without actually upgrading them.
ansible-galaxy install gotmax23.update