HOW TO IN Yaml
Install vscode
Use the online version of vscode
https://vscode.dev/
Bingo, you now have vscode
Set vscode to yaml
Click where the arrow is pointing another window will open
Set vscode to yaml
Enter the language you would like vscode to be set
Set vscode to yaml
Enter the language you would like vscode to be set and select it when it appear
Set vscode to yaml
Check below to make sure your language has been set, it should appear where the arrow is pointing
You will be setting your vscode with the same technique when we will be using the following:
1- Bash script
2- Dockerfile
3- docker-compose
4- jenkinsfile
5- json
6- Kubernetes manifest
Then if you need write any code in just ask
What is yaml ?
YAML is a human-readable data serialization standard that can be used in conjunction with all programming languages and is often used to write configuration files.
Overview
The recursive YAML acronym stands for “YAML Ain’t Markup Language,” denoting it as flexible and data-oriented.
Where are we going use yaml �in this training
Sample yaml file
Quick Reminder
IMPORTANT CONCEPT IN YAML
IMPORTANT CONCEPT IN YAML�List
All members of a list are lines beginning at the same indentation level starting with a "- " (a dash and a space):
IMPORTANT CONCEPT IN YAML�Dictionary
A dictionary is represented in a simple key: value form (the colon must be followed by a space):
What is important about yaml:��Indentation�
In YAML block styles, structure is determined by indentation. In general, indentation is defined as a zero or more space characters at the start of a line.
In simple English Indentation are spaces represented by green arrows on the pictures
Identation
Let us pay attention to couple of de details
the string Company is located to the far left and everything is under it. This means that Company is the parent and anything under it are his children.
But as we can see under company we have strings that also have strings under them it means they are parents as well
But let us not lose track
Name
location
Services
Are all located under Company but, if we pay close attention we will find out that they are all line up at the same level
What does it means that they are all at the same level it means that they have same importance under Company
It is just like you children they all have the same importance in front of you
Identation
So Name, location and Service are at the same level therefore have the same importance
But location have couple of stuff under it and they are all line up at the same level
It means that they belong to location only and NOT name and service
They same apply to service as we can see.
Identation.
Who can Explain this to me ?
NO WORRY, see in class
Father
and
Child
Concept
devops: money
Father
child
Single child father
devops:
- money
Father
child
devops:
- money
Father
child
Single child father
devops: money job company security
Father
children
multiple children father
devops:
- money
- job
- company
- security
Father
children
devops: money job company security
devops:
- money
- job
- company
- security
use this form when you have multiple children because 99.99% of DevOps engineers use it
instead of this form when you have multiple children
because this form is not really use out there
WHAT HAPPEN WHEN A FATHER BECOME GRANDFATHER ?
GrandFather
Child
GrandSon
Concept
devops:
money:
- job
GrandFather
Son
GrandChild
devops is the parent of money and money is the parent of job
all are defined under devops because devops is the HEAD of the family
devops:
- money:
- job
Hey I know you are like it should be of this form below because if money is the child of devops therefore it should also have an - on him
NO NO NO you are very WRONG
devops:
- money:
- job
In YAML when a child gave birth and become a father he cannot be used as a list no more meaning we will not place and - in front of you no more
come on you are a father already and deserve some respect loooooool
devops:
money:
- job
GrandFather
Children
with each of them having
Children
Concept
head of family
henry children
pay attention how david,Marleine and obama have the same alignment why because the have the same father and their other of birth here does not matter what matter is the same parent they share together
david children
Marleine children
obama children