-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Open
Description
Vagrant version
Vagrant 2.0.3
Host operating system
Ubuntu 16.04 LTS
Guest operating system
CentOS 7
Vagrantfile
Extract from my vagrant file.
config.vm.provision 'ansible' do |ansible|
ansible.playbook = 'common.yml'
ansible.verbose = true
ansible.inventory_path = 'inventories/dev/hosts.yml'
end
endThe Vagrantfile and the inventory file have been validated such that the static inventory matches the hosts defined in the vagrantfile
Debug output
Did not past full debug to gist. The relevant debug output is as follows (seen by invoking ansible.verbose = true
<myhostname>.vagrant.test: Running ansible-playbook...
PYTHONUNBUFFERED=1 ANSIBLE_FORCE_COLOR=true ANSIBLE_HOST_KEY_CHECKING=false ANSIBLE_SSH_ARGS='-o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes -o IdentityFile=/home/<myuser>/<some path with a space>/ansible/.vagrant/machines/<myhostname>.vagrant.test/libvirt/private_key -o ControlMaster=auto -o ControlPersist=60s' ansible-playbook --connection=ssh --timeout=30 --extra-vars=ansible_user\=\'vagrant\' --limit="<myhostname>.vagrant.test" --inventory-file=inventories/dev/hosts.yml -v common.yml
Using /home/<myuser>/<some path with a space>/ansible/ansible.cfg as config file
PLAY [Common] ******************************************************************
TASK [Gathering Facts] *********************************************************
fatal: [<myhostname>.vagrant.test]: UNREACHABLE! => {"changed": false, "msg": "Failed to connect to the host via ssh: ssh: Could not resolve hostname <part of directory name with a space>/ansible/.vagrant/machines/<myhostname>.vagrant.test/libvirt/private_key: Name or service not known\r\n", "unreachable": true}
Expected behavior
What should have happened?
SSH private key paths provided to ANSIBLE_SSH_ARGS are quoted to avoid issues with spaces
Actual behavior
What actually happened?
ANSIBLE_SSH_ARGS causes the play to break with {"changed": false, "msg": "Failed to connect to the host via ssh: ssh: Could not resolve hostname due to not quoting -o IdentityFile=<private key path with space>.
Steps to reproduce
- Run the ansible provisioner from an ansible project and Vagrant file that has a space in the parent path.
- Use
ansible.verbose = trueas a provisioner option to observe how-o IdentityFile=value was not safely quoted.
References
Related, but not identical
adamaveray and brlin-tw