Issue 1:
This does not work (note the usage of localhost two times; I am running Vagrant (ssh port 2222) and within the vagrant box I am running a Docker container (ssh port 29007); this container has not been started yet ):

[hostvessels]
localhost ansible_ssh_user=core ansible_ssh_port=2222 ansible_ssh_private_key_file=/home/thijsterlouw/.vagrant.d/insecure_private_key

[containers]
localhost ansible_ssh_user=root ansible_ssh_port=29007 ansible_ssh_pass=password

error:

TASK: [ensure container path for docker.sh] ***********************************
fatal: [localhost] => Authentication failure.

But this does work (note I renamed the first host):

[hostvessels]
coreos.vagrant ansible_ssh_user=core ansible_ssh_port=2222 ansible_ssh_private_key_file=/home/thijsterlouw/.vagrant.d/insecure_private_key

[containers]
localhost ansible_ssh_user=root ansible_ssh_port=29007 ansible_ssh_pass=password

Where coreos.vagrant is mapped in /etc/hosts to 127.0.0.1

I am running this with

ansible-playbook -i generated/servers.ini static/site.yml --tags="predeploy,deploy"

The container inside the Vagrant box is not yet running, but this should be ignored because I am only performing tasks that hit the hostvessels.

Why does Ansible think the host is down, even though the appropriate ssh port is perfectly available. Looks like a bug to me.

ansible --version
ansible 1.4

Issue 2:
This is duplicate of #5934!

Issue Type:

Bug Report

Ansible Version:

1.9.4

Ansible Configuration:

Original.

Environment:

OS X Yosemite 10.10.5 (14F1021)

Summary:

inventory

[vagrant]
192.168.56.132 ansible_ssh_user=vagrant ansible_ssh_private_key_file=.vagrant/machines/default/virtualbox/private_key

provision.yml

- hosts: all
gather_facts: yes
sudo: yes

tasks:
- synchronize:
src: ./
dest: "/var/lib/jenkins"
archive: no
recursive: yes
sudo: yes

Steps To Reproduce:

ansible-playbook -vvvv provision.yml -i inventory --limit=vagrant

Expected Results:

synchronize should not ask for a password, as other tasks do.

Actual Results:

<127.0.0.1> EXEC ['/bin/sh', '-c', 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1447416965.06-222404616716035 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1447416965.06-222404616716035 && echo $HOME/.ansible/tmp/ansible-tmp-1447416965.06-222404616716035']
<127.0.0.1> PUT /var/folders/72/r_f79s2974q5b59cq0f7c1wh0000gn/T/tmpTRff6u TO /Users/BR0kEN/.ansible/tmp/ansible-tmp-1447416965.06-222404616716035/synchronize
<127.0.0.1> EXEC ['/bin/sh', '-c', u'LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python /Users/BR0kEN/.ansible/tmp/ansible-tmp-1447416965.06-222404616716035/synchronize; rm -rf /Users/BR0kEN/.ansible/tmp/ansible-tmp-1447416965.06-222404616716035/ >/dev/null 2>&1']
vagrant@192.168.56.132's password:

Debugging steps:

I've go to ansible/modules/core/files/synchronize.py and put print(cmdstr) before (rc, out, err) = module.run_command(cmd). Module generated the next command:

rsync --delay-updates -F --compress --recursive --rsh 'ssh -i .vagrant/machines/default/virtualbox/private_key -S none -o StrictHostKeyChecking=no' --rsync-path="sudo rsync" --out-format='<<CHANGED>>%i %n%L' "/Users/BR0kEN/cibox/aae/provisioning/roles/cibox-jenkins/files/" "vagrant@192.168.56.132:/var/lib/jenkins"

And even more:

Open the ansible/runner/__init__.py and put print(cmd) before res = self._low_level_exec_command(conn, cmd, tmp, become=self.become, sudoable=sudoable, in_data=in_data). Module generated something like:

LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python /Users/BR0kEN/.ansible/tmp/ansible-tmp-1447418694.04-11945943198607/synchronize; rm -rf /Users/BR0kEN/.ansible/tmp/ansible-tmp-1447418694.04-11945943198607/ >/dev/null 2>&1

When I execute one of these raw commands, then everything fine.