ansible 2.3.1.0仅从文件安装

2024-09-29 02:16:38 发布

您现在位置:Python中文网/ 问答频道 /正文

我只需要从复制到防火墙主机的文件安装ansible-2.3.1.0。内部支持的pip安装只获取ansible1.x,所以我不能使用它。在

在线主机上的默认Python为2.7.12,脱机主机上的默认Python为2.7.6。在

这是我所做的

# on a separate host that can access the internet ...
ssh online_host
mkdir ~/ansible
cd ~/ansible

# download ansible and first-level requirements dependency tarballs
pip install --download . ansible
tar xvf ansible-2.3.1.0.tar.gz
pip install --download . -r ansible-2.3.1.0/requirements.txt

# this gave me these tarballs
ansible-2.3.1.0.tar.gz
Jinja2-2.9.6.tar.gz
paramiko-2.2.1.tar.gz
pycrypto-2.6.1.tar.gz
PyYAML-3.12.tar.gz

# install on the offline host
ssh offline_host
# the tarballs above were copied to here
cd ~/ansible
# unpack and offline install it
sudo pip install ansible-2.3.1.0.tar.gz --no-index --find-links file://`pwd`

但当我尝试运行ansible时,它会给我这个:

^{pr2}$

有没有人真的像这样安装了ansible2.3?我错过了什么?在

我试图寻找更深层次的依赖关系,但我不知道这可能是什么原因(我看到Ansible API从1.x更改为2.x,但我无法从中找出问题所在,也无法确定在我的情况下如何解决此问题。在

编辑:

在将/usr/local/bin/ansible*复制到/usr/bin上以摆脱旧的1.x遗留的ansible命令包装器之后,命令现在启动了,但是当我运行playbook时,我得到了这个命令(省略playbook和ansible playbook命令行,因为我认为它们无关紧要):

TASK [Gathering Facts] *******************************************************************************************************
fatal: [slcmskafka-1169389.stratus.slc.ebay.com]: 
FAILED! => {"changed": false, "failed": true, "msg": 
"Unsupported parameters for (setup) module: gather_subset,gather_timeout.
Supported parameters include: fact_path,filter"}

Tags: installpipthe命令hostondownloadcd
1条回答
网友
1楼 · 发布于 2024-09-29 02:16:38

固定的。在

我更彻底地删除了一个旧的Ansible:

sudo pip uninstall ansible
# didn't need to autoremove
sudo apt-get remove ansible

然后/usr/local/bin/ansible*命令起作用了(不再有任何旧的/usr/bin/ansible*命令可替换),我的剧本也起作用了。在

相关问题 更多 >