Reputation: 1
I keep getting errors on the user: (play) in the playbook. Ansible seeems to be complaining about the colon, but nothing I try works.
- hosts: all
become: root
tasks:
-name: add user Natasha
user:
- name: natasha
- comment:"Natasha Ping"
- uid: 1027
- group: ping
-name: add user John
user:
- name: john
- comment:"John Pong"
- uid: 1028
- group: ping
The expected result is that user natasha and john will be created on the hosts intended.
Upvotes: 0
Views: 262
Reputation: 1628
Your YAML syntax has errors, pretty simple to fix. YAML is strict about spacing and the separators as Matthew noted.
This is your corrected syntax:
---
- hosts: all
become: root
tasks:
- name: add user Natasha
user:
name: natasha
comment: "Natasha Ping"
uid: 1027
group: ping
- name: add user John
user:
name: john
comment: "John Pong"
uid: 1028
group: ping
I'd also recommend using ansible-lint. It will help you spot errors and follow best practices.
Upvotes: 2