I tried to upgrade some packages with the APT/DNF modules.
To do this, I’ve set a variable with the package name and a wildcard.
For example, let’s consider upgrading all python3
packages with DNF.
# Task
vars:
package: "python3*"
tasks:
- name: Update packages using DNF
ansible.builtin.dnf:
name: "{{ package }}"
state: latest
update_cache: yes
update_only: true
This way the python3 packages won’t be upgraded because there’s no python3*
.
# Result
msg: Nothing to do
rc: 0
results:
- Packages providing python3* not installed due to update_only specified
Unlike the APT module, the DNF module does not seems to support wildcards. Its documentation says I could use a list for this, but I would need to know and write all packages names.
Is there a way to use a wildcard or, maybe, a regular expression with the DNF module?