YAML(YAML Ain't Markup Language) Baiscs

YAML Ain't Markup Language is a data serialization language that matches user’s expectations about data. It designed to be human friendl...

YAML Ain't Markup Language is a data serialization language that matches user’s expectations about data. It designed to be human friendly and works perfectly with other programming languages. It is useful to manage data and includes Unicode printable characters. This chapter will give you an introduction to YAML and gives you an idea about its features

Now that you have an idea about YAML and its features, let us learn its basics with syntax and other operations. Remember that YAML includes a human readable structured format.

Rules for Creating YAML file

When you are creating a file in YAML, you should remember the following basic rules −

  • YAML is case sensitive

  • The files should have .yaml or .yml as the extension

  • YAML allows spaces for indentation.

Basic Components of YAML File

The basic components of YAML are described below −

Conventional Block Format

This block format uses hyphen+space to begin a new item in a specified list. Observe the example shown below −

--- # Favorite movies
 - Sholye
 - Sahid

Inline Format

Inline format is delimited with comma and space and the items are enclosed in JSON. Observe the example shown below −

--- # Shopping list
   [mobile,laptop,HDMI Cable,Router]

Folded Text

Folded text converts newlines to spaces and removes the leading whitespace. Observe the example shown below −

- {name: Raman Sharma, age: 40}
- name: Manoj
  age: 27

The structure which follows all the basic conventions of YAML is shown below −

men: [Raman, Manoj]
  - Mary 
  - Susan 

Synopsis of YAML Basic Elements

  • The synopsis of YAML basic elements is given here: Comments in YAML begins with the (#) character.

  • Comments must be separated from other tokens by whitespaces.

  • Indentation of whitespace is used to denote structure.

  • Tabs are not included as indentation for YAML files.

  • List members are denoted by a leading hyphen (-).

  • List members are enclosed in square brackets and separated by commas.

  • Associative arrays are represented using colon ( : ) in the format of key value pair. They are enclosed in curly braces {}.

  • Multiple documents with single streams are separated with 3 hyphens (---).

  • Repeated nodes in each file are initially denoted by an ampersand (&) and by an asterisk (*) mark later.

  • YAML always requires colons and commas used as list separators followed by space with scalar values.

  • Nodes should be labelled with an exclamation mark (!) or double exclamation mark (!!), followed by string which can be expanded into an URI or URL.




Ansible,6,AWS,1,Azure DevOps,1,Containerization with docker,2,DevOps,2,Docker Quiz,1,Docker Swarm,1,DockerCompose,1,ELK,2,git,2,Jira,1,Kubernetes,1,Kubernetes Quiz,5,SAST DAST Security Testing,1,SonarQube,3,Splunk,2,vagrant kubernetes,1,YAML Basics,1,
DevOpsWorld: YAML(YAML Ain't Markup Language) Baiscs
YAML(YAML Ain't Markup Language) Baiscs
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS PREMIUM CONTENT IS LOCKED STEP 1: Share to a social network STEP 2: Click the link on your social network Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy Table of Content