2017-02-05 95 views
0

我有這樣的劇本:致命錯誤,而安裝Python

--- 
- hosts: all 
    become: yes 
    become_user: root 
    gather_facts: no 
    pre_tasks: 
    - name: 'install python2' 
     raw: sudo apt-get -y install python-simplejson 
    roles: 
    - git 
    ... 

有時,工作完全正常,有時它給我這個錯誤:

==> default: Running provisioner: ansible... 
    default: Running ansible-playbook... 
PYTHONUNBUFFERED=1 ANSIBLE_FORCE_COLOR=true ANSIBLE_HOST_KEY_CHECKING=false ANSIBLE_SSH_ARGS='-o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes -i '/var/www/test/.vagrant/machines/default/virtualbox/private_key' -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s' ansible-playbook --connection=ssh --timeout=30 --extra-vars="ansible_ssh_user='ubuntu'" --limit="all" --inventory-file=ansible/hosts/hosts_linux.txt -v ansible/site.yml 
Using /etc/ansible/ansible.cfg as config file 

PLAY *************************************************************************** 

TASK [install python2] ********************************************************* 
fatal: [10.0.11.44]: FAILED! => {"changed": false, "failed": true, "rc": 255, "stderr": "", "stdout": "", "stdout_lines": []} 

PLAY RECAP ********************************************************************* 
10.0.11.44     : ok=0 changed=0 unreachable=0 failed=1 

Ansible failed to complete successfully. Any error output should be 
visible above. Please fix these errors and try again. 

我想知道爲什麼我得到這個錯誤是什麼意思?錯誤沒有輸出,如果我嘗試多次,完全相同的代碼工作。這個不成立。爲什麼安裝python失敗?

+0

什麼是可靠的版本?您是否嘗試使用-vvvv選項運行ansible-playbook以獲取更多調試信息? – gile

+0

它這樣問:主機'10.0.11.44(10.0.11.44)'的真實性無法建立。 ECDSA密鑰指紋是SHA256:OdyB21PWYP5NqgU6MfaV5Gr82tWsZxCg + juGVGub62M。 您確定要繼續連接(是/否)嗎? yes –

+0

之後,我收到很多以Trying私鑰結尾的錯誤:/home/calinpristavu/.ssh/id_ed25519\r\ndebug3:no such identity:/home/calinpristavu/.ssh/id_ed25519:No such file or directory \ r \ ndebug2:我們沒有發送數據包,禁用方法\ r \ ndebug1:沒有更多的身份驗證方法可以嘗試。\ r \ n權限被拒絕(公鑰,密碼) –

回答

0

根據你的意見,問題是與ssh。您可以在此描述在當前工作目錄和供應OpenSSH的選項直接創建自己的ansible.cfg文件:open-ssh options

我建議你試試:

[defaults] 
host_key_checking = False 
你的劇本運行期間

並且也可以手動指定要使用的SSH密鑰,如:

ansible-playbook --private-key /path/to/ssh_key ... 

最後,確保沒有IP衝突,因爲您的服務器的SSH指紋不應該改變。也嘗試手動ssh'ing幾次。

+0

是的。你是對的最後一個。與之前的其他配置存在知識產權衝突。我所要做的只是改變IP並且工作。我更感興趣的是進行配置工作,而不是配置特定的IP地址。我一定知道IP地址都是錯的,那就是問題所在。謝謝! –