update
Ansible Role: update
Ansible role that checks for and optionally installs system updates. It also has to the option to print upgradeable packages without actually upgrading them.
Beta Warning
This role is currently in beta and is not intended for production use. Breaking changes may occur between releases, so please make sure to read the release notes.
Requirements
This role depends on certain collections that are not included in ansible-core.
To install this role's requirements, create a requirements.yml
file with the following contents:
---
collections:
- name: community.general
Then, if you are using ansible-base/ansible-core 2.10 or later, run this command.
ansible-galaxy install -r requirements.yml
If you are still using Ansible 2.9, run this command, instead.
ansible-galaxy collection install -r requirements.yml
Role Variables
Here are this role's variables and their default values, as set in defaults/main.yml
. If you'd like, you may change them to customize this role's behavior.
---
# defaults file for update
# Options:
# - `check` to print upgradeable packages without upgrading them
# - `full` to print upgradeable packages and then upgrade them
# - `run` to update all packages without listing them first
mode: full
# This option sets the apt upgrade type. Available options are `dist`, `full`, `safe`, and `true`.
# See the [ansible.builtin.apt][1] module documentation for more information.
update_apt_upgrade_type: true
# This options sets the state key for the zypper module.
# Choose `latest` for a regular upgrade or `dist-upgrade` for the equivalent for `zypper dup`.
# See the [community.general.zypper][2] module documentation for more information.
update_zypper_state: latest
# This option dictates whether zypper should allow a vendor change
update_zypper_allow_vendor_change: false
# Whether to autoremove unneeded dependencies. This only applies to dnf, yum, and apt
update_autoremove: false
[1]: https://docs.ansible.com/ansible/latest/collections/ansible/builtin/apt_module.html
[2]: https://docs.ansible.com/ansible/latest/collections/community/general/zypper_module.html
Example Playbook
---
- name: Converge
hosts: all
become: true
tasks:
- name: "Include update"
ansible.builtin.include_role:
name: gotmax23.update
Compatibility
This role is tested using the latest version of ansible-core and the latest version of the collections from Ansible Galaxy. This is the only version of Ansible that this role officially supports. Best effort support is provided for other versions.
This role is compatible with the following distros:
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/ansible-role-update