Ansible Contd
Writing Playbooks
- Refer Here for official docs of Ansible Playbook
- Playbook defines the configuration management expressed in desired state using YAML
- Ansible Playbook organization

- In Ansible the smallest unit of execution is done by modules
First Playbook: Install tree
sudo apt install tree -y
- Search for module for each step
apt => ansible.builtin.apt

- Refer Here for the playbook and executed plabook

Exercise
- List out what are the areas which you need to fill in your resume
name
phone number
email
professional summary
skillset
work experience
education
- We have list out names/keys then we need fill values
name = text
phone number = text
email text
professional summar text
skillset
<skill name>: <skill values>
work experience:
experience list:
company name
duration
role and responsibilities: text array/list
YAML
- It is collection of name value or key value pair used to represent data.
- Generally it is stored in files with extension
.yml or .yaml
<name>: <value>
- Values can be of different types
- Simple
- text: can be represented in single or double quotes
tool: ansible
- number: numbers in non quote format
age: 10
- boolean: true, false, yes, no
online: yes
- Complex
- list: array
colors:
– black
– white
- object/dictionary:
address:
flatno: 601
building: nilgiri
area: Ameerpet
city: Hyderabad
- Refer Here for YAML documentation from ansible
- Try to come up with a YAML format to describe your home town
- What does
--- in yaml signify
Like this:
Like Loading...