Failed to load inventory plugin, skipping yml

1,417 views
Skip to first unread message

Suneel Hegde

unread,
May 10, 2021, 11:45:58 AM5/10/21
to Ansible Project
Hello Team,

I am trying to do ansible all --list-hosts -vvvvvvv and try to ping the hosts but getting this error could you please help me to solve this problem?

suneelkumar@LT Ansible % ansible all --list-hosts -vvvvvvv
ansible 2.10.4
  config file = /Users/suneelkumar/Documents/Automation/Ansible/ansible.cfg
  configured module search path = ['/Users/suneelkumar/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /Library/Python/3.8/site-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 3.8.2 (default, Apr  8 2021, 23:19:18) [Clang 12.0.5 (clang-1205.0.22.9)]
Using /Users/suneelkumar/Documents/Automation/Ansible/ansible.cfg as config file
setting up inventory plugins
[WARNING]: Failed to load inventory plugin, skipping yml
host_list declined parsing /Users/suneelkumar/Documents/Automation/Ansible/hosts  #/Users/suneelkumar/Documents/Automation/Ansible/hosts.yaml as it did not pass its verify_file() method
Skipping due to inventory source not existing or not being readable by the current user
script declined parsing /Users/suneelkumar/Documents/Automation/Ansible/hosts  #/Users/suneelkumar/Documents/Automation/Ansible/hosts.yaml as it did not pass its verify_file() method
Skipping due to inventory source not existing or not being readable by the current user
auto declined parsing /Users/suneelkumar/Documents/Automation/Ansible/hosts  #/Users/suneelkumar/Documents/Automation/Ansible/hosts.yaml as it did not pass its verify_file() method
Skipping due to inventory source not existing or not being readable by the current user
yaml declined parsing /Users/suneelkumar/Documents/Automation/Ansible/hosts  #/Users/suneelkumar/Documents/Automation/Ansible/hosts.yaml as it did not pass its verify_file() method
Skipping due to inventory source not existing or not being readable by the current user
ini declined parsing /Users/suneelkumar/Documents/Automation/Ansible/hosts  #/Users/suneelkumar/Documents/Automation/Ansible/hosts.yaml as it did not pass its verify_file() method
Skipping due to inventory source not existing or not being readable by the current user
toml declined parsing /Users/suneelkumar/Documents/Automation/Ansible/hosts  #/Users/suneelkumar/Documents/Automation/Ansible/hosts.yaml as it did not pass its verify_file() method
advanced_host_list declined parsing /Users/suneelkumar/Documents/Automation/Ansible/hosts  #/Users/suneelkumar/Documents/Automation/Ansible/hosts.yaml as it did not pass its verify_file() method
Skipping due to inventory source not existing or not being readable by the current user
constructed declined parsing /Users/suneelkumar/Documents/Automation/Ansible/hosts  #/Users/suneelkumar/Documents/Automation/Ansible/hosts.yaml as it did not pass its verify_file() method
Skipping due to inventory source not existing or not being readable by the current user
yaml declined parsing /Users/suneelkumar/Documents/Automation/Ansible/hosts  #/Users/suneelkumar/Documents/Automation/Ansible/hosts.yaml as it did not pass its verify_file() method
[WARNING]: Unable to parse /Users/suneelkumar/Documents/Automation/Ansible/hosts  #/Users/suneelkumar/Documents/Automation/Ansible/hosts.yaml as an inventory source
[WARNING]: No inventory was parsed, only implicit localhost is available
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'
  hosts (0):
suneelkumar@LT Ansible %

suneelkumar@LT Ansible % ansible all -m ping
[WARNING]: Failed to load inventory plugin, skipping yml
[WARNING]: Unable to parse /Users/suneelkumar/Documents/Automation/Ansible/hosts  #/Users/suneelkumar/Documents/Automation/Ansible/hosts.yaml as an inventory source
[WARNING]: No inventory was parsed, only implicit localhost is available
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'
suneelkumar@LT Ansible %

I am running  ansible 2.10.4

Thank you !

regards,

Suneel

Matt Martz

unread,
May 10, 2021, 11:51:10 AM5/10/21
to ansible...@googlegroups.com
Your inventory seems to be configured literally as:

/Users/suneelkumar/Documents/Automation/Ansible/hosts  #/Users/suneelkumar/Documents/Automation/Ansible/hosts.yaml

Note that the # and everything after is still included as part of the path, where I assume you meant it to be a comment.

Move the comment to its own line, and I would assume that it should start working for you.

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CANuO0k7VyZXVTYSJ_iC3Bw4DTnzMDBm0mxKAUJkkWGk_z86Y0Q%40mail.gmail.com.


--
Matt Martz
@sivel
sivel.net

Suneel Hegde

unread,
May 10, 2021, 12:02:26 PM5/10/21
to Ansible Project
I tried that, but its still not working giving this error

suneelkumar@LT- Ansible % ansible all --list-hosts -vvvvvvv

ansible 2.10.4
  config file = /Users/suneelkumar/Documents/Automation/Ansible/ansible.cfg
  configured module search path = ['/Users/suneelkumar/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /Library/Python/3.8/site-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 3.8.2 (default, Apr  8 2021, 23:19:18) [Clang 12.0.5 (clang-1205.0.22.9)]
Using /Users/suneelkumar/Documents/Automation/Ansible/ansible.cfg as config file
setting up inventory plugins
host_list declined parsing /Users/suneelkumar/Documents/Automation/Ansible/hosts as it did not pass its verify_file() method
auto declined parsing /Users/suneelkumar/Documents/Automation/Ansible/hosts as it did not pass its verify_file() method
toml declined parsing /Users/suneelkumar/Documents/Automation/Ansible/hosts as it did not pass its verify_file() method
[WARNING]:  * Failed to parse /Users/suneelkumar/Documents/Automation/Ansible/hosts with script plugin: problem running /Users/suneelkumar/Documents/Automation/Ansible/hosts
--list ([Errno 8] Exec format error: '/Users/suneelkumar/Documents/Automation/Ansible/hosts')
  File "/Library/Python/3.8/site-packages/ansible/inventory/manager.py", line 289, in parse_source
    plugin.parse(self._inventory, self._loader, source, cache=cache)
  File "/Library/Python/3.8/site-packages/ansible/plugins/inventory/script.py", line 169, in parse
    raise AnsibleParserError(to_native(e))
[WARNING]:  * Failed to parse /Users/suneelkumar/Documents/Automation/Ansible/hosts with yaml plugin: We were unable to read either as JSON nor YAML, these are the errors we got
from each: JSON: Expecting value: line 1 column 2 (char 1)  Syntax Error while loading YAML.   expected '<document start>', but found '['  The error appears to be in
'/Users/suneelkumar/Documents/Automation/Ansible/hosts': line 3, column 1, but may be elsewhere in the file depending on the exact syntax problem.  The offending line appears to
be:   [ios:vars] ^ here
  File "/Library/Python/3.8/site-packages/ansible/inventory/manager.py", line 289, in parse_source
    plugin.parse(self._inventory, self._loader, source, cache=cache)
  File "/Library/Python/3.8/site-packages/ansible/plugins/inventory/yaml.py", line 105, in parse
    raise AnsibleParserError(e)
[WARNING]:  * Failed to parse /Users/suneelkumar/Documents/Automation/Ansible/hosts with ini plugin: /Users/suneelkumar/Documents/Automation/Ansible/hosts:10: Expected
key=value, got: ansible_connection: ansible.netcommon.network_cli
  File "/Library/Python/3.8/site-packages/ansible/inventory/manager.py", line 289, in parse_source
    plugin.parse(self._inventory, self._loader, source, cache=cache)
  File "/Library/Python/3.8/site-packages/ansible/plugins/inventory/ini.py", line 138, in parse
    raise AnsibleParserError(e)
[WARNING]: Unable to parse /Users/suneelkumar/Documents/Automation/Ansible/hosts as an inventory source

[WARNING]: No inventory was parsed, only implicit localhost is available
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'
  hosts (0):
suneelkumar@LT- Ansible %

Komal Suthar

unread,
May 11, 2021, 12:09:00 AM5/11/21
to ansible...@googlegroups.com
Have you created the inventory file and also give the location of the inventory file in the ansible configuration file and also im ansible in think there are only 4 v's verbosity and we cant use this -vvvv with this inventory we can use this while we run a playbook. 

Suneel Hegde

unread,
May 11, 2021, 7:46:52 AM5/11/21
to Ansible Project
There was a mistake in the host file insted of using = i used :
that is the reason it was giving the error
thank you everyone for your response

Reply all
Reply to author
Forward
0 new messages