Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ssh/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ssh Ansible sudo在完成5项任务后挂起_Ssh_Ansible - Fatal编程技术网

Ssh Ansible sudo在完成5项任务后挂起

Ssh Ansible sudo在完成5项任务后挂起,ssh,ansible,Ssh,Ansible,设置要求:本地用户=goagent1(ansible从GoCD启动),远程用户=myadmin。myadmin是一个需要密码的sudoer。我们在剧本级别启用了sudo 问题:在执行了~5项任务后,剧本似乎停止了。这种情况经常发生 详细信息:我创建了一个简单的剧本来演示这一点。我们使用的“变成”似乎适用于前几个任务,然后是暂停和超时。我们正在使用ansible vault对真实剧本中的重要数据进行加密,但本例不需要这样做 另外,我可以使用NOPASSWD在远程sudoers中与我的远程用户一起运

设置要求:本地用户=goagent1(ansible从GoCD启动),远程用户=myadmin。myadmin是一个需要密码的sudoer。我们在剧本级别启用了sudo

问题:在执行了~5项任务后,剧本似乎停止了。这种情况经常发生

详细信息:我创建了一个简单的剧本来演示这一点。我们使用的“变成”似乎适用于前几个任务,然后是暂停和超时。我们正在使用ansible vault对真实剧本中的重要数据进行加密,但本例不需要这样做

另外,我可以使用NOPASSWD在远程sudoers中与我的远程用户一起运行下面的playbook,它按照预期成功运行

我确实尝试在sudoers中说明要求,并在ansible.cfg中设置pipeline=True。仍然失败。我们没有更改ansible.cfg中的任何其他默认设置。这种情况发生在Ansible 1.9.4中,我们最近升级到了2.0.0.2,现在仍在发生。我错过了什么?啊

谢谢

$ ansible-playbook -i inventory test.yml
inventory.yml

[servers]
172.99.999.99

[all:vars]
ansible_become_pass=bees
---
- hosts: all
  become: yes
  remote_user: myadmin

  tasks:
    - name: Install Docker-py 1
      pip: name=docker-py version=1.7.2

    - name: Install Docker-py 2
      pip: name=docker-py version=1.7.2

    - name: Install Docker-py 3
      pip: name=docker-py version=1.7.2

    - name: Install Docker-py 4
      pip: name=docker-py version=1.7.2

    - name: Install Docker-py 5
      pip: name=docker-py version=1.7.2

    - name: Install Docker-py 6
      pip: name=docker-py version=1.7.2
test.yml

[servers]
172.99.999.99

[all:vars]
ansible_become_pass=bees
---
- hosts: all
  become: yes
  remote_user: myadmin

  tasks:
    - name: Install Docker-py 1
      pip: name=docker-py version=1.7.2

    - name: Install Docker-py 2
      pip: name=docker-py version=1.7.2

    - name: Install Docker-py 3
      pip: name=docker-py version=1.7.2

    - name: Install Docker-py 4
      pip: name=docker-py version=1.7.2

    - name: Install Docker-py 5
      pip: name=docker-py version=1.7.2

    - name: Install Docker-py 6
      pip: name=docker-py version=1.7.2
结果

bash-4.2$ ansible-playbook -vvv -i inventory test.yml
Using /etc/ansible/ansible.cfg as config file
1 plays in test.yml

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

