YAML: Difference between revisions
Jump to navigation
Jump to search
(Created page with "== YAML == YAML Syntax — Ansible Documentation - https://docs.ansible.com/ansible/2.5/reference_appendices/YAMLSyntax.html#yaml-syntax Comment: <pre> # this is a comment <...") |
No edit summary |
||
| Line 68: | Line 68: | ||
foo: "{{ variable }}" | foo: "{{ variable }}" | ||
</pre> | </pre> | ||
== yamllint == | |||
See [[yamllint]] | |||
Install: | |||
apt install yamllint | |||
Use: | |||
yamllint file.yaml | |||
Note: | |||
* Defaults to max lines 80 limit | |||
Doc: | |||
https://yamllint.readthedocs.io/en/stable/ | |||
== keywords == | |||
Revision as of 20:07, 25 February 2024
YAML
YAML Syntax — Ansible Documentation - https://docs.ansible.com/ansible/2.5/reference_appendices/YAMLSyntax.html#yaml-syntax
Comment:
# this is a comment
All 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.
--- # start and end ...
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
...
Dictionary:
# An employee record
martin:
name: Martin D'vloper
job: Developer
skill: Elite
Abbreviated list / dictonary:
martin: {name: Martin D'vloper, job: Developer, skill: Elite}
fruits: ['Apple', 'Orange', 'Strawberry', 'Mango']
Boolean values:
create_key: yes needs_agent: no knows_oop: True likes_emacs: TRUE uses_cvs: false
Literal Block Scalar: (indentation ignored)
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
Variables:
foo: "{{ variable }}"
yamllint
See yamllint
Install:
apt install yamllint
Use:
yamllint file.yaml
Note:
- Defaults to max lines 80 limit
Doc:
https://yamllint.readthedocs.io/en/stable/