2017-07-28 31 views
0

我需要安裝ansible-2.3.1.0只從我複製到防火牆主機的文件。內部支持的pip安裝只支持1.x,所以我不能使用它。ansible 2.3.1.0僅從文件安裝

聯機主機上的默認Python爲2.7.12,脫機主機爲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,它給我這個:

ansible 
Traceback (most recent call last): 
    File "/usr/bin/ansible", line 25, in <module> 
    from ansible.runner import Runner 
ImportError: No module named runner 

有沒有人實際安裝ansible 2.3這樣嗎?我錯過了什麼?

我試着尋找更深的依賴關係,但我無法弄清楚這可能是什麼(我看到有關Ansible API從1.x更改爲2.x,但我不明白什麼是什麼向上還是什麼話在我的情況下解決這個問題

編輯:

複製的/ usr/local/bin目錄/ ansible後*選擇了/ usr/bin中擺脫舊1.x的剩餘ansible命令包裝的自己時,命令現在開始,但是當我運行一個劇本時,我得到了這個(省略了劇本和劇本的命令行,因爲我認爲他們不重要):

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"} 
+0

我敢打賭,你有/ usr/bin/ansible「可執行」,它實際上是python wrapper,從舊版本開始。在這種情況下,請將其替換爲ansible-package-path/bin中的新文件。 –

+0

謝謝,至少現在已經開始了可靠的命令,但仍然存在收集事實問題。我會更新我的問題。 – redgiant

回答

2

固定。

我更徹底此刪除舊的Ansible:

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

然後在/ usr/local/bin目錄/ ansible *命令工作(並不再有任何舊的/ usr/bin中/ ansible *命令取代)和我的手冊也可以工作。

+0

有這個問題使用「Windows 10的Linux子系統」運行Ansible。先安裝一個pip,然後安裝apt-get。運行「sudo pip uninstall ansible」解決了這個問題。感謝帖子redgiant。 – Sage