TASK [setup] *******************************************************************
<172.99.999.99> ESTABLISH SSH CONNECTION FOR USER: myadmin
<172.99.999.99> SSH: EXEC ssh -C -q -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=myadmin -o ConnectTimeout=10 -o ControlPath=/var/go/goagent1/.ansible/cp/ansible-ssh-%h-%p-%r -tt 172.99.999.99 '( umask 22 && mkdir -p "$( echo $HOME/.ansible/tmp/ansible-tmp-1456359119.58-95918451006382 )" && echo "$( echo $HOME/.ansible/tmp/ansible-tmp-1456359119.58-95918451006382 )" )'
<172.99.999.99> PUT /tmp/tmpJco0an TO /home/myadmin/.ansible/tmp/ansible-tmp-1456359119.58-95918451006382/setup
<172.99.999.99> SSH: EXEC sftp -b - -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=myadmin -o ConnectTimeout=10 -o ControlPath=/var/go/goagent1/.ansible/cp/ansible-ssh-%h-%p-%r '[172.99.999.99]'
<172.99.999.99> ESTABLISH SSH CONNECTION FOR USER: myadmin
<172.99.999.99> SSH: EXEC ssh -C -q -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=myadmin -o ConnectTimeout=10 -o ControlPath=/var/go/goagent1/.ansible/cp/ansible-ssh-%h-%p-%r -tt 172.99.999.99 '/bin/sh -c '"'"'sudo -H -S  -p "[sudo via ansible, key=douxqzlrhzbmddrngwhkzzkllhwikott] password: " -u root /bin/sh -c '"'"'"'"'"'"'"'"'echo BECOME-SUCCESS-douxqzlrhzbmddrngwhkzzkllhwikott; LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /home/myadmin/.ansible/tmp/ansible-tmp-1456359119.58-95918451006382/setup; rm -rf "/home/myadmin/.ansible/tmp/ansible-tmp-1456359119.58-95918451006382/" > /dev/null 2>&1'"'"'"'"'"'"'"'"''"'"''
ok: [172.99.999.99]

TASK [Install Docker-py 1] *****************************************************
task path: /var/go/goagent1/test.yml:7
<172.99.999.99> ESTABLISH SSH CONNECTION FOR USER: myadmin
<172.99.999.99> SSH: EXEC ssh -C -q -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=myadmin -o ConnectTimeout=10 -o ControlPath=/var/go/goagent1/.ansible/cp/ansible-ssh-%h-%p-%r -tt 172.99.999.99 '( umask 22 && mkdir -p "$( echo $HOME/.ansible/tmp/ansible-tmp-1456359120.37-190856866525263 )" && echo "$( echo $HOME/.ansible/tmp/ansible-tmp-1456359120.37-190856866525263 )" )'
<172.99.999.99> PUT /tmp/tmpvfLqbm TO /home/myadmin/.ansible/tmp/ansible-tmp-1456359120.37-190856866525263/pip
<172.99.999.99> SSH: EXEC sftp -b - -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=myadmin -o ConnectTimeout=10 -o ControlPath=/var/go/goagent1/.ansible/cp/ansible-ssh-%h-%p-%r '[172.99.999.99]'
<172.99.999.99> ESTABLISH SSH CONNECTION FOR USER: myadmin
<172.99.999.99> SSH: EXEC ssh -C -q -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=myadmin -o ConnectTimeout=10 -o ControlPath=/var/go/goagent1/.ansible/cp/ansible-ssh-%h-%p-%r -tt 172.99.999.99 '/bin/sh -c '"'"'sudo -H -S  -p "[sudo via ansible, key=chqigwnearrswbewrqnifzjswhxzomvl] password: " -u root /bin/sh -c '"'"'"'"'"'"'"'"'echo BECOME-SUCCESS-chqigwnearrswbewrqnifzjswhxzomvl; LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /home/myadmin/.ansible/tmp/ansible-tmp-1456359120.37-190856866525263/pip; rm -rf "/home/myadmin/.ansible/tmp/ansible-tmp-1456359120.37-190856866525263/" > /dev/null 2>&1'"'"'"'"'"'"'"'"''"'"''
changed: [172.99.999.99] => {"changed": true, "cmd": "/bin/pip install docker-py==1.7.2", "invocation": {"module_args": {"chdir": null, "editable": true, "executable": null, "extra_args": null, "name": "docker-py", "requirements": null, "state": "present", "use_mirrors": true, "version": "1.7.2", "virtualenv": null, "virtualenv_command": "virtualenv", "virtualenv_python": null, "virtualenv_site_packages": false}, "module_name": "pip"}, "name": "docker-py", "requirements": null, "state": "present", "stderr": "", "stdout": "Collecting docker-py==1.7.2\n  Using cached docker-py-1.7.2.tar.gz\nRequirement already satisfied (use --upgrade to upgrade): requests>=2.5.2 in /usr/lib/python2.7/site-packages (from docker-py==1.7.2)\nRequirement already satisfied (use --upgrade to upgrade): six>=1.4.0 in /usr/lib/python2.7/site-packages (from docker-py==1.7.2)\nRequirement already satisfied (use --upgrade to upgrade): websocket-client>=0.32.0 in /usr/lib/python2.7/site-packages (from docker-py==1.7.2)\nRequirement already satisfied (use --upgrade to upgrade): backports.ssl-match-hostname in /usr/lib/python2.7/site-packages (from websocket-client>=0.32.0->docker-py==1.7.2)\nInstalling collected packages: docker-py\n  Running setup.py install for docker-py: started\n\u001b[?25l    Running setup.py install for docker-py: finished with status 'done'\n\u001b[?25hSuccessfully installed docker-py-1.7.2\n", "stdout_lines": ["Collecting docker-py==1.7.2", "  Using cached docker-py-1.7.2.tar.gz", "Requirement already satisfied (use --upgrade to upgrade): requests>=2.5.2 in /usr/lib/python2.7/site-packages (from docker-py==1.7.2)", "Requirement already satisfied (use --upgrade to upgrade): six>=1.4.0 in /usr/lib/python2.7/site-packages (from docker-py==1.7.2)", "Requirement already satisfied (use --upgrade to upgrade): websocket-client>=0.32.0 in /usr/lib/python2.7/site-packages (from docker-py==1.7.2)", "Requirement already satisfied (use --upgrade to upgrade): backports.ssl-match-hostname in /usr/lib/python2.7/site-packages (from websocket-client>=0.32.0->docker-py==1.7.2)", "Installing collected packages: docker-py", "  Running setup.py install for docker-py: started", "\u001b[?25l    Running setup.py install for docker-py: finished with status 'done'", "\u001b[?25hSuccessfully installed docker-py-1.7.2"], "version": "1.7.2", "virtualenv": null}

TASK [Install Docker-py 2] *****************************************************
task path: /var/go/goagent1/test.yml:10
<172.99.999.99> ESTABLISH SSH CONNECTION FOR USER: myadmin
<172.99.999.99> SSH: EXEC ssh -C -q -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=myadmin -o ConnectTimeout=10 -o ControlPath=/var/go/goagent1/.ansible/cp/ansible-ssh-%h-%p-%r -tt 172.99.999.99 '( umask 22 && mkdir -p "$( echo $HOME/.ansible/tmp/ansible-tmp-1456359122.42-261916276173598 )" && echo "$( echo $HOME/.ansible/tmp/ansible-tmp-1456359122.42-261916276173598 )" )'
<172.99.999.99> PUT /tmp/tmpS1j9qh TO /home/myadmin/.ansible/tmp/ansible-tmp-1456359122.42-261916276173598/pip
<172.99.999.99> SSH: EXEC sftp -b - -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=myadmin -o ConnectTimeout=10 -o ControlPath=/var/go/goagent1/.ansible/cp/ansible-ssh-%h-%p-%r '[172.99.999.99]'
<172.99.999.99> ESTABLISH SSH CONNECTION FOR USER: myadmin
<172.99.999.99> SSH: EXEC ssh -C -q -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=myadmin -o ConnectTimeout=10 -o ControlPath=/var/go/goagent1/.ansible/cp/ansible-ssh-%h-%p-%r -tt 172.99.999.99 '/bin/sh -c '"'"'sudo -H -S  -p "[sudo via ansible, key=jwxftzdclbpnokvptjxtkqgvmwsdiunx] password: " -u root /bin/sh -c '"'"'"'"'"'"'"'"'echo BECOME-SUCCESS-jwxftzdclbpnokvptjxtkqgvmwsdiunx; LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /home/myadmin/.ansible/tmp/ansible-tmp-1456359122.42-261916276173598/pip; rm -rf "/home/myadmin/.ansible/tmp/ansible-tmp-1456359122.42-261916276173598/" > /dev/null 2>&1'"'"'"'"'"'"'"'"''"'"''
ok: [172.99.999.99] => {"changed": false, "cmd": "/bin/pip install docker-py==1.7.2", "invocation": {"module_args": {"chdir": null, "editable": true, "executable": null, "extra_args": null, "name": "docker-py", "requirements": null, "state": "present", "use_mirrors": true, "version": "1.7.2", "virtualenv": null, "virtualenv_command": "virtualenv", "virtualenv_python": null, "virtualenv_site_packages": false}, "module_name": "pip"}, "name": "docker-py", "requirements": null, "state": "present", "stderr": "", "stdout": "Requirement already satisfied (use --upgrade to upgrade): docker-py==1.7.2 in /usr/lib/python2.7/site-packages\nRequirement already satisfied (use --upgrade to upgrade): requests>=2.5.2 in /usr/lib/python2.7/site-packages (from docker-py==1.7.2)\nRequirement already satisfied (use --upgrade to upgrade): six>=1.4.0 in /usr/lib/python2.7/site-packages (from docker-py==1.7.2)\nRequirement already satisfied (use --upgrade to upgrade): websocket-client>=0.32.0 in /usr/lib/python2.7/site-packages (from docker-py==1.7.2)\nRequirement already satisfied (use --upgrade to upgrade): backports.ssl-match-hostname in /usr/lib/python2.7/site-packages (from websocket-client>=0.32.0->docker-py==1.7.2)\n", "stdout_lines": ["Requirement already satisfied (use --upgrade to upgrade): docker-py==1.7.2 in /usr/lib/python2.7/site-packages", "Requirement already satisfied (use --upgrade to upgrade): requests>=2.5.2 in /usr/lib/python2.7/site-packages (from docker-py==1.7.2)", "Requirement already satisfied (use --upgrade to upgrade): six>=1.4.0 in /usr/lib/python2.7/site-packages (from docker-py==1.7.2)", "Requirement already satisfied (use --upgrade to upgrade): websocket-client>=0.32.0 in /usr/lib/python2.7/site-packages (from docker-py==1.7.2)", "Requirement already satisfied (use --upgrade to upgrade): backports.ssl-match-hostname in /usr/lib/python2.7/site-packages (from websocket-client>=0.32.0->docker-py==1.7.2)"], "version": "1.7.2", "virtualenv": null}

TASK [Install Docker-py 3] *****************************************************
task path: /var/go/goagent1/test.yml:13
<172.99.999.99> ESTABLISH SSH CONNECTION FOR USER: myadmin
<172.99.999.99> SSH: EXEC ssh -C -q -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=myadmin -o ConnectTimeout=10 -o ControlPath=/var/go/goagent1/.ansible/cp/ansible-ssh-%h-%p-%r -tt 172.99.999.99 '( umask 22 && mkdir -p "$( echo $HOME/.ansible/tmp/ansible-tmp-1456359123.4-141502625881211 )" && echo "$( echo $HOME/.ansible/tmp/ansible-tmp-1456359123.4-141502625881211 )" )'
<172.99.999.99> PUT /tmp/tmpnoyP6R TO /home/myadmin/.ansible/tmp/ansible-tmp-1456359123.4-141502625881211/pip
<172.99.999.99> SSH: EXEC sftp -b - -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=myadmin -o ConnectTimeout=10 -o ControlPath=/var/go/goagent1/.ansible/cp/ansible-ssh-%h-%p-%r '[172.99.999.99]'
<172.99.999.99> ESTABLISH SSH CONNECTION FOR USER: myadmin
<172.99.999.99> SSH: EXEC ssh -C -q -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=myadmin -o ConnectTimeout=10 -o ControlPath=/var/go/goagent1/.ansible/cp/ansible-ssh-%h-%p-%r -tt 172.99.999.99 '/bin/sh -c '"'"'sudo -H -S  -p "[sudo via ansible, key=eqmlffurkgladlcnvtdhqkzolhjtwnjo] password: " -u root /bin/sh -c '"'"'"'"'"'"'"'"'echo BECOME-SUCCESS-eqmlffurkgladlcnvtdhqkzolhjtwnjo; LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /home/myadmin/.ansible/tmp/ansible-tmp-1456359123.4-141502625881211/pip; rm -rf "/home/myadmin/.ansible/tmp/ansible-tmp-1456359123.4-141502625881211/" > /dev/null 2>&1'"'"'"'"'"'"'"'"''"'"''
ok: [172.99.999.99] => {"changed": false, "cmd": "/bin/pip install docker-py==1.7.2", "invocation": {"module_args": {"chdir": null, "editable": true, "executable": null, "extra_args": null, "name": "docker-py", "requirements": null, "state": "present", "use_mirrors": true, "version": "1.7.2", "virtualenv": null, "virtualenv_command": "virtualenv", "virtualenv_python": null, "virtualenv_site_packages": false}, "module_name": "pip"}, "name": "docker-py", "requirements": null, "state": "present", "stderr": "", "stdout": "Requirement already satisfied (use --upgrade to upgrade): docker-py==1.7.2 in /usr/lib/python2.7/site-packages\nRequirement already satisfied (use --upgrade to upgrade): requests>=2.5.2 in /usr/lib/python2.7/site-packages (from docker-py==1.7.2)\nRequirement already satisfied (use --upgrade to upgrade): six>=1.4.0 in /usr/lib/python2.7/site-packages (from docker-py==1.7.2)\nRequirement already satisfied (use --upgrade to upgrade): websocket-client>=0.32.0 in /usr/lib/python2.7/site-packages (from docker-py==1.7.2)\nRequirement already satisfied (use --upgrade to upgrade): backports.ssl-match-hostname in /usr/lib/python2.7/site-packages (from websocket-client>=0.32.0->docker-py==1.7.2)\n", "stdout_lines": ["Requirement already satisfied (use --upgrade to upgrade): docker-py==1.7.2 in /usr/lib/python2.7/site-packages", "Requirement already satisfied (use --upgrade to upgrade): requests>=2.5.2 in /usr/lib/python2.7/site-packages (from docker-py==1.7.2)", "Requirement already satisfied (use --upgrade to upgrade): six>=1.4.0 in /usr/lib/python2.7/site-packages (from docker-py==1.7.2)", "Requirement already satisfied (use --upgrade to upgrade): websocket-client>=0.32.0 in /usr/lib/python2.7/site-packages (from docker-py==1.7.2)", "Requirement already satisfied (use --upgrade to upgrade): backports.ssl-match-hostname in /usr/lib/python2.7/site-packages (from websocket-client>=0.32.0->docker-py==1.7.2)"], "version": "1.7.2", "virtualenv": null}

TASK [Install Docker-py 4] *****************************************************
task path: /var/go/goagent1/test.yml:16
<172.99.999.99> ESTABLISH SSH CONNECTION FOR USER: myadmin
<172.99.999.99> SSH: EXEC ssh -C -q -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=myadmin -o ConnectTimeout=10 -o ControlPath=/var/go/goagent1/.ansible/cp/ansible-ssh-%h-%p-%r -tt 172.99.999.99 '( umask 22 && mkdir -p "$( echo $HOME/.ansible/tmp/ansible-tmp-1456359124.36-194141614024427 )" && echo "$( echo $HOME/.ansible/tmp/ansible-tmp-1456359124.36-194141614024427 )" )'
<172.99.999.99> PUT /tmp/tmpHGNrHc TO /home/myadmin/.ansible/tmp/ansible-tmp-1456359124.36-194141614024427/pip
<172.99.999.99> SSH: EXEC sftp -b - -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=myadmin -o ConnectTimeout=10 -o ControlPath=/var/go/goagent1/.ansible/cp/ansible-ssh-%h-%p-%r '[172.99.999.99]'
<172.99.999.99> ESTABLISH SSH CONNECTION FOR USER: myadmin
<172.99.999.99> SSH: EXEC ssh -C -q -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=myadmin -o ConnectTimeout=10 -o ControlPath=/var/go/goagent1/.ansible/cp/ansible-ssh-%h-%p-%r -tt 172.99.999.99 '/bin/sh -c '"'"'sudo -H -S  -p "[sudo via ansible, key=beraduqnvoedusfzxlidyadsqkmmkcff] password: " -u root /bin/sh -c '"'"'"'"'"'"'"'"'echo BECOME-SUCCESS-beraduqnvoedusfzxlidyadsqkmmkcff; LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /home/myadmin/.ansible/tmp/ansible-tmp-1456359124.36-194141614024427/pip; rm -rf "/home/myadmin/.ansible/tmp/ansible-tmp-1456359124.36-194141614024427/" > /dev/null 2>&1'"'"'"'"'"'"'"'"''"'"''
ok: [172.99.999.99] => {"changed": false, "cmd": "/bin/pip install docker-py==1.7.2", "invocation": {"module_args": {"chdir": null, "editable": true, "executable": null, "extra_args": null, "name": "docker-py", "requirements": null, "state": "present", "use_mirrors": true, "version": "1.7.2", "virtualenv": null, "virtualenv_command": "virtualenv", "virtualenv_python": null, "virtualenv_site_packages": false}, "module_name": "pip"}, "name": "docker-py", "requirements": null, "state": "present", "stderr": "", "stdout": "Requirement already satisfied (use --upgrade to upgrade): docker-py==1.7.2 in /usr/lib/python2.7/site-packages\nRequirement already satisfied (use --upgrade to upgrade): requests>=2.5.2 in /usr/lib/python2.7/site-packages (from docker-py==1.7.2)\nRequirement already satisfied (use --upgrade to upgrade): six>=1.4.0 in /usr/lib/python2.7/site-packages (from docker-py==1.7.2)\nRequirement already satisfied (use --upgrade to upgrade): websocket-client>=0.32.0 in /usr/lib/python2.7/site-packages (from docker-py==1.7.2)\nRequirement already satisfied (use --upgrade to upgrade): backports.ssl-match-hostname in /usr/lib/python2.7/site-packages (from websocket-client>=0.32.0->docker-py==1.7.2)\n", "stdout_lines": ["Requirement already satisfied (use --upgrade to upgrade): docker-py==1.7.2 in /usr/lib/python2.7/site-packages", "Requirement already satisfied (use --upgrade to upgrade): requests>=2.5.2 in /usr/lib/python2.7/site-packages (from docker-py==1.7.2)", "Requirement already satisfied (use --upgrade to upgrade): six>=1.4.0 in /usr/lib/python2.7/site-packages (from docker-py==1.7.2)", "Requirement already satisfied (use --upgrade to upgrade): websocket-client>=0.32.0 in /usr/lib/python2.7/site-packages (from docker-py==1.7.2)", "Requirement already satisfied (use --upgrade to upgrade): backports.ssl-match-hostname in /usr/lib/python2.7/site-packages (from websocket-client>=0.32.0->docker-py==1.7.2)"], "version": "1.7.2", "virtualenv": null}

TASK [Install Docker-py 5] *****************************************************
task path: /var/go/goagent1/test.yml:19
<172.99.999.99> ESTABLISH SSH CONNECTION FOR USER: myadmin
<172.99.999.99> SSH: EXEC ssh -C -q -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=myadmin -o ConnectTimeout=10 -o ControlPath=/var/go/goagent1/.ansible/cp/ansible-ssh-%h-%p-%r -tt 172.99.999.99 '( umask 22 && mkdir -p "$( echo $HOME/.ansible/tmp/ansible-tmp-1456359124.92-165709074016367 )" && echo "$( echo $HOME/.ansible/tmp/ansible-tmp-1456359124.92-165709074016367 )" )'
<172.99.999.99> PUT /tmp/tmp8uZ91z TO /home/myadmin/.ansible/tmp/ansible-tmp-1456359124.92-165709074016367/pip
<172.99.999.99> SSH: EXEC sftp -b - -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=myadmin -o ConnectTimeout=10 -o ControlPath=/var/go/goagent1/.ansible/cp/ansible-ssh-%h-%p-%r '[172.99.999.99]'
<172.99.999.99> ESTABLISH SSH CONNECTION FOR USER: myadmin
<172.99.999.99> SSH: EXEC ssh -C -q -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=myadmin -o ConnectTimeout=10 -o ControlPath=/var/go/goagent1/.ansible/cp/ansible-ssh-%h-%p-%r -tt 172.99.999.99 '/bin/sh -c '"'"'sudo -H -S  -p "[sudo via ansible, key=krdaymenedsdokntbfdjtispegjjtcyo] password: " -u root /bin/sh -c '"'"'"'"'"'"'"'"'echo BECOME-SUCCESS-krdaymenedsdokntbfdjtispegjjtcyo; LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /home/myadmin/.ansible/tmp/ansible-tmp-1456359124.92-165709074016367/pip; rm -rf "/home/myadmin/.ansible/tmp/ansible-tmp-1456359124.92-165709074016367/" > /dev/null 2>&1'"'"'"'"'"'"'"'"''"'"''
fatal: [172.99.999.99]: FAILED! => {"failed": true, "msg": "ERROR! Timeout (12s) waiting for privilege escalation prompt: "}

