Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/335.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby-on-rails-4/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python YAML清单分析错误_Python_Ansible_Python 3.6_Ansible 2.x_Ansible Inventory - Fatal编程技术网

Python YAML清单分析错误

Python YAML清单分析错误,python,ansible,python-3.6,ansible-2.x,ansible-inventory,Python,Ansible,Python 3.6,Ansible 2.x,Ansible Inventory,hosts.ini [local] 127.0.0.1 ansible_connection=local hosts.yaml local: hosts: 127.0.0.1: vars: ansible_connection: local 然后我运行ansible local-m ping-I hosts.ini我得到了预期的输出,然后我运行ansible local-m ping-I hosts.yaml我得到: [WARNING]: * Failed to p

hosts.ini

[local]
127.0.0.1 ansible_connection=local
hosts.yaml

local:
  hosts:
    127.0.0.1:
  vars:
    ansible_connection: local
然后我运行
ansible local-m ping-I hosts.ini
我得到了预期的输出,然后我运行
ansible local-m ping-I hosts.yaml
我得到:

[WARNING]:  * Failed to parse /home/elruso/projects/ansible/hosts.yaml with ini plugin: /home/elruso/projects/ansible/hosts.yaml:5: Expected key=value host variable assignment, got: local
[WARNING]: Unable to parse /home/elruso/projects/ansible/hosts.yaml as an inventory source
[WARNING]: No inventory was parsed, only implicit localhost is available
[WARNING]: Could not match supplied host pattern, ignoring: local
[WARNING]: No hosts matched, nothing to do
据我所知,我可以使用yaml文件作为库存没有问题。如何指定使用yml插件

$ansible --version
ansible 2.4.0.0
config file = /home/elruso/projects/ansible/ansible.cfg
configured module search path = ['/home/elruso/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /home/elruso/.virtualenvs/ansible/lib/python3.6/site-packages/ansible
executable location = /home/elruso/.virtualenvs/ansible/bin/ansible
python version = 3.6.2 (default, Jul 20 2017, 08:43:29) [GCC 5.4.1 20170519]

更新:打开

该问题在Python 3中重复出现,看起来像一个bug


使用Python2而不是Python3,后者就是。

这个问题在Python3中重复出现,看起来像一个bug


使用Python2而不是Python3,后者就是。

Python3上的ansible 2.4.0中有一个错误(试图在字符串列表中查找
.yml
字节)


此错误已在此提交中修复,可能会作为2.4.1发布。

python 3上的ansible 2.4.0中有一个错误(尝试在字符串列表中查找
.yml
字节)


此错误已在此提交中修复,可能会以2.4.1的形式发布。

删除清单文件并在ansible控制器上重新创建它为我修复了它。

删除清单文件并在ansible控制器上重新创建它为我修复了它。

看起来很糟糕,但我看到“ansible仅支持Python版本3.5及以上。”根据您的链接,我有Python3.6.2,但您不能从上下文中去掉任何字符串并声称它是真的。这篇文章以一句话开头:“Python 3技术预览支持*。预览中只包含>3.5。看起来像是真的,但我看到“Ansible只支持Python 3.5及以上版本”。“根据您的链接,我有Python3.6.2,但您不能从上下文中去掉任何字符串并声称它是真的。这篇文章以一句话开头“Python 3支持技术预览*。预览中仅包含>3.5。是否应
127.0.0.1:
在结尾处包含
?@JimWright是应
127.0.0.1:
在结尾处包含
?@JimWright是,但您知道您正在回复在GitHub上提交问题的同一个人?是,但别担心,我也在这个问题上做了记录:所以任何登陆这里或github的人都可以了解发生了什么以及预计何时发布。但是你知道你回复的是在github上提交问题的同一个人吗?是的,但别担心,我也在这个问题上记录了它:所以任何登陆这里或github的人都可以理解正在发生的事情以及它预计何时发布。