我正在运行 Ubuntu 14.04 的 AWS EC2 实例上尝试此操作。
我有一个通知处理程序的任务。当运行处理程序时,我收到错误。我无法理解错误消息,因此无法调试它。
任务:
- name: Set post_max_size to 100M
sudo: yes
lineinfile: dest=/etc/php5/fpm/php.ini regexp='^;?post_max_size =' line='post_max_size = 100M'
notify:
- restart php5-fpm
处理者
---
- name: start php5-fpm
service: name=php5-fpm state=started
- name: restart php5-fpm
service: name=php5-fpm state=restarted
我得到的错误
NOTIFIED: [php | restart php5-fpm] ********************************************
<54.154.82.195> ESTABLISH CONNECTION FOR USER: ubuntu
<54.154.82.195> REMOTE_MODULE service name=php5-fpm state=restarted
<54.154.82.195> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/home/vagrant/.ansible/cp/ansible-ssh-%h-%p-%r" -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=ubuntu -o ConnectTimeout=10 54.154.82.195 /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1433866104.51-11364253366998 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1433866104.51-11364253366998 && echo $HOME/.ansible/tmp/ansible-tmp-1433866104.51-11364253366998'
<52.16.161.67> ESTABLISH CONNECTION FOR USER: ubuntu
<52.16.161.67> REMOTE_MODULE service name=php5-fpm state=restarted
<52.16.161.67> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/home/vagrant/.ansible/cp/ansible-ssh-%h-%p-%r" -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=ubuntu -o ConnectTimeout=10 52.16.161.67 /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1433866104.51-159732570027917 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1433866104.51-159732570027917 && echo $HOME/.ansible/tmp/ansible-tmp-1433866104.51-159732570027917'
<52.16.161.67> PUT /tmp/tmpyZ8NZb TO /home/ubuntu/.ansible/tmp/ansible-tmp-1433866104.51-159732570027917/service
<54.154.82.195> PUT /tmp/tmp67pMQt TO /home/ubuntu/.ansible/tmp/ansible-tmp-1433866104.51-11364253366998/service
<52.16.161.67> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/home/vagrant/.ansible/cp/ansible-ssh-%h-%p-%r" -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=ubuntu -o ConnectTimeout=10 52.16.161.67 /bin/sh -c 'sudo -k && sudo -H -S -p "[sudo via ansible, key=pkjcazbngchlcujcryxpjhqvysuogqdq] password: " -u root /bin/sh -c '"'"'echo BECOME-SUCCESS-pkjcazbngchlcujcryxpjhqvysuogqdq; LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python /home/ubuntu/.ansible/tmp/ansible-tmp-1433866104.51-159732570027917/service; rm -rf /home/ubuntu/.ansible/tmp/ansible-tmp-1433866104.51-159732570027917/ >/dev/null 2>&1'"'"''
<54.154.82.195> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/home/vagrant/.ansible/cp/ansible-ssh-%h-%p-%r" -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=ubuntu -o ConnectTimeout=10 54.154.82.195 /bin/sh -c 'sudo -k && sudo -H -S -p "[sudo via ansible, key=kmaknhfrafsrngyemkpxdkifpezqbtui] password: " -u root /bin/sh -c '"'"'echo BECOME-SUCCESS-kmaknhfrafsrngyemkpxdkifpezqbtui; LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python /home/ubuntu/.ansible/tmp/ansible-tmp-1433866104.51-11364253366998/service; rm -rf /home/ubuntu/.ansible/tmp/ansible-tmp-1433866104.51-11364253366998/ >/dev/null 2>&1'"'"''
failed: [54.154.82.195] => {"failed": true}
failed: [52.16.161.67] => {"failed": true}
答案1
这似乎是与 Ansible 版本 1.9.1 相关的一个错误
https://github.com/ansible/ansible-modules-core/issues/1170
使用建议的补丁进行修补,一切正常。