community.general.dnf_versionlock – Locks package versions in
dnf based systems
This plugin is part of the community.general collection (version 4.2.0).
You might already have this collection installed if you are using the
It is not included in
To check whether it is installed, run
ansible-galaxy collection list.
To install it, use:
ansible-galaxy collection install community.general.
To use it in a playbook, specify:
New in version 4.0.0: of community.general
Locks package versions using the
dnfbased systems. This plugin takes a set of name and versions for packages and excludes all other versions of those packages. This allows you to for example protect packages from being updated by newer versions. The state of the plugin that reflects locking of packages is the
The below requirements are needed on the host that executes this module.
The logics of the
versionlockplugin for corner cases could be confusing, so please take in account that this module will do its best to give a
check_modeprediction on what is going to happen. In case of doubt, check the documentation of the plugin.
Sometimes the module could predict changes in
check_modethat will not be such because
versionlockconcludes that there is already a entry in
locklistthat already matches.
In an ideal world, the
versionlockplugin would have a dry-run option to know for sure what is going to happen. So far we have to work with a best guess as close as possible to the behaviour inferred from its code.
For most of cases where you want to lock and unlock specific versions of a package, this works fairly well.
- name: Prevent installed nginx from being updated community.general.dnf_versionlock: name: nginx state: present - name: Prevent multiple packages from being updated community.general.dnf_versionlock: name: - nginx - haproxy state: present - name: Remove lock from nginx to be updated again community.general.dnf_versionlock: package: nginx state: absent - name: Exclude bind 32:9.11 from installs or updates community.general.dnf_versionlock: package: bind-32:9.11* state: excluded - name: Keep bash package in major version 4 community.general.dnf_versionlock: name: bash-0:4.* raw: true state: present - name: Delete all entries in the locklist of versionlock community.general.dnf_versionlock: state: clean
Common return values are documented here, the following are the fields unique to this module: