ansible_playbook_ping _issue_on_node

ansible_playbook_ping _issue_on_node

Using module file /usr/lib/python2.7/dist-packages/ansible/modules/system/setup.py
<192.168.80.129> ESTABLISH SSH CONNECTION FOR USER: ubuntu
<192.168.80.129> SSH: EXEC sshpass -d12 ssh -C -o ControlMaster=auto -o ControlPersist=60s -o User=ubuntu -o ConnectTimeout=10 -o ControlPath=/home/ubuntu/.ansible/cp/827e4da918 192.168.80.129 '/bin/sh -c '"'"'echo ~ && sleep 0'"'"''
<192.168.80.129> (0, '/home/ubuntu\n', '')
<192.168.80.129> ESTABLISH SSH CONNECTION FOR USER: ubuntu
<192.168.80.129> SSH: EXEC sshpass -d12 ssh -C -o ControlMaster=auto -o ControlPersist=60s -o User=ubuntu -o ConnectTimeout=10 -o ControlPath=/home/ubuntu/.ansible/cp/827e4da918 192.168.80.129 '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo /home/ubuntu/.ansible/tmp/ansible-tmp-1505805582.42-5934935041403 `" && echo ansible-tmp-1505805582.42-5934935041403="` echo /home/ubuntu/.ansible/tmp/ansible-tmp-1505805582.42-5934935041403 `" ) && sleep 0'"'"''
<192.168.80.129> (0, 'ansible-tmp-1505805582.42-5934935041403=/home/ubuntu/.ansible/tmp/ansible-tmp-1505805582.42-5934935041403\n', '')
<192.168.80.129> PUT /tmp/tmppfZGQt TO /home/ubuntu/.ansible/tmp/ansible-tmp-1505805582.42-5934935041403/setup.py
<192.168.80.129> SSH: EXEC sshpass -d12 sftp -o BatchMode=no -b - -C -o ControlMaster=auto -o ControlPersist=60s -o User=ubuntu -o ConnectTimeout=10 -o ControlPath=/home/ubuntu/.ansible/cp/827e4da918 '[192.168.80.129]'
<192.168.80.129> (0, 'sftp> put /tmp/tmppfZGQt /home/ubuntu/.ansible/tmp/ansible-tmp-1505805582.42-5934935041403/setup.py\n', '')
<192.168.80.129> ESTABLISH SSH CONNECTION FOR USER: ubuntu
<192.168.80.129> SSH: EXEC sshpass -d12 ssh -C -o ControlMaster=auto -o ControlPersist=60s -o User=ubuntu -o ConnectTimeout=10 -o ControlPath=/home/ubuntu/.ansible/cp/827e4da918 192.168.80.129 '/bin/sh -c '"'"'chmod u+x /home/ubuntu/.ansible/tmp/ansible-tmp-1505805582.42-5934935041403/ /home/ubuntu/.ansible/tmp/ansible-tmp-1505805582.42-5934935041403/setup.py && sleep 0'"'"''
<192.168.80.129> (0, '', '')
<192.168.80.129> ESTABLISH SSH CONNECTION FOR USER: ubuntu
<192.168.80.129> SSH: EXEC sshpass -d12 ssh -C -o ControlMaster=auto -o ControlPersist=60s -o User=ubuntu -o ConnectTimeout=10 -o ControlPath=/home/ubuntu/.ansible/cp/827e4da918 -tt 192.168.80.129 '/bin/sh -c '"'"'sudo -H -S -n -u root /bin/sh -c '"'"'"'"'"'"'"'"'echo BECOME-SUCCESS-akhccfxgnmvxxvctmftwyaaluyrclalh; /usr/bin/python /home/ubuntu/.ansible/tmp/ansible-tmp-1505805582.42-5934935041403/setup.py; rm -rf "/home/ubuntu/.ansible/tmp/ansible-tmp-1505805582.42-5934935041403/" > /dev/null 2>&1'"'"'"'"'"'"'"'"' && sleep 0'"'"''
<192.168.80.129> (1, 'sudo: a password is required\r\n', 'Shared connection to 192.168.80.129 closed.\r\n')
fatal: [192.168.80.129]: FAILED! => {
    "changed": false, 
    "failed": true, 
    "module_stderr": "Shared connection to 192.168.80.129 closed.\r\n", 
    "module_stdout": "sudo: a password is required\r\n", 
    "msg": "MODULE FAILURE", 
    "rc": 1
}
    to retry, use: --limit @/etc/ansible/site.retry

我的剧本看起来像

---
- hosts: servers
  remote_user: ubuntu
  become: yes
  tasks:
    - name: Install tmux
      apt: name=tmux state=present

在远程节点或 运行 带有 --ask-become-pass 开关的 ansible-playbook 上设置无密码 sudo。