Yaml Cheat Sheet + Download via https://alta3.com/posters/yaml.pdf

Type / Style YAML Examples Example Description Helpful Links Purpose http://www.yamllint.com/ Check Syntax of YAML Start yaml document → --- Simple key value pairs in Start of YAML Doc → game: tetris Yaml (Dictionary) https://codebeautify.org/yaml-validator Check Syntax of YAML Key: value pair → type: puzzle Key: value pair → levels: ten http://yaml.org/spec/1.2/spec.html Extended YAML Documentation Key: value pair → https://github.com/Animosity/CraftIRC/wiki/Complete-idiot%27s-introduction-to-yaml Introduction to YAML Start yaml document→ --- List of Dictionaries Key:→ employees: http://ansible-docs.readthedocs.io/zh/stable-2.0/rst/YAMLSyntax. YAML with Ansible Value of employee→ - Michael Value of employee→ - Jim https://learnxinyminutes.com/docs/yaml/ Quick YAML Examples Value of employee→ - Pam Value of employee→ - Creed

Start yaml document → --- List of Lists Start of list of lists → - time Facts Item 1 in list time → - Is Item 2 in list time → - of Tab characters are not to be used Item 1 in list time.of → - the Item 2 in list time.of → - essence YAML is cAsE sensitive Item 3 in list time → - many Item 1 in list time.many → - quotes End your YAML file with the .yaml or .yml extension

Start yaml document → --- Ansible tasks are a All members of a list are lines beginning at the same indentation level starting with a "- " (a dash and a ) start playbook tasks → tasks: specific Ansible comment → - name: create file from template dictionary of dictionaries Three dashes --- is optional in starting a yaml document Module name (template) → template: which represents the Parameter src → src: “{{ item.src }}” parameters passed to an Three periods … is optional in ending a yaml document Parameter dest → dest: “{{ item.dest }}” ansible module Parameter owner → owner: goku Use a monospaced font such as courier new when writing yaml documents Parameter group → group: saiyan This task, using the Parameter mode → mode: 0755 template module, which Ansible playbooks are YAML files Task modifier → with_items: loops over src/dest files First vars set in list → - {src: ‘nvic1.j2’, dest: ‘/tmp/namek1.txt’} YAML is a superset of JSON Second vars set in list → - {src: ‘nvic2.j2’, dest: ‘/tmp/namek2.txt’} Register as a variable → register: namek_visa_id_card Run as root (True==yes) → become: yes Terms Start yaml document → --- Ansible specific Dictionary Task description ansible → - name: download file from website of dictionaries with sequences (arrays / lists) starts with a dash – then a space for each line Module name (get_url) → get_url: dictionary of dictionary Parameter url file to dl → url: “http://ilvcartoons.watch.com/ctn.tar.gz” scalars (strings / numbers) Parameter place to save → dest: /home/professorX/ctn.tar.gz Single task, get url set Parameter rwx permission → mode: ‘0644’ permissions, and change dir mappings (hashes / dictionaries) is a key: value form (the must be followed by a space) Ansible option argument → args: beforehand Param chdir before exec → chdir: “/home/professorX” Change Directory →

Need Telecom or IT Training? © Alta3 Research, Inc. Visit https://alta3.com/posters for more [email protected] || +1-717-566-4428 https://alta3.com Alta3 Posters & Cheat Sheets