[Ansible] [Fedora 24] DNF模块需要python2-dnf,但它已经安装好了

时间:2016-10-18 11:27:19

标签: ansible fedora

我的内部网络上的计算机没有连接到互联网,并且已将相关的rpm软件包复制到我的本地dnf存储库中。我试图让ansible的DNF模块在另一台计算机上安装程序,但是会弹出一条错误消息,指出没有安装python2-dnf。但是当我尝试安装程序时,它已经安装好了。任何人都知道什么是错的?

我已将错误代码放在下面。

背景:

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!

1 个答案:

答案 0 :(得分:4)

正如@GUIDO指出的那样,目标主机上需要python2-dnf

Ansible module documentation州:

  

要求(在执行模块的主机上)

    python >= 2.6
    python-dnf
执行模块的主机上的

表示在游戏的Ansible 目标主机的上下文中,而不是控制主机。