<h5 dir="auto">Issue Type:</h5>
<p dir="auto">Bug Report</p>
<h5 dir="auto">Ansible Version:</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="~ # ansible-playbook --version
ansible-playbook 2.0.0.2
  config file =
  configured module search path = Default w/o overrides
~ # ansible --version
ansible 2.0.0.2
  config file =
  configured module search path = Default w/o overrides"><pre class="notranslate"><code class="notranslate">~ # ansible-playbook --version
ansible-playbook 2.0.0.2
  config file =
  configured module search path = Default w/o overrides
~ # ansible --version
ansible 2.0.0.2
  config file =
  configured module search path = Default w/o overrides
</code></pre></div>
<h5 dir="auto">Ansible Configuration:</h5>
<p dir="auto">ansible.cfg</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="[defaults]
hostfile = ./hosts
nocows = 1
ansible_managed = Ansible managed, do not edit directly: {file} by {uid} on {host}

[ssh_connection]
ssh_args = -o ControlMaster=auto -o ControlPersist=30m -o ForwardAgent=yes
pipelining=True
"><pre class="notranslate"><code class="notranslate">[defaults]
hostfile = ./hosts
nocows = 1
ansible_managed = Ansible managed, do not edit directly: {file} by {uid} on {host}

[ssh_connection]
ssh_args = -o ControlMaster=auto -o ControlPersist=30m -o ForwardAgent=yes
pipelining=True

</code></pre></div>
<h5 dir="auto">Environment:</h5>
<p dir="auto">Ubuntu 12.04.5 LTS<br>
Ubuntu 12.04.5 LTS</p>
<h5 dir="auto">Summary:</h5>
<p dir="auto">Database copy script that has been running pre ansible 2.0 has started failing.</p>
<h5 dir="auto">Steps To Reproduce:</h5>
<p dir="auto">Upgrade to ansible 2.0. Difference is that ansible 2.0 isn't picking up the ansible.cfg file that's in the same directory as the playbook and so uses default options for ssh. Don't know why the defaults for ssh fail but the fix is the cd into the directory first. Pre ansible 2.0 looked for config in the current play directory.</p>
<h5 dir="auto">Expected Results:</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="# su copy_database -c '/usr/local/bin/ansible-playbook -f 1 /mnt/ssd/django/pitchup_prod/ansible/playbooks/pitchup/copy_database.yaml -i /
mnt/ssd/django/pitchup_prod/ansible/playbooks/pitchup/inventory/dev -vvvv'
Using /mnt/ssd/django/pitchup_prod/ansible/playbooks/pitchup/ansible.cfg as config file
[DEPRECATION WARNING]: Instead of sudo/sudo_user, use become/become_user and make sure become_method is 'sudo' (default). This feature will be removed in a future
release. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.
Loaded callback default of type stdout, v2.0
1 plays in /mnt/ssd/django/pitchup_prod/ansible/playbooks/pitchup/copy_database.yaml

PLAY [copy database] ***********************************************************


TASK [setup] *******************************************************************
&lt;devpitchup.pitchup.com&gt; ESTABLISH SSH CONNECTION FOR USER: None
&lt;devpitchup.pitchup.com&gt; SSH: EXEC ssh -C -vvv -o ControlMaster=auto -o ControlPersist=30m -o ForwardAgent=yes -o KbdInteractiveAuthentication=no -o PreferredAuthentica
tions=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/copy_database/.ansible/cp/ansible-ssh-%h-%
p-%r devpitchup.pitchup.com '/bin/sh -c '&quot;'&quot;'sudo -H -S -n -u root /bin/sh -c '&quot;'&quot;'&quot;'&quot;'&quot;'&quot;'&quot;'&quot;'echo BECOME-SUCCESS-fgoaqjgnoouwszjfrcebkeazxrevfxfg; LANG=en_GB.UTF-8 LC
_ALL=en_GB.UTF-8 LC_MESSAGES=en_GB.UTF-8 /usr/bin/python'&quot;'&quot;'&quot;'&quot;'&quot;'&quot;'&quot;'&quot;''&quot;'&quot;''
ok: [devpitchup.pitchup.com]

..."><pre class="notranslate"><code class="notranslate"># su copy_database -c '/usr/local/bin/ansible-playbook -f 1 /mnt/ssd/django/pitchup_prod/ansible/playbooks/pitchup/copy_database.yaml -i /
mnt/ssd/django/pitchup_prod/ansible/playbooks/pitchup/inventory/dev -vvvv'
Using /mnt/ssd/django/pitchup_prod/ansible/playbooks/pitchup/ansible.cfg as config file
[DEPRECATION WARNING]: Instead of sudo/sudo_user, use become/become_user and make sure become_method is 'sudo' (default). This feature will be removed in a future
release. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.
Loaded callback default of type stdout, v2.0
1 plays in /mnt/ssd/django/pitchup_prod/ansible/playbooks/pitchup/copy_database.yaml

