I change hosts, but still error connect.
[test]
192.168.1.120
[vars]
ansible_user=sandy
ansible_sudo_pass=‘xxxxxxxx’
ansible 2.9.6
config file = /etc/ansible/ansible.cfg
configured module search path = [u’/home/sandy/.ansible/plugins/modules’, u’/usr/share/ansible/plugins/modules’]
ansible python module location = /usr/lib/python2.7/dist-packages/ansible
executable location = /usr/bin/ansible
python version = 2.7.17 (default, Nov 7 2019, 10:07:09) [GCC 7.4.0]
Using /etc/ansible/ansible.cfg as config file
host_list declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
[WARNING]: * Failed to parse /etc/ansible/hosts with script plugin: problem
running /etc/ansible/hosts --list ([Errno 8] Exec format error)
File “/usr/lib/python2.7/dist-packages/ansible/inventory/manager.py”, line 280, in parse_source
plugin.parse(self._inventory, self._loader, source, cache=cache)
File “/usr/lib/python2.7/dist-packages/ansible/plugins/inventory/script.py”, line 161, in parse
raise AnsibleParserError(to_native(e))
[WARNING]: * Failed to parse /etc/ansible/hosts with yaml plugin: Syntax Error
while loading YAML. did not find expected The error appears
to be in ‘/etc/ansible/hosts’: line 48, column 1, but may be elsewhere in the
file depending on the exact syntax problem. The offending line appears to be:
[test] 192.168.1.120 ^ here
File “/usr/lib/python2.7/dist-packages/ansible/inventory/manager.py”, line 280, in parse_source
plugin.parse(self._inventory, self._loader, source, cache=cache)
File “/usr/lib/python2.7/dist-packages/ansible/plugins/inventory/yaml.py”, line 105, in parse
raise AnsibleParserError(e)
[WARNING]: * Failed to parse /etc/ansible/hosts with ini plugin:
/etc/ansible/hosts:69: Expected key=value host variable assignment, got:
ansible
File “/usr/lib/python2.7/dist-packages/ansible/inventory/manager.py”, line 280, in parse_source
plugin.parse(self._inventory, self._loader, source, cache=cache)
File “/usr/lib/python2.7/dist-packages/ansible/plugins/inventory/ini.py”, line 138, in parse
raise AnsibleParserError(e)
[WARNING]: Unable to parse /etc/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’
BR
Sandy