Just saw a rather quirky error that took a bit of trial and error to get rid of. Just in case anyone Googles it:
This is caused by comments with leading whitespace in the /usr/local/etc/ansible/hosts inventory file. This is new behavior for this Ansible version!
So if you're in the habit of writing something like this in that hosts file:
Change it into:
or
Code:
ERROR! Attempted to read "/usr/local/etc/ansible/hosts" as YAML: Syntax Error while loading YAML.
The error appears to have been in '/usr/local/etc/ansible/hosts': line 15, column 5, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
[all:vars]
^ here
Attempted to read "/usr/local/etc/ansible/hosts" as ini file: list index out of range
So if you're in the habit of writing something like this in that hosts file:
Code:
[web]
# legacy servers
webserver-[1:2].company.com
Code:
[web]
# legacy servers
webserver-[1:2].company.com
Code:
[web]
webserver-[1:2].company.com # legacy servers