YAML for DevOps  part-3

YAML for DevOps part-3

On the 19th day, I learned the following things about YAML.

Write a sequence

---
student: !!seq
- mark
- name
- roll_no
...        

Empty sequence will be called sparse sequence

---
sparse seq:
- how
- where
- 
- Null
- sup
...        

Write a nested sequence

---
-
- mango
- orange
- apple
- 
- car
- truck
- bus
...        

Key value pairs are called maps

!!map        

Write nested mappings: map within a map

---
name: sahil bhoyar
roles:
age: 22
job: software engineer
...        

same like this

---
name: sahil bhoyar
roles: {age: 22, job: software engineer}
...        

Write pairs which means that one key may have multiple values

!!pairs        

Example

---
pair example: !!pairs
- job: student
- job: teacher
...        

Set will allow you to have unique values

---
names: !!set
? sahil
? sanket
? sarves
...        

Write a dictionary that will represent sequence as a value

!!omap        

Example

---
people:
- sahil:
    name:sahil 
    age: 25
    role: software engineer
- sanket:
    name: sanket
    age: 19
    role: data scientist
...        

Re-use some properties using anchors

likings: &fruitsChoice
like: mango
dislike: banana

person1:
name: sahil
<<: *fruitsChoice

person2:
name: sanket
<<: *fruitsChoice

person3:
name: sarvesh
<<: *fruitsChoice        

Result

person1:
name: sahil
like: mango
dislike: banana        

If you want to override some data. The data will be replaced with a new one

person1:
name: sahil
like: mango
<<: *fruitsChoice
dislike: orange        

Example of multiple nested sequence

Schools:
- name: gcoe
    principal: Someone
    students:
    - roll_no: 12
        name: some person
        marks: 5        


so thats all about my today's learning

Happy learning : )


Fedir Kompaniiets

CEO & Co-Founder of Gart Solutions | Cloud Solutions Architect & Digital Transformation Consultant

1 年

Great effort on the #60daysofdevops challenge! Can't wait to read your article on YAML for DevOps. ??

回复

要查看或添加评论,请登录

Sahil Bhoyar的更多文章

  • Helm for DevOps part-2

    Helm for DevOps part-2

    On the 59th day, I learned the following things about Helm. Helm Commands will interact with charts or YAML files…

    1 条评论
  • Helm for DevOps

    Helm for DevOps

    On the 58th day, I learned the following things about Helm. Helm Before discussing helm, let's understand the common…

    2 条评论
  • EC2 Instance part-4

    EC2 Instance part-4

    On the 57th day, I learned the following things about Cloud Computing. AWS Demo Go to AWS and create an account.

  • EC2 instance part-3

    EC2 instance part-3

    On the 56th day, I learned the following things about Cloud Computing. 5.

    2 条评论
  • AWS EC2 Instance part-2

    AWS EC2 Instance part-2

    On the 55th day, I learned the following things about Cloud Computing. 3.

  • EC2 Instance

    EC2 Instance

    On the 54th day, I learned the following things about Cloud Computing. Elastic Compute Cloud Amazon EC2 or virtual…

    1 条评论
  • Cloud for DevOps

    Cloud for DevOps

    On the 53rd day, I learned the following things about Cloud Computing. Cloud Computing Cloud computing is an on-demand…

    1 条评论
  • Nagios installation

    Nagios installation

    On the 52th day, I learned the following things about Continuous Monitoring. Installation of Nagios Step 1 To start…

  • Nagios for DevOps

    Nagios for DevOps

    On the 51th day, I learned the following things about Continuous Monitoring. Continuous Monitoring Tool Monitoring is…

  • Jenkins for DevOps part-4

    Jenkins for DevOps part-4

    On the 50th day, I learned the following things about CI/CD Pipeline. Build after another project is build (jenkins…

    1 条评论

社区洞察

其他会员也浏览了