Learning YAML and JSON
Refer Here for YAML
Refer Here for JSON quick reference
YAML is a data serialization language which means you can represent data in the format of YAML.
Each name value pair in YAML is represented as <name>: <value>
If we think of any data the values are
singular or simple:
you can represent text
you can represent numbers
you can represent booleans (True, False, yes, no)
Simple Text notations
name: Quality Thought
name: 'Quality Thought'
name: "Quality Thought"
Multi line text notations
about-us: |
This institute was started by
Ramana
about-us: >
This institute was started by
Ramana
age: 10
is_online: yes
is_online: true
plural or list: can be represented with significant whitespace or in the form of [] . Each item in normal notation starts with – (list item)
Example with standard notation
courses:
- DevOps
- Azure
- AWS
- Linux
- Python
- Agile
courses: ["DevOps", "Azure", "AWS", "Linux", "Python", "Agile"]
complex or object: An object has multiple name & value pairs
address:
blockno: 208-B
building: Nilgiri Block
area: Ameerpet
landmark: Ameerpet Metro
city: Hyderabad
The whole yaml is generally created with .yml or .yaml extensions
Lets create a simple file qt.yml
name: QualityThought
courses:
- DevOps
- Azure
- AWS
- Linux
- Python
- Agile
address:
blockno: 208-B
building: Nilgiri Block
area: Ameerpet
landmark: Ameerpet Metro
city: Hyderabad
pincode: 560017
In one file we can write multiple YAML if we separate with —
---
name: QT
courses:
- AWS
- AZURE
- DevOps
---
name: LT
courses:
- BTech
- MTech
- Competitive exams
Lets create a yaml file for some DevOps tools
---
title: Tools used in DevOps
tools:
- name: Ansible
purpose: ["CM", "Networking Automation", "Deployments"]
- name: Chef
purpose:
- CM
- name: Git
purpose:
- Version Control Systems
- name: Maven
purpose:
- Build Java Based Code
- name: MSBuild
purpose:
- Build .net code
- name: Jenkins
purpose:
- CI/CD Engine
Ansible Installations
Initially we will install Ansible on Ubuntu 18 server
For documentation refer here
In this series i will be using AWS instance . To know how to create aws ec2 Watch Here
If you want to create azure vm watch Here
Since we are installing on ubuntu Refer Here
Commands to install Ansible on ubuntu
sudo apt update
sudo apt install software-properties-common -y
sudo apt-add-repository --yes --update ppa:ansible/ansible
sudo apt install ansible -y
Basic Ansible installation representation
Now lets create one node which is also ubuntu 18 and install python 2.7 in this node
sudo apt update
sudo apt install software-properties-common -y
sudo apt-add-repository --yes --update ppa:ansible/ansible
sudo apt install python -y
Now we need to configure the inventory in ansible control node and establish credentials for ansible control node to log into the node and execute ansible tasks
Like this: Like Loading...