PLAY RECAP *********************************************************************
172.99.999.99              : ok=5    changed=1    unreachable=0    failed=1
bash-4.2$ansible playbook-vvv-i inventory test.yml
使用/etc/ansible/ansible.cfg作为配置文件
1在test.yml中播放
玩***************************************************************************
任务[设置]*******************************************************************
为用户myadmin建立SSH连接
SSH:EXEC SSH-C-q-o ControlMaster=auto-o ControlPersist=60s-o KbdInteractiveAuthentication=no-o PreferredAuthentications=gssapi with mic、gssapi-keyex、基于主机、公钥-o PasswordAuthentication=no-o User=myadmin-o ConnectTimeout=10-o ControlPath=/var/go/goagent1/.ansible/cp/ansible SSH-%p-%r-tt 172.99.999.99(umask 22&&mkdir-p“$(echo$HOME/.ansible/tmp/ansible-tmp-1456359119.58-95918451006382)”和&echo“$(echo$HOME/.ansible/tmp/ansible-tmp-1456359119.58-95918451006382)”
将/tmp/tmpJco0an放到/home/myadmin/.ansible/tmp/ansible-tmp-1456359119.58-95918451006382/setup
SSH:EXEC sftp-b--C-o ControlMaster=auto-o ControlPersist=60s-o KbdInteractiveAuthentication=no-o PreferredAuthentications=gssapi with mic、gssapi-keyex、基于主机、公钥-o PasswordAuthentication=no-o User=myadmin-o ConnectTimeout=10-o ControlPath=/var/go/goagent1/.ansible/cp/ansible SSH-%p-%r'[172.99.999.99]'
为用户myadmin建立SSH连接
SSH:EXEC SSH-C-q-o ControlMaster=auto-o ControlPersist=60s-o KbdInteractiveAuthentication=no-o PreferredAuthentications=gssapi with mic、gssapi-keyex、基于主机、公钥-o PasswordAuthentication=no-o User=myadmin-o ConnectTimeout=10-o ControlPath=/var/go/goagent1/.ansible/cp/ansible SSH-%p-%r-tt 172.99.999.99'/bin/sh-C''“'sudo-H-S-p'[sudo via ansible,key=douxqzlrhzbmddrngwhkzzkllhwikott]密码:“-u root/bin/sh-c'''''''''''''''''''''''''''''''''”echo成为成功的douxqzlrhzbmddrngwhkzzkllhwikott;LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8/usr/bin/python/home/myadmin/.ansible/tmp/ansible-tmp-1456359119.58-95918451006382/setup;rm-rf“/home/myadmin/.ansible/tmp/ansible-tmp-1456359119.58-95918451006382/”>/dev/null 2>&1“
ok:[172.99.999.99]
任务[安装Docker py 1]*****************************************************
任务路径:/var/go/goagent1/test.yml:7
为用户myadmin建立SSH连接
SSH:EXEC SSH-C-q-o ControlMaster=auto-o ControlPersist=60s-o KbdInteractiveAuthentication=no-o PreferredAuthentications=gssapi with mic、gssapi-keyex、基于主机、公钥-o PasswordAuthentication=no-o User=myadmin-o ConnectTimeout=10-o ControlPath=/var/go/goagent1/.ansible/cp/ansible SSH-%p-%r-tt 172.99.999.99(umask 22&&mkdir-p“$(echo$HOME/.ansible/tmp/ansible-tmp-1456359120.37-190856866525263)”和&echo“$(echo$HOME/.ansible/tmp/ansible-tmp-1456359120.37-190856866525263)”
将/tmp/tmpvfLqbm放到/home/myadmin/.ansible/tmp/ansible-tmp-1456359120.37-190856866525263/pip
SSH:EXEC sftp-b--C-o ControlMaster=auto-o ControlPersist=60s-o KbdInteractiveAuthentication=no-o PreferredAuthentications=gssapi with mic、gssapi-keyex、基于主机、公钥-o PasswordAuthentication=no-o User=myadmin-o ConnectTimeout=10-o ControlPath=/var/go/goagent1/.ansible/cp/ansible SSH-%p-%r'[172.99.999.99]'
为用户myadmin建立SSH连接
SSH:EXEC SSH-C-q-o ControlMaster=auto-o ControlPersist=60s-o KbdInteractiveAuthentication=no-o PreferredAuthentications=gssapi with mic、gssapi-keyex、基于主机、公钥-o PasswordAuthentication=no-o User=myadmin-o ConnectTimeout=10-o ControlPath=/var/go/goagent1/.ansible/cp/ansible SSH-%p-%r-tt 172.99.999.99'/bin/sh-C''“'sudo-H-S-p'[sudo via ansible,key=chqigwnerswebewrqnifzjswhxzomvl]密码:“-u root/bin/sh-c'''''''''''''''''''''''''''''''''”echo成为成功的chqigwnerswberswewrifzjswhxzomvl;LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8/usr/bin/python/home/myadmin/.ansible/tmp/ansible-tmp-1456359120.37-190856866525263/pip;rm-rf“/home/myadmin/.ansible/tmp/ansible-tmp-1456359120.37-190856866525263/”>/dev/null 2>&1“
更改:[172.99.999.99]=>{“更改”:true,“cmd”:“/bin/pip安装docker py==1.7.2”,“调用”:{“模块参数”:{“chdir”:null,“可编辑的”:true,“可执行的”:null,“额外参数”:null,“名称”:“docker py”,“要求”:null,“状态”:“当前”,“使用镜像”:true,“版本”:“1.7.2”,“virtualenv”:null,“virtualenv”;“virtualenv\u命令”:“virtualenv”,“virtualenv_python”:null,“virtualenv_site_packages”:false},“module_name”:“pip”},“name”:“docker py”,“requirements”:null,“state”:“present”,“stderr”:“stdout”:“collection docker py==1.7.2\n使用缓存的docker-py-1.7.2.tar.gz\n已满足要求(使用--升级升级升级):requests>=2.5.2 in/usr/lib/python2.7/site-packages(来自docker py==