Testing a basic Ansible roles setup but got an error on the first line of a role main.yml
, I am sure it's something silly though
play.yml
- hosts: myhosts
remote_user: myuser
roles:
- test
Directory structure
play.yml
roles/test/tasks/main.yml
main.yml
- hosts: all
user: myuser
gather_facts: no
tasks:
- name: ping all hosts
ping:
When I run ansible-playbook play.yml
, I get the error
The offending line appears to be:
- hosts: all
^ here
It looks like a simple YAML parse error but if I run ansible-playbook main.yml
, it works fine, so not sure what's going on. Any thoughts?