Dragon 717
Dragon 717

Reputation: 41

[Ansible][Fedora 24] DNF Module Requires python2-dnf but it is Already Installed

I have computers on an internal network that is not connected to the internet, and have copied the relevant rpm packages into my local dnf repository. I'm trying to get ansible's DNF module to install a program on another computer but it pops up an error message stating that python2-dnf is not installed. But when I try to install the program it is already installed. Anyone have an idea whats going wrong?

I've placed the error code below.


Background:

Ansible Control machine: Fedora 24 4.5.5-300.fc24.x86_64 GNU/LINUX
Ansible Client machine: Fedora 24 4.5.5-300.fc24.x86_64 GNU/LINUX 
yum/dnf local repository: Centos 7 3.10.0-327.28.3.el7.x86_64 GNU/LINUX

[root@localhost ansible]# ansible all -m dnf -a "name=vim state=present"

192.168.10.10 | FAILED! => { 
"changed": false, 
"failed": true
, "msg": "python2-dnf is not installed, but it is required for the Ansible dnf module." 
} 

[root@localhost ansible]# yum install python2-dnf

Yum command has been deprecated, redirecting to '/usr/bin/dnf install python2-dnf'. 
See 'man dnf' and 'man yum2dnf' for more information. 
To transfer transaction metadata from yum to DNF, run: 
'dnf install python-dnf-plugins-extras-migrate && dnf-2 migrate'

Last metadata expiration check: 0:12:08 ago on Tue Oct 18 04:57:11 2016.
Package python2-dnf-1.1.9-2.fc24.noarch is already installed, skipping.
Dependencies resolved. 
Nothing to do. 
Complete!

Upvotes: 4

Views: 6351

Answers (1)

Henrik Pingel
Henrik Pingel

Reputation: 3193

As pointed out by @GUIDO you need python2-dnf on the target host.

Ansible module documentation states:

Requirements (on host that executes module)

    python >= 2.6
    python-dnf

on host that executes module means in the context of Ansible the target host of the play, not the control host.

Upvotes: 5

Related Questions