Hello,
I’m hooking up Ansible and a Vagrant VM running Ubuntu 14.04 LTS. To do this, I have the following inventory file:
default
ansible_ssh_host=“127.0.0.1”
ansible_ssh_port=“2202”
ansible_ssh_user=“vagrant”
ansible_ssh_private_key_file=“.vagrant/machines/default/virtualbox/private_key”
The path to the private key is relative to the directory the inventory file is in, and the private key exists. The other values - host, port and user - were populated based on the output of vagrant ssh-config
after the Vagrant VM had booted:
✗ vagrant ssh-config
Host default
HostName 127.0.0.1
User vagrant
Port 2202
UserKnownHostsFile /dev/null
StrictHostKeyChecking no
PasswordAuthentication no
IdentityFile /projects/ansible/.vagrant/machines/default/virtualbox/private_key
IdentitiesOnly yes
LogLevel FATAL
Given this, I think I should be able to run ansible default -i hosts -m ping, and have a successful response from the ping module. Unfortunately, I get a lovely stack trace back:
✗ ansible default -i hosts -m ping
Traceback (most recent call last):
File “/usr/local/Cellar/ansible/1.9.4/libexec/bin/ansible”, line 197, in
(runner, results) = cli.run(options, args)
File “/usr/local/Cellar/ansible/1.9.4/libexec/bin/ansible”, line 121, in run
inventory_manager = inventory.Inventory(options.inventory, vault_password=vault_pass)
File “/usr/local/Cellar/ansible/1.9.4/libexec/lib/python2.7/site-packages/ansible/inventory/init.py”, line 128, in init
self.parser = InventoryParser(filename=host_list)
File “/usr/local/Cellar/ansible/1.9.4/libexec/lib/python2.7/site-packages/ansible/inventory/ini.py”, line 43, in init
self._parse()
File “/usr/local/Cellar/ansible/1.9.4/libexec/lib/python2.7/site-packages/ansible/inventory/ini.py”, line 47, in _parse
self._parse_base_groups()
File “/usr/local/Cellar/ansible/1.9.4/libexec/lib/python2.7/site-packages/ansible/inventory/ini.py”, line 108, in _parse_base_groups
tokens = shlex.split(line)
File “/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shlex.py”, line 279, in split
return list(lex)
File “/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shlex.py”, line 269, in next
token = self.get_token()
File “/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shlex.py”, line 96, in get_token
raw = self.read_token()
File “/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shlex.py”, line 191, in read_token
raise ValueError, “No escaped character”
ValueError: No escaped character
I’ve had a quick look about to see what might be causing the ValueError, but I can’t see much at fault. There must be something, though!
Running Ansible 1.9.4 and Python 2.7.10 on Yosemite.
Thanks in advance for any ideas,
Andrew