community / community.general / 6.6.8 / module / dnf_versionlock Locks package versions in C(dnf) based systems | "added in version" 4.0.0 of community.general" Authors: Roberto Moreda (@moreda) <moreda@allenta.com>community.general.dnf_versionlock (6.6.8) — module
Install with ansible-galaxy collection install community.general:==6.6.8
collections: - name: community.general version: 6.6.8
Locks package versions using the C(versionlock) plugin in C(dnf) based 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 C(locklist).
- 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
raw: default: false description: - Do not resolve package name specs to NEVRAs to find specific version to lock to. Instead the package name specs are used as they are. This enables locking to not yet available versions of the package. type: bool name: default: [] description: - Package name spec to add or exclude to or delete from the C(locklist) using the format expected by the C(dnf repoquery) command. - This parameter is mutually exclusive with I(state=clean). elements: str required: false type: list state: choices: - absent - clean - excluded - present default: present description: - Whether to add (C(present) or C(excluded)) to or remove (C(absent) or C(clean)) from the C(locklist). - C(present) will add a package name spec to the C(locklist). If there is a installed package that matches, then only that version will be added. Otherwise, all available package versions will be added. - C(excluded) will add a package name spec as excluded to the C(locklist). It means that packages represented by the package name spec will be excluded from transaction operations. All available package versions will be added. - C(absent) will delete entries in the C(locklist) that match the package name spec. - C(clean) will delete all entries in the C(locklist). This option is mutually exclusive with C(name). type: str
locklist_post: description: Locklist after module execution. elements: str returned: success and (not check mode or state is clean) sample: - bash-0:4.4.20-1.el8_4.* type: list locklist_pre: description: Locklist before module execution. elements: str returned: success sample: - bash-0:4.4.20-1.el8_4.* - '!bind-32:9.11.26-4.el8_4.*' type: list specs_toadd: description: Package name specs meant to be added by versionlock. elements: str returned: success sample: - bash type: list specs_todelete: description: Package name specs meant to be deleted by versionlock. elements: str returned: success sample: - bind type: list