PLAY [copy database] ***********************************************************


TASK [setup] *******************************************************************
&lt;devpitchup.pitchup.com&gt; ESTABLISH SSH CONNECTION FOR USER: None
&lt;devpitchup.pitchup.com&gt; SSH: EXEC ssh -C -vvv -o ControlMaster=auto -o ControlPersist=30m -o ForwardAgent=yes -o KbdInteractiveAuthentication=no -o PreferredAuthentica
tions=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/copy_database/.ansible/cp/ansible-ssh-%h-%
p-%r devpitchup.pitchup.com '/bin/sh -c '"'"'sudo -H -S -n -u root /bin/sh -c '"'"'"'"'"'"'"'"'echo BECOME-SUCCESS-fgoaqjgnoouwszjfrcebkeazxrevfxfg; LANG=en_GB.UTF-8 LC
_ALL=en_GB.UTF-8 LC_MESSAGES=en_GB.UTF-8 /usr/bin/python'"'"'"'"'"'"'"'"''"'"''
ok: [devpitchup.pitchup.com]

...
</code></pre></div>
<h5 dir="auto">Actual Results:</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="~ # su copy_database -c '/usr/local/bin/ansible-playbook -f 1 /mnt/ssd/django/pitchup_prod/ansible/playbooks/pitchup/copy_database.yaml -i /mnt/ssd/django/pitchup_prod/
ansible/playbooks/pitchup/inventory/dev -vvvv'
No config file found; using defaults
[DEPRECATION WARNING]: Instead of sudo/sudo_user, use become/become_user and make sure become_method is 'sudo' (default). This feature will be removed in a future
release. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.
Loaded callback default of type stdout, v2.0
1 plays in /mnt/ssd/django/pitchup_prod/ansible/playbooks/pitchup/copy_database.yaml

PLAY [copy database] ***********************************************************

TASK [setup] *******************************************************************
&lt;devpitchup.pitchup.com&gt; ESTABLISH SSH CONNECTION FOR USER: None
&lt;devpitchup.pitchup.com&gt; SSH: EXEC ssh -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mi
c,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/copy_database/.ansible/cp/ansible-ssh-%h-%p-%r -tt devpitchup.
pitchup.com '( umask 22 &amp;&amp; mkdir -p &quot;$( echo $HOME/.ansible/tmp/ansible-tmp-1453287563.5-209169123401042 )&quot; &amp;&amp; echo &quot;$( echo $HOME/.ansible/tmp/ansible-tmp-1453287563.5
-209169123401042 )&quot; )'
&lt;devpitchup.pitchup.com&gt; PUT /tmp/tmprYQf0w TO       ^/setup
&lt;devpitchup.pitchup.com&gt; SSH: EXEC sftp -b - -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-w
ith-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/copy_database/.ansible/cp/ansible-ssh-%h-%p-%r '[devpitc
hup.pitchup.com]'
fatal: [devpitchup.pitchup.com]: FAILED! =&gt; {&quot;failed&quot;: true, &quot;msg&quot;: &quot;ERROR! failed to transfer file to       ^/setup:\nsftp&gt; put /tmp/tmprYQf0w '      ^/setup'\nUploadi
ng /tmp/tmprYQf0w to /home/copy_database/      ^/setup\n\nOpenSSH_5.9p1 Debian-5ubuntu1.7, OpenSSL 1.0.1 14 Mar 2012\ndebug1: Reading configuration data /etc/ssh/ssh_co
nfig\r\ndebug1: /etc/ssh/ssh_config line 19: Applying options for *\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client
_hello_exchange: master version 4\r\ndebug3: mux_client_request_forwards: requesting forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\nd
ebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 25855\r\ndebug3: mux_client_request_session: session request sent\r\ndebug1: m
ux_client_request_session: master session id: 2\r\ndebug2: Remote version: 3\r\ndebug2: Server supports extension \&quot;posix-rename@openssh.com\&quot; revision 1\r\ndebug2: Ser
ver supports extension \&quot;statvfs@openssh.com\&quot; revision 2\r\ndebug2: Server supports extension \&quot;fstatvfs@openssh.com\&quot; revision 2\r\ndebug2: Server supports extension
\&quot;hardlink@openssh.com\&quot; revision 1\r\ndebug3: Sent message fd 3 T:16 I:32698\r\ndebug3: SSH_FXP_REALPATH . -&gt; /home/copy_database\r\ndebug3: Looking up /tmp/tmprYQf0w\
r\ndebug3: Sent message fd 3 T:17 I:32699\r\ndebug3: Received stat reply T:101 I:32699\r\ndebug1: Couldn't stat remote file: No such file or directory\r\ndebug3: Sent m
essage SSH2_FXP_OPEN I:32700 P:/home/copy_database/      ^/setup\r\nremote open(\&quot;/home/copy_database/      ^/setup\&quot;): No such file or directory\r\ndebug3: mux_client_
read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 0\r\n&quot;}

NO MORE HOSTS LEFT *************************************************************

PLAY RECAP *********************************************************************
devpitchup.pitchup.com     : ok=0    changed=0    unreachable=0    failed=1"><pre class="notranslate"><code class="notranslate">~ # su copy_database -c '/usr/local/bin/ansible-playbook -f 1 /mnt/ssd/django/pitchup_prod/ansible/playbooks/pitchup/copy_database.yaml -i /mnt/ssd/django/pitchup_prod/
ansible/playbooks/pitchup/inventory/dev -vvvv'
No config file found; using defaults
[DEPRECATION WARNING]: Instead of sudo/sudo_user, use become/become_user and make sure become_method is 'sudo' (default). This feature will be removed in a future
release. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.
Loaded callback default of type stdout, v2.0
1 plays in /mnt/ssd/django/pitchup_prod/ansible/playbooks/pitchup/copy_database.yaml

PLAY [copy database] ***********************************************************

TASK [setup] *******************************************************************
&lt;devpitchup.pitchup.com&gt; ESTABLISH SSH CONNECTION FOR USER: None
&lt;devpitchup.pitchup.com&gt; SSH: EXEC ssh -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mi
c,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/copy_database/.ansible/cp/ansible-ssh-%h-%p-%r -tt devpitchup.
pitchup.com '( umask 22 &amp;&amp; mkdir -p "$( echo $HOME/.ansible/tmp/ansible-tmp-1453287563.5-209169123401042 )" &amp;&amp; echo "$( echo $HOME/.ansible/tmp/ansible-tmp-1453287563.5
-209169123401042 )" )'
&lt;devpitchup.pitchup.com&gt; PUT /tmp/tmprYQf0w TO       ^/setup
&lt;devpitchup.pitchup.com&gt; SSH: EXEC sftp -b - -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-w
ith-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/copy_database/.ansible/cp/ansible-ssh-%h-%p-%r '[devpitc
hup.pitchup.com]'
fatal: [devpitchup.pitchup.com]: FAILED! =&gt; {"failed": true, "msg": "ERROR! failed to transfer file to       ^/setup:\nsftp&gt; put /tmp/tmprYQf0w '      ^/setup'\nUploadi
ng /tmp/tmprYQf0w to /home/copy_database/      ^/setup\n\nOpenSSH_5.9p1 Debian-5ubuntu1.7, OpenSSL 1.0.1 14 Mar 2012\ndebug1: Reading configuration data /etc/ssh/ssh_co
nfig\r\ndebug1: /etc/ssh/ssh_config line 19: Applying options for *\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client
_hello_exchange: master version 4\r\ndebug3: mux_client_request_forwards: requesting forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\nd
ebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 25855\r\ndebug3: mux_client_request_session: session request sent\r\ndebug1: m
ux_client_request_session: master session id: 2\r\ndebug2: Remote version: 3\r\ndebug2: Server supports extension \"posix-rename@openssh.com\" revision 1\r\ndebug2: Ser
ver supports extension \"statvfs@openssh.com\" revision 2\r\ndebug2: Server supports extension \"fstatvfs@openssh.com\" revision 2\r\ndebug2: Server supports extension
\"hardlink@openssh.com\" revision 1\r\ndebug3: Sent message fd 3 T:16 I:32698\r\ndebug3: SSH_FXP_REALPATH . -&gt; /home/copy_database\r\ndebug3: Looking up /tmp/tmprYQf0w\
r\ndebug3: Sent message fd 3 T:17 I:32699\r\ndebug3: Received stat reply T:101 I:32699\r\ndebug1: Couldn't stat remote file: No such file or directory\r\ndebug3: Sent m
essage SSH2_FXP_OPEN I:32700 P:/home/copy_database/      ^/setup\r\nremote open(\"/home/copy_database/      ^/setup\"): No such file or directory\r\ndebug3: mux_client_
read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 0\r\n"}

NO MORE HOSTS LEFT *************************************************************

PLAY RECAP *********************************************************************
devpitchup.pitchup.com     : ok=0    changed=0    unreachable=0    failed=1
</code></pre></div>
<p dir="auto">There's a bug with the apt-python module on older versions of debian when you try to update the cache.</p>
<p dir="auto">I've got what I think is a good patch to fix it.</p>