在剧本中,我使用sudo复制文件 . 它曾经工作......直到我们迁移到Ansible 1.9 ...从那时起,它失败并出现以下错误消息:
“ssh连接关闭等待sudo密码提示”
我提供了ssh和sudo密码(通过Ansible提示符),并且通过sudo运行的所有其他命令都成功(只有文件副本和模板失败) .
我的命令是:
ansible-playbook -k --ask-become-pass --limit = testhost -C -D playbooks / debug.yml
而playbookd包含:
- hosts: designsync
gather_facts: yes
tasks:
- name: Make sure the syncmgr home folder exists
action: file path=/home/syncmgr owner=syncmgr group=syncmgr mode=0755 state=directory
sudo: yes
sudo_user: syncmgr
- name: Copy .cshrc file
action: copy src=roles/designsync/files/syncmgr.cshrc dest=/home/syncmgr/.cshrc owner=syncmgr group=syncmgr mode=0755
sudo: yes
sudo_user: syncmgr
这是一个错误还是我错过了什么?
弗朗索瓦 .
2 回答
你的剧本应该是这样的:
根据您使用的Ansible的确切版本,sudo_user可能存在错误(我自己体验过) .
尝试将您的剧本从“sudo_user”更改为“remote_user” .