I am struggling with proper YAML formatting. I have my Ansible playbook:
---
- hosts: all
become: yes
gather_facts: true
tasks:
- dnf: name=chrony state=present
- service: name=chronyd state=started enabled=yes
and have run yamllint on it
3:11 warning truthy value should be one of [false, true] (truthy)
6:3 error wrong indentation: expected at least 3 (indentation)
7:52 error no new line character at the end of file (new-line-at-end-of-file)
What does truthy value mean?
Regarding your initial question and description, because of an syntax error and the incorrect indention. It should be
---
- hosts: all
become: true
gather_facts: true
tasks:
- name: Ensure chrony (for time synchronization) is installed.
yum:
name: chrony
state: present
- name: Ensure chrony is running
service:
...
It will also resolve the message about
3:11 warning truthy value should be one of [false, true] (truthy)
as become: yes
is changed to become: true
.
For the answer to the "why" you may have a look into specifying the string value 'yes' in a YAML property.