ansible意外异常没有转义字符

时间:2015-08-04 18:46:41

标签: python ansible

我对Ansible和配置管理工具一般都是新手。在过去的两天里,我一直在玩它,对于我的生活,我无法过去输入ansible testserver。它返回一条错误消息,显示意外异常:没有转义字符。完整的错误消息是:

mac-dgarcia:playbooks dgarcia$ ansible testserver -i hosts -m ping -vvv
Using /Users/dgarcia/Documents/Playbooks/ansible.cfg as config file
Unexpected Exception: No escaped character
the full traceback was:

Traceback (most recent call last):
  File "/Users/dgarcia/Documents/Playbooks/ansible/bin/ansible", line 79, in <module>
    sys.exit(cli.run())
  File "/Users/dgarcia/Documents/Playbooks/ansible/lib/ansible/cli/adhoc.py", line 106, in run
    inventory = Inventory(loader=loader, variable_manager=variable_manager, host_list=self.options.inventory)
  File "/Users/dgarcia/Documents/Playbooks/ansible/lib/ansible/inventory/__init__.py", line 135, in __init__
    self.parser = InventoryParser(filename=host_list)
  File "/Users/dgarcia/Documents/Playbooks/ansible/lib/ansible/inventory/ini.py", line 45, in __init__
    self._parse()
  File "/Users/dgarcia/Documents/Playbooks/ansible/lib/ansible/inventory/ini.py", line 49, in _parse
    self._parse_base_groups()
  File "/Users/dgarcia/Documents/Playbooks/ansible/lib/ansible/inventory/ini.py", line 107, in _parse_base_groups
    tokens = shlex.split(line)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shlex.py", line 279, in split
    return list(lex)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shlex.py", line 269, in next
    token = self.get_token()
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shlex.py", line 96, in get_token
    raw = self.read_token()
  File "/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

我已经在谷歌的任何地方进行了搜索,并且一无所获。有什么想法吗?

1 个答案:

答案 0 :(得分:6)

我遇到了同样的问题并且更改了我的主机文件,只有一行修复了问题。

我的主机文件如下所示: testserver ansible_ssh_host = 128.0.0.1 ansible_ssh_port = 2222 \ ansible_ssh_user = vagrant \ ansible_ssh_private_key_file = /家庭/ bibryam /桌面/ .vagrant /设备/织物/ virtualbox的/ PRIVATE_KEY