ansible意外的异常:词典更新序列元素#0

当我运行以下命令ansible意外的异常:词典更新序列元素#0

[[email protected]] $ ansible localhost -vvv -m setup 

Using /etc/ansible/ansible.cfg as config file

它提供了以下错误

ERROR! Unexpected Exception: dictionary update sequence element #0 has length 1; 2 is required 

the full traceback was:

Traceback (most recent call last):

File "/usr/bin/ansible", line 92, in <module>

exit_code = cli.run()

File "/usr/lib/python2.6/site-packages/ansible/cli/adhoc.py", line 129, in run

inventory = Inventory(loader=loader, variable_manager=variable_manager, host_list=self.options.inventory)

File "/usr/lib/python2.6/site-packages/ansible/inventory/__init__.py", line 92, in __init__

self.parse_inventory(host_list)

File "/usr/lib/python2.6/site-packages/ansible/inventory/__init__.py", line 159, in parse_inventory

group.vars = combine_vars(group.vars, self.get_group_variables(group.name))

File "/usr/lib/python2.6/site-packages/ansible/inventory/__init__.py", line 527, in get_group_variables

self._vars_per_group[groupname] = self._get_group_variables(groupname, vault_password=vault_password)

File "/usr/lib/python2.6/site-packages/ansible/inventory/__init__.py", line 545, in _get_group_variables

vars = combine_vars(vars, self.get_group_vars(group))

File "/usr/lib/python2.6/site-packages/ansible/inventory/__init__.py", line 727, in get_group_vars

return self._get_hostgroup_vars(host=None, group=group, new_pb_basedir=new_pb_basedir, return_results=return_results)

File "/usr/lib/python2.6/site-packages/ansible/inventory/__init__.py", line 788, in _get_hostgroup_vars

host_results = self._variable_manager.add_group_vars_file(base_path, self._loader)

File "/usr/lib/python2.6/site-packages/ansible/vars/__init__.py", line 616, in add_group_vars_file

data = self._load_inventory_file(path, loader)

File "/usr/lib/python2.6/site-packages/ansible/vars/__init__.py", line 574, in _load_inventory_file

rval.update(data)

ValueError: dictionary update sequence element #0 has length 1; 2 is required

回答:

看起来你正在使用ansible < 2.3击中issues #18843:您的group_vars文件中有一个语法错误。

尝试升级到较新版本的ansible,错误应该会显示更多有关语法错误的信息。

以上是 ansible意外的异常:词典更新序列元素#0 的全部内容, 来源链接: utcz.com/qa/261531.html

回到顶部