# on 18-Jan-2019 (Fri)

#### Flashcard 3760849816844

Question
In YAML, all files conventionally begin with a single line containing this syntax: [...]

---

^ three dashes

status measured difficulty not learned 37% [default] 0
YAML Syntax — Ansible Documentation
we need to know how to write lists and dictionaries in YAML. There’s another small quirk to YAML. All YAML files (regardless of their association with Ansible or not) can optionally begin with <span>--- and end with .... This is part of the YAML format and indicates the start and end of a document. All members of a list are lines beginning at the same indentation level starting with a

#### Flashcard 3760854273292

Question
In YAML, the primary building blocks/elements/data structures are lists and [...]

dictionaries (aka key/value pairs)

^^ for example, name: kevin

status measured difficulty not learned 37% [default] 0
YAML Syntax — Ansible Documentation
le key: value form (the colon must be followed by a space): # An employee record martin: name: Martin D'vloper job: Developer skill: Elite More complicated data structures are possible, such as <span>lists of dictionaries, dictionaries whose values are lists or a mix of both: # Employee records - martin: name: Martin D'vloper job: Developer skills: - python - perl - pascal - tabitha: name: Tabitha Bitume

#### Flashcard 3760857943308

Question
In YAML, the primary building blocks/elements/data structures are [...] and dictionaries (aka: key/value pairs)
lists

status measured difficulty not learned 37% [default] 0
YAML Syntax — Ansible Documentation
pace): # An employee record martin: name: Martin D'vloper job: Developer skill: Elite More complicated data structures are possible, such as lists of dictionaries, dictionaries whose values are <span>lists or a mix of both: # Employee records - martin: name: Martin D'vloper job: Developer skills: - python - perl - pascal - tabitha: name: Tabitha Bitumen job: Developer skills: - lisp - for

#### Flashcard 3760861613324

Question
In YAML, write a simple representation of an employee referenced as "kevin" (i.e. the key is "kevin"), who has these three attributes: name=kevin khosravi, job=developer, level=senior.
kevin:
name: kevin khosravi
job: developer
level: senior

^^ Note the use of the colon-space (or colon-newline) syntax to seperate the keys from the corresponding values

^^ Note the use of indentation to indicated that the "kevin" employee object/dictionary has three key/value pairs inside it (name, job, and level)

status measured difficulty not learned 37% [default] 0
YAML Syntax — Ansible Documentation
me indentation level starting with a "- " (a dash and a space): --- # A list of tasty fruits fruits: - Apple - Orange - Strawberry - Mango ... A dictionary is represented in a simple key: value <span>form (the colon must be followed by a space): # An employee record martin: name: Martin D'vloper job: Developer skill: Elite More complicated data structures are possible, such as lists of d

#### Flashcard 3760865283340

Question
In YAML, for lists, all items in the list are at the same indentation and start with the following syntax: [...]

"- "

^^^ NOTE the space after the dash.

Here is named list example:

fruits:
- apple
- pear
- orange

Here is an unamed list example (from Ansible, where you have list of plays in a playbook):

---
# This playbook deploys the whole application stack in this site.

- name: apply common configuration to all nodes
hosts: all
remote_user: root

roles:
- common

- name: configure and deploy the webservers and application code
hosts: webservers
remote_user: root

roles:
- web

- name: deploy MySQL and configure the databases
hosts: dbservers
remote_user: root

roles:
- db

status measured difficulty not learned 37% [default] 0
YAML Syntax — Ansible Documentation
l YAML files (regardless of their association with Ansible or not) can optionally begin with --- and end with .... This is part of the YAML format and indicates the start and end of a document. <span>All members of a list are lines beginning at the same indentation level starting with a "- " (a dash and a space): --- # A list of tasty fruits fruits: - Apple - Orange - Strawberry - Mango ... A dictionary is represented in a simple key: value form (the colon must be followed

#### Flashcard 3760870264076

Question
In YAML, all items in a list start with the "- " (dash then space) syntax and are at the same [...]
indentation

status measured difficulty not learned 37% [default] 0
YAML Syntax — Ansible Documentation
pace): # An employee record martin: name: Martin D'vloper job: Developer skill: Elite More complicated data structures are possible, such as lists of dictionaries, dictionaries whose values are <span>lists or a mix of both: # Employee records - martin: name: Martin D'vloper job: Developer skills: - python - perl - pascal - tabitha: name: Tabitha Bitumen job: Developer skills: - lisp - for

#### Flashcard 3760873934092

Question
In YAML, lists can either have a [...] or not.

key/name

^^ for example, you can have a list named "fruit" with values, or you can have a list of items but no key for the list, such as plays in an ansible playbook

status measured difficulty not learned 37% [default] 0

#### Flashcard 3760876555532

Question
In YAML, define a list called "fruits" with the following items: pear, apple, orange
fruits:
- pear
- apple
- orange

^^ note that each item in the list starts with the "- " (dash followed by space) syntax

^^ note that each item in the list is at the same indentation level

status measured difficulty not learned 37% [default] 0

#### Flashcard 3760879176972

Question
In YAML, boolean values (which are not often used) can be all spellings of true and false (e.g. True, TRUE, false), as well as: [...] / [...]
yes/no

status measured difficulty not learned 37% [default] 0
YAML Syntax — Ansible Documentation
oper, job: Developer, skill: Elite} fruits: ['Apple', 'Orange', 'Strawberry', 'Mango'] These are called “Flow collections”. Ansible doesn’t really use these too much, but you can also specify a <span>boolean value (true/false) in several forms: create_key: yes needs_agent: no knows_oop: True likes_emacs: TRUE uses_cvs: false Values can span multiple lines using | or >. Spanning multiple lines

#### Flashcard 3760882846988

Question

In YAML, the following syntax is used if you want to have multi line values and preseve the newlines (and trailing spaces at end of lines)

include_newlines: [...]
exactly as you see
will appear these three
lines of poetry

include_newlines: |
exactly as you see
will appear these three
lines of poetry

^^ note the "|" syntax, such that the value of include_newlines is exactly:

exactly as you see
will appear these three
lines of poetry

status measured difficulty not learned 37% [default] 0
YAML Syntax — Ansible Documentation
lock Scalar” > will fold newlines to spaces; it’s used to make what would otherwise be a very long line easier to read and edit. In either case the indentation will be ignored. Examples are: <span>include_newlines: | exactly as you see will appear these three lines of poetry fold_newlines: > this is really a single line of text despite appearances While in the above > example all newlines are folded into spaces, there are two ways to enforce a newline

#### Flashcard 3760886517004

Question

In YAML, the following syntax is used if you want to have a very long value spread written across multiple lines, but you don't want to keep the newlines:

fold_newlines: [...]
this is really a
single line of text
despite appearances

fold_newlines: >
this is really a
single line of text
despite appearances

^^ Note the use of the ">" syntax, so the value of fold_newlines will be exactly:

this is really a single line of text despite appearances

status measured difficulty not learned 37% [default] 0
YAML Syntax — Ansible Documentation
herwise be a very long line easier to read and edit. In either case the indentation will be ignored. Examples are: include_newlines: | exactly as you see will appear these three lines of poetry <span>fold_newlines: > this is really a single line of text despite appearances While in the above > example all newlines are folded into spaces, there are two ways to enforce a newline to be kept: fold_some_newlines: > a b c d e f same_as: "a b\nc d\n e\nf\n

#### Flashcard 3760890187020

Question
In YAML, if a value has any of the following special charactors, it is best to wrap the entire value in double-quotes: # [...] {} []

:

^^ i.e. colon (follwed by space), which is the key/value pair syntax in YAML

status measured difficulty not learned 37% [default] 0
YAML Syntax — Ansible Documentation
ot valid: foo: "E:\\path\\"rest\\of\\path In addition to ' and " there are a number of characters that are special (or reserved) and cannot be used as the first character of an unquoted scalar: <span>[] {} > | * & ! % #  @ ,. You should also be aware of ? : -. In YAML, they are allowed at the beginning of a string if a non-space character follows, but YAML processor implementations differ, so it’s better to

#### Flashcard 3760893857036

Question
In YAML, if a value has any of the following special charactors, it is best to wrap the entire value in double-quotes: [...] : {} []

#

^^ hash char (followed by space) which signifies comment syntax in YAML

status measured difficulty not learned 37% [default] 0

#### Flashcard 3760896478476

Question
In YAML, if a value has any of the following special charactors, it is best to wrap the entire value in double-quotes: # : [...] []

{}

^^ opening and closing squigly brackets because they signify dictionaries in the "flow collections" (less used) syntax of YAML. Watch out for this in Ansible, where "{}" syntax is used for variables

status measured difficulty not learned 37% [default] 0

#### Flashcard 3760899099916

Question
In YAML, if a value has any of the following special charactors, it is best to wrap the entire value in double-quotes: # : {} [...]

[]

^^ i.e. opening/closing square brackets which signifies list syntax in the "flow collections" (less used) syntax of YAML

status measured difficulty not learned 37% [default] 0

#### Flashcard 3760902507788

Question
In YAML, if a string/non-boolean value is equal to the boolean values (yes, no, true, True, TRUE, false, etc), it must be [...looking for phrase answer...]
enclosed in double quotes

status measured difficulty not learned 37% [default] 0

#### Flashcard 3760905129228

Question

In YAML, the following line will throw a syntax error due to inclusion of special charactors in the value of foo:

foo: {{ variable }}/additional/string/literal

Correct the above line:

foo: "{{ variable }}/additional/string/literal"`