2017-09-27 6 views
0

hosts.iniYAML在庫解析エラー

[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.yamlを実行し、私は期待出力に含まを得たansible local -m ping -i hosts.iniを実行します。

[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 

docsによると、私は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] 

更新issueは、問題は、Python 3に再現可能であり、バグのように見える

+0

'127.0.0.1:'の最後に ':'を付ける必要がありますか? –

+0

@JimWrightはいhttp://docs.ansible.com/ansible/latest/intro_inventory.html –

答えて

1

をオープンしました。

Python 3ではなくPython 2を使用します。後者はnot officially supported yetです。

+0

悲しいようですが、「AnabilitiesはPythonバージョン3.5以上をサポートしています」と表示されます。あなたのリンクに従うと私はPython 3.6.2を持っています –

+2

しかし、それは文脈から任意の文字列を取ってそれが本当であると主張するようではありません。記事は「Python 3のテクニカルプレビュー*」というプレゼンテーションで明確に始まります。プレビュー内では3.5が含まれています – techraf

1

Python 3の2.4.0のバグがあります(文字列のリストに.ymlバイトを見つけようとしています)。

このバグはこのコミットで修正されましたhttps://github.com/ansible/ansible/commit/72bdf7aa7e1b867380201092dff65338d59cd8fa、それは2.4.1としてリリースされる可能性があります。

+0

GitHubで問題を提出したのと同じ人に返信していることに気付いていますか? – techraf

+1

はい、 https://github.com/ansible/ansible/issues/30977#issuecomment-333460412に問題があることを文書化しましたので、ここにいる人やgithubに誰もが何が起こっているのか、いつリリースされるのかを理解することができます。 –