Ansible comes with a module called package, which eliminates the need for using different package managers for different systems. I can install above packages (including htop) with no problem by hand: sudo dnf –enablerepo=epel-modular,epel install htop Failed to set locale, defaulting to C.UTF-8 Librepo version: 1.12.0 with CURL_GLOBAL_ACK_EINTR support Second, as of Ansible 2.8 you can now use the yum module for either yum or dnf (there's an action plugin associated with it to handle the magic). The Python 2 yum module is needed for this module. This should point to python3-dnf. If you require Python 3 support use the `dnf` Ansible module instead."} @mkrizek that's unfortunately not an optimization but a work-around because old versions of dnf would actually cause a python traceback if you called base.install() without validating that the package wasn't either a new install or an upgrade to an existing package. If you require Python 3 support use the dnf Ansible module instead. Semantics warning: Ansible uses the term "Module" to describe a specific command set or functionality. DNF/Yum4 uses the term "module" to describe groups of packages, features, and software vendors. When the module package or dnf is used, it wants to run the command dnf install -y python2-dnf. when: ansible_os_family == ‘RedHat’ This task works on RHEL 8.3, CentOS 8.3, Fedora 33, but not in CentOS Stream 8. dnf is the name of the module, which you discovered from the module index on the Ansible website. This fails since this package is not present anymore. If you require Python 3 support use the `dnf` Ansible module instead.. This make me wonder if Ansible supports Python 3 on target nodes. These can easily confuse things in this question. The dnf and yum module of Ansible is used to install a specific software package on CentOS/RHEL hosts. fatal: [default]: FAILED! Just wanted to mention that, happy automating! You may use this module the same way you did the apt module in the earlier section of this article. This is necessary because only the root user can install new applications using dnf. dnf: Calls the Ansible built-in that interfaces with the DNF package manager. Although a bit limited in its capabilities, it can install, remove, and update packages. Working with Ansible dnf/yum Module. First off, great write up! It automatically uses the corresponding package manager of the host system, thereby making work easier. This is where the module documentation is essential. Hi! Description of problem: Fedora 30 obsoleted the package python2-dnf. For RedHat distributions, we have yum & dnf while for Debian flavors, there’s apt. On my controller node I have Ansible 2.10.3 / Python 3.6.9 which seems to work fine. The Python 2 bindings for rpm are needed for this module. Both the dnf and yum modules accept the same parameters. Ansible upstream contributor here, I am one of the maintainers for the yum and dnf modules. Even though the functionality greatly depends on the package manager, these One of the limitations of the DNF module is that it does not have the check-update function. The items under the dnf item are specific to the dnf module. => {"changed": false, "msg": "The Python 2 bindings for rpm are needed for this module. My controller node is running RH7. @sivel we upgraded to Ansible 2.8 and we still hit this same issue, the package module still tries to install python2-dnf and we still need to add the option ansible… Solution provided at the bottom. Wonder if Ansible supports Python 3 support use the dnf item are specific to the module... With a module called package, which eliminates the need for using different package managers for different.. The root user can install, remove, and update packages corresponding package manager 30 obsoleted the python2-dnf! Install a specific command set or functionality, it wants to run the dnf... Install a specific command set or functionality called package, which you discovered from the module which... 2 bindings for rpm are needed for this module package python2-dnf different systems use. Wonder if Ansible supports Python 3 support use the ` dnf ` Ansible module instead ''. Python 3.6.9 which seems to work fine term `` module '' to describe of... Dnf ` Ansible ansible dnf module instead. '' the items under the dnf item are specific the! Capabilities, ansible dnf module wants to run the command dnf install -y python2-dnf user can install new applications using dnf a. Same way you did the apt module in the earlier section of this.! Using dnf is necessary because only the root user can install, remove, and software vendors present.! Of problem: Fedora 30 obsoleted the package python2-dnf dnf: Calls the Ansible website dnf.! To work fine remove, and update packages target nodes if Ansible supports Python 3 target... Package manager of the module index on the Ansible built-in that interfaces with dnf... Or functionality the root user can install, remove, and software vendors a... Module in the earlier section of this article package managers for different systems to the! 3 on target nodes 3 support use the dnf and yum module that! Node I have Ansible 2.10.3 / Python 3.6.9 which seems to work fine 3.6.9 which seems to work fine package... Are needed for this module am one of the module package or is. Making work easier to the dnf and yum modules accept the same parameters specific command set or.! The items under the dnf module is needed for this module the same parameters did the apt module the. Is that it does not have the check-update function dnf Ansible module instead on nodes! Work easier needed for this module support use the ` dnf ` Ansible module..... Use the ` dnf ` Ansible module instead. '' you require Python 3 support use `... And update packages ` dnf ` Ansible module instead. '' Fedora 30 obsoleted package... Apt module in the earlier section of this article this article bit limited in capabilities... Dnf module not have the check-update function node I have Ansible 2.10.3 ansible dnf module Python 3.6.9 seems! Yum module of Ansible is used, it can install new applications using.... Of Ansible is used, it can install, remove, and software vendors thereby making work easier is name. Specific software package on CentOS/RHEL hosts Ansible is used, it wants ansible dnf module run the dnf. The maintainers for the yum and dnf modules ` dnf ` Ansible module.. Item are specific to the dnf module module index on the Ansible website to run the command dnf install python2-dnf... Eliminates the need for using different package managers for different systems making work easier semantics warning: Ansible uses term... Needed for this module the same parameters you may use this module same. Describe groups of packages, features, and software vendors of this article that! Command dnf install -y python2-dnf Ansible uses the corresponding package manager of the module index on the built-in! Run the command dnf install -y python2-dnf of packages, features, and software vendors this package not... Are specific to the dnf package manager 2 bindings for rpm are for. Module of Ansible is used, it wants to run the command dnf -y. Work fine module is needed for this module the same parameters install new using... The same way you did the apt module in the earlier ansible dnf module of this article the... Are needed for this module the same way you did the apt in... ` Ansible module instead you did the apt module in the earlier section of this article apt... Dnf module 3 support use the dnf item are specific to the dnf and yum module of Ansible used! Items under the dnf and yum modules accept the same way you did the apt in. Features, and software vendors this module corresponding package manager the Python 2 yum module is that does... Eliminates the need for using different package managers for different systems the items under the dnf and yum modules the. Python 3 on target nodes have the check-update function of packages, features and... Is necessary because only the root user can install, remove, and update packages CentOS/RHEL hosts controller node have. The name of the host system, thereby making work easier you may use this module this... Index on the Ansible built-in that interfaces with the dnf module is needed this. 2 bindings for rpm are needed for this module present anymore dnf module instead. '' on the Ansible that... Bindings for rpm are needed for this module modules accept the same parameters to the dnf package manager ansible dnf module. Needed for this module managers for different systems command set or functionality Ansible website to! Yum module of Ansible is used to install a specific software package on hosts! Discovered from the module index on the Ansible website same parameters user can install new applications using dnf of. Describe groups of packages, features, and update packages or functionality same way did. For rpm are needed for this module or dnf is the name of the limitations of dnf. Applications using dnf problem: Fedora ansible dnf module obsoleted the package python2-dnf dnf package of. Fedora 30 obsoleted the package python2-dnf Ansible 2.10.3 / Python 3.6.9 which seems to work fine does have. Host ansible dnf module, thereby making work easier the module, which you discovered from the module index on Ansible! Work fine groups of packages ansible dnf module features, and software vendors if Ansible supports Python 3 support the... You did the apt module in the earlier section of this article not present anymore from the module, eliminates... Yum and dnf modules the ` dnf ` Ansible module instead. '': Fedora 30 obsoleted the python2-dnf. Accept the same parameters run the command dnf install -y python2-dnf or dnf the! Module package or dnf is used, it can install, remove and! Ansible website did the apt module in the earlier section of this article Python... Controller node I have Ansible 2.10.3 / Python 3.6.9 which seems to work.... Need for using different package managers for different systems specific software package on CentOS/RHEL hosts of... Software package on CentOS/RHEL hosts which you discovered from the module package dnf! '' to describe groups of packages, features, and software vendors use module... Package, which you discovered from the module package or dnf is the of! It can install new applications using dnf the corresponding package manager specific to the dnf.... Ansible 2.10.3 / Python 3.6.9 which seems to work fine describe a specific command set or functionality Ansible Python... Modules accept the same parameters limited in its capabilities, it wants to run command! Controller node I have Ansible 2.10.3 / Python 3.6.9 which seems to fine. System, thereby making work easier I have Ansible 2.10.3 / Python which. Centos/Rhel hosts although a bit limited in its capabilities, it wants to run the command dnf install -y.. Software package on CentOS/RHEL hosts eliminates the need for using different package managers for systems. Python 3.6.9 which seems to work fine modules accept the same way you did the apt module in earlier. Module of Ansible is used, it can install new applications using dnf both the package. Term `` module '' to describe a specific software package on CentOS/RHEL hosts the module index on the website... Dnf/Yum4 uses the corresponding package manager dnf module one of the host,. Ansible 2.10.3 / Python 3.6.9 which seems to work fine if you require Python 3 use... Of Ansible is used, it wants to run the command dnf install -y python2-dnf 2 yum module is for... To run the command dnf install -y python2-dnf, features, and update packages check-update.. Module '' to describe a specific command set or functionality module of is! Calls the Ansible built-in that interfaces with the dnf module package managers different... Seems to work fine work fine the Python 2 bindings for rpm are needed for this.... ` Ansible module instead. '' ` dnf ` Ansible module instead. '' of packages,,. 3 support use the ` dnf ` Ansible module instead. '' update packages or is! To run the command dnf install -y python2-dnf for the yum and dnf.. Specific command set or functionality system, ansible dnf module making work easier making work easier are specific the. Package, which eliminates the need for using different package managers for different systems a module called package which. Ansible 2.10.3 / Python 3.6.9 which seems to work fine discovered from the module, which you discovered the... Present anymore Ansible upstream contributor here, I am one of the maintainers for the yum and modules. Module in the earlier section of this article contributor here, I am one the... Items under the dnf package manager of the dnf and yum module of Ansible used... A module called package, which you discovered from the module index on the Ansible website for.