Issue 1:
On a solaris 10 target with ansible 1.9.3 using template or copy with become fails with fatal: [rpm-zone3] => ssh connection closed waiting for a privilege escalation password prompt

Full log from the failed section:

TASK: [web | Create CAM pasword file for agent install] ***********************
<rpm-zone3> ESTABLISH CONNECTION FOR USER: gillingh
<rpm-zone3> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/Users/gillingh/.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 rpm-zone3 /bin/sh -c 'sudo -k && sudo -H -S -p "[sudo via ansible, key=rcvzjadfoojvpwltuosfnxkbfmoztdvp] password: " -u app-srv /bin/sh -c '"'"'echo BECOME-SUCCESS-rcvzjadfoojvpwltuosfnxkbfmoztdvp; rc=flag; [ -r /tmp/cam_agent_password ] || rc=2; [ -f /tmp/cam_agent_password ] || rc=1; [ -d /tmp/cam_agent_password ] && rc=3; /tps/bin/python -V 2>/dev/null || rc=4; [ x"$rc" != "xflag" ] && echo "${rc} "/tmp/cam_agent_password && exit 0; (/tps/bin/python -c '"'"'"'"'"'"'"'"'import hashlib; BLOCKSIZE = 65536; hasher = hashlib.sha1(); afile = open("'"'"'"'"'"'"'"'"'/tmp/cam_agent_password'"'"'"'"'"'"'"'"'", "rb") buf = afile.read(BLOCKSIZE) while len(buf) > 0: hasher.update(buf) buf = afile.read(BLOCKSIZE) afile.close() print(hasher.hexdigest())'"'"'"'"'"'"'"'"' 2>/dev/null) || (/tps/bin/python -c '"'"'"'"'"'"'"'"'import sha; BLOCKSIZE = 65536; hasher = sha.sha(); afile = open("'"'"'"'"'"'"'"'"'/tmp/cam_agent_password'"'"'"'"'"'"'"'"'", "rb") buf = afile.read(BLOCKSIZE) while len(buf) > 0: hasher.update(buf) buf = afile.read(BLOCKSIZE) afile.close() print(hasher.hexdigest())'"'"'"'"'"'"'"'"' 2>/dev/null) || (echo '"'"'"'"'"'"'"'"'0 '"'"'"'"'"'"'"'"'/tmp/cam_agent_password)'"'"''

A sample copy task is:

- name: Create CAM pasword file for agent install
become: yes
become_user: app-srv
when: agent_list.stdout.find('No configured agents') != -1
copy: content="{{ CAM_agent_password }}" dest=/tmp/cam_agent_password
mode=0600 owner=app-srv group=app-adm
register: cam_password_file

The odd thing is, this seems to be specific to the template and copy modules, I use become in the same set of tasks with no issues prior with the command, lineinfile, and user modules.

Issue 2:
Issue Type: Bug Report

Ansible Version: 1.9.0.1

Environment:

Both Cent OS 6 for source machine and target machine

Summary:

The template module fails(err: ssh connection closed waiting for password prompt) at creating files that require sudo permission with password.

Steps To Reproduce:

- name: create some init script
template: src=tmpl.j2 dest=/etc/init.d/{{ item }}
with_items: [1,2,3]
sudo: yes

with the command: ansible-playbook -i inventory xxx.yml --ask-become-pass

Expected Results:

Login as a normal user, sudo as a root user and create the init script under /etc/init.d.

Actually Results:

ssh connection closed waiting for password prompt

However, I have tried other modules, for instance, file module, it's working fine with same setup.

For your information, I have turned off the pipelining.

Looking forward to your reply! Thanks.