Reputation: 5056
Im trying to run the simplest Ansible script ever. But I cant as I am having the below error :
---
- hosts: all
tasks:
- name: Create single user
user: name="matias" password="secret" shell="/bin/bash"
Error :
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match
'all'
ERROR! unexpected parameter type in action: <class 'ansible.parsing.yaml.objects.AnsibleSequence'>
The error appears to be in 'matias/tasks/main.yml': line 3, column 3, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
# Example playbook that shows how to create users from the generated ansible variable file
- hosts: all
^ here
My command :
ansible-playbook mainplaybook.yml
What am I doing wrong here?
Upvotes: 0
Views: 46
Reputation: 13
I guess you didn't mention any hostnames on /etc/ansible/hosts directory. You can save your hosts in /etc/ansible/hosts. Ansible looks there as a default location.
Upvotes: 1