1 of 37

HOW TO IN Yaml

2 of 37

  • Install vscode

3 of 37

Install vscode

  • open the following link https://code.visualstudio.com/ and download vscode.
  • 2- install vscode (the package to download is available on your download directory)

4 of 37

Use the online version of vscode

  • 1- open the following url

https://vscode.dev/

5 of 37

Bingo, you now have vscode

6 of 37

Set vscode to yaml

Click where the arrow is pointing another window will open

7 of 37

Set vscode to yaml

Enter the language you would like vscode to be set

8 of 37

Set vscode to yaml

Enter the language you would like vscode to be set and select it when it appear

9 of 37

Set vscode to yaml

Check below to make sure your language has been set, it should appear where the arrow is pointing

10 of 37

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

11 of 37

12 of 37

Then if you need write any code in just ask

13 of 37

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.

14 of 37

Where are we going use yaml �in this training

  • Docker-compose
  • Kubernetes manifest
  • Helm Chart
  • Ansible
  • Gitlab

15 of 37

Sample yaml file

16 of 37

Quick Reminder

17 of 37

IMPORTANT CONCEPT IN YAML

18 of 37

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):

19 of 37

IMPORTANT CONCEPT IN YAML�Dictionary

A dictionary is represented in a simple key: value form (the colon must be followed by a space):

20 of 37

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

21 of 37

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

22 of 37

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.

23 of 37

Identation.

Who can Explain this to me ?

NO WORRY, see in class

24 of 37

Father

and

Child

Concept

25 of 37

26 of 37

devops: money

Father

child

Single child father

devops:

- money

Father

child

27 of 37

devops:

- money

Father

child

Single child father

28 of 37

devops: money job company security

Father

children

multiple children father

devops:

- money

- job

- company

- security

Father

children

29 of 37

30 of 37

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

31 of 37

WHAT HAPPEN WHEN A FATHER BECOME GRANDFATHER ?

32 of 37

GrandFather

Child

GrandSon

Concept

33 of 37

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

34 of 37

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

35 of 37

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

36 of 37

GrandFather

Children

with each of them having

Children

Concept

37 of 37

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