Ansible
openstack-ansible 卡在 ssh 上
我很勇敢地使用 Ansible 部署 OpenStack。打孔命令的最後階段,除了我遇到 ssh 錯誤。這似乎是針對 OpenStack 的分叉或定制的 ansible。過去,在“ssh-copy-id”和正確的 cfg 上,事情馬上就奏效了。(注:出於測試目的,允許root登錄)
os@7:/opt/openstack-ansible/playbooks$ sudo openstack-ansible setup-hosts.yml -vvvv Variable files: "-e @/etc/openstack_deploy/user_group_vars.yml -e @/etc/openstack_deploy/user_secrets.yml -e @/etc/openstack_deploy/user_variables.yml " PLAY [Basic host setup] ******************************************************* GATHERING FACTS *************************************************************** <172.27.255.84> ESTABLISH CONNECTION FOR USER: root <10.4.1.113> ESTABLISH CONNECTION FOR USER: root <172.27.255.84> REMOTE_MODULE setup <172.27.255.93> ESTABLISH CONNECTION FOR USER: root <10.4.1.113> REMOTE_MODULE setup <172.27.255.91> ESTABLISH CONNECTION FOR USER: root <172.27.255.164> ESTABLISH CONNECTION FOR USER: root <172.27.255.93> REMOTE_MODULE setup <172.27.255.91> REMOTE_MODULE setup <172.27.255.164> REMOTE_MODULE setup <172.27.255.84> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/home/os/.ansible/cp/ansible-ssh-%h-%p-%r" -o Port=22 -o IdentityFile="/home/os/.ssh/id_rsa" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=120 172.27.255.84 /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1458671499.99-38377904647735 && echo $HOME/.ansible/tmp/ansible-tmp-1458671499.99-38377904647735' <10.4.1.113> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/home/os/.ansible/cp/ansible-ssh-%h-%p-%r" -o Port=22 -o IdentityFile="/home/os/.ssh/id_rsa" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=120 10.4.1.113 /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1458671499.99-28043973332190 && echo $HOME/.ansible/tmp/ansible-tmp-1458671499.99-28043973332190' <172.27.255.93> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/home/os/.ansible/cp/ansible-ssh-%h-%p-%r" -o Port=22 -o IdentityFile="/home/os/.ssh/id_rsa" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=120 172.27.255.93 /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1458671499.99-247742941146890 && echo $HOME/.ansible/tmp/ansible-tmp-1458671499.99-247742941146890' <172.27.255.91> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/home/os/.ansible/cp/ansible-ssh-%h-%p-%r" -o Port=22 -o IdentityFile="/home/os/.ssh/id_rsa" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=120 172.27.255.91 /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1458671499.99-239068187999404 && echo $HOME/.ansible/tmp/ansible-tmp-1458671499.99-239068187999404' <172.27.255.164> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/home/os/.ansible/cp/ansible-ssh-%h-%p-%r" -o Port=22 -o IdentityFile="/home/os/.ssh/id_rsa" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=120 172.27.255.164 /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1458671499.99-253354461562706 && echo $HOME/.ansible/tmp/ansible-tmp-1458671499.99-253354461562706' fatal: [infra1] => SSH Error: Permission denied (publickey,password). while connecting to 172.27.255.84:22 It is sometimes useful to re-run the command using -vvvv, which prints SSH debug output to help diagnose the issue. <172.27.255.164> ESTABLISH CONNECTION FOR USER: root fatal: [900089-compute001] => SSH Error: Permission denied (publickey,password). while connecting to 172.27.255.164:22 It is sometimes useful to re-run the command using -vvvv, which prints SSH debug output to help diagnose the issue. <172.27.255.164> REMOTE_MODULE setup fatal: [storage1] => SSH Error: Permission denied (publickey,password). while connecting to 10.4.1.113:22 It is sometimes useful to re-run the command using -vvvv, which prints SSH debug output to help diagnose the issue. <172.27.255.164> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/home/os/.ansible/cp/ansible-ssh-%h-%p-%r" -o Port=22 -o IdentityFile="/home/os/.ssh/id_rsa" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=120 172.27.255.164 /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1458671500.08-121316397320847 && echo $HOME/.ansible/tmp/ansible-tmp-1458671500.08-121316397320847' fatal: [infra3] => SSH Error: Permission denied (publickey,password). while connecting to 172.27.255.93:22 It is sometimes useful to re-run the command using -vvvv, which prints SSH debug output to help diagnose the issue. fatal: [infra2] => SSH Error: Permission denied (publickey,password). while connecting to 172.27.255.91:22 It is sometimes useful to re-run the command using -vvvv, which prints SSH debug output to help diagnose the issue. fatal: [compute1] => SSH Error: Permission denied (publickey,password). while connecting to 172.27.255.164:22 It is sometimes useful to re-run the command using -vvvv, which prints SSH debug output to help diagnose the issue. TASK: [apt_package_pinning | Add apt pin preferences] ************************* FATAL: no hosts matched or all hosts have already failed -- aborting PLAY RECAP ******************************************************************** to retry, use: --limit @/home/os/setup-hosts.retry 900089-compute001 : ok=0 changed=0 unreachable=1 failed=0 compute1 : ok=0 changed=0 unreachable=1 failed=0 infra1 : ok=0 changed=0 unreachable=1 failed=0 infra2 : ok=0 changed=0 unreachable=1 failed=0 infra3 : ok=0 changed=0 unreachable=1 failed=0 storage1 : ok=0 changed=0 unreachable=1 failed=0 os@7:/opt/openstack-ansible/playbooks$
如您所見,“ssh os@ip”直接有效。
root@7:/etc/openstack_deploy# ssh root@172.27.255.164 Welcome to Ubuntu 14.04.3 LTS (GNU/Linux 3.19.0-47-generic x86_64) * Documentation: https://help.ubuntu.com/ root@13:~# root@13:~# exit logout Connection to 172.27.255.164 closed. root@7:/etc/openstack_deploy#
但只有通過“ansible”才會失敗。
這是版本#
$ openstack-ansible --version Variable files: "-e @/etc/openstack_deploy/user_group_vars.yml -e @/etc/openstack_deploy/user_secrets.yml -e @/etc/openstack_deploy/user_variables.yml " ansible-playbook 1.9.4 configured module search path = /etc/ansible/plugins/library
和劇本拉的cfg
[defaults] # Additional plugins lookup_plugins = /etc/ansible/plugins/lookup filter_plugins = /etc/ansible/plugins/filter action_plugins = /etc/ansible/plugins/action library = /etc/ansible/plugins/library transport = smart remote_port = 22 #ask_sudo_pass = True # Fact caching gathering = smart fact_caching = jsonfile fact_caching_connection = /etc/openstack_deploy/ansible_facts fact_caching_timeout = 86400 inventory = inventory #host_key_checking = False # Set color options nocolor = 0 # SSH timeout timeout = 120 private_key_file = ~/.ssh/id_rsa [ssh_connection] #pipelining = True
似乎您的清單沒有使用根目錄
id_rsa
,而是位於其中的目錄,/home/os/.ssh/id_rsa
因此當 ansible 嘗試連接您的主機時,它是不允許的。嘗試通過引用正確的id_rsa
.另一方面,https: //www.rdoproject.org 允許您在 OpenStack 上部署 OpenStack,也稱為 TripleO,它是一個在後台使用 Ansible 的 bash 腳本。在一小時內完成了我的堆棧設置。