gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-02 10:04:56 31 4
gpt4 key购买 nike

我的计算机位于未连接到互联网的内部网络上,并且已将相关的 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!

最佳答案

正如@GUIDO所指出的,您需要在目标主机上使用python2-dnf

Ansible module documentation状态:

Requirements (on host that executes module)

    python >= 2.6
python-dnf

在执行模块的主机上表示在 Ansible 上下文中,播放的目标主机,而不是控制主机。

关于ansible - [Ansible][Fedora 24] DNF 模块需要 python2-dnf 但它已经安装,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40107000/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com