YAML
- Is a data definition/expression format.
- The data which we define is name & value pairs
- YAML File Extension => .yaml or .yml extension
- Refer Here for the official docs
- Structure of ansible playbook
---
- name: <describe your playbook here>
tasks:
- name: <what this task is about>
<module>:
<module-parameter-1>: <module-value-1>
..
<module-parameter-n>: <module-value-n>
state: <value (present)>
- name: <what this task is about>
<module>:
<module-parameter-1>: <module-value-1>
..
<module-parameter-n>: <module-value-n>
state: <value (present)>
---
- name: install apache server
become: yes
hosts: all
tasks:
- name: install apache2 and update packages
apt:
name: apache2
state: present
- name: restart apache2
service:
name: apache2
state: restarted
Like this:
Like Loading...