保存临时 ansible shell 脚本而不是删除

Save temporary ansible shell scripts instead of deleting

我注意到 Ansible 删除了使用分号分隔 bash 命令的临时脚本。

这是一个示例命令:

EXEC ssh -C -tt -v -o ControlMaster=auto -o ControlPersist=60s -o 
ControlPath="/Users/devuser/.ansible/cp/ansible-ssh-%h-%p-%r" -o
KbdInteractiveAuthentication=no -o
PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey
-o PasswordAuthentication=no -o ConnectTimeout=10 build /bin/sh -c
'LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python
/home/ec2-user/.ansible/tmp/ansible-tmp-1430847489.81-75617096172775/docker;
rm -rf
/home/ec2-user/.ansible/tmp/ansible-tmp-1430847489.81-75617096172775/
>/dev/null 2>&1'

当运行 ansible-playbook时,有没有办法告诉ansible用双&符号替换分号或告诉它保存脚本或输出内容?

我正在尝试调试此脚本中的错误,现在唯一出现的是:

failed: [build] => {"changed": false, "failed": true}
msg: ConnectionError(ProtocolError('Connection aborted.', error(2, 'No such file or directory')),)

我找到了环境变量-

export ANSIBLE_KEEP_REMOTE_FILES=1

设置这个,然后重新运行 ansible-playbook,然后ssh和cd到~/.ansible/tmp/找到文件。