YAML aur Ansible Playbook Basics

Indentation, parent, child, mapping, sequence, playbook, task, module, argument aur value samajhne ke liye Roman Urdu study guide aur 25 sawalon ka interactive quiz.

Zaroori Terms aur Unki Definitions

IndentationLine ke shuru mein spaces jo nesting aur relation dikhati hain. YAML mein aam tor par har level par do spaces use hoti hain; tabs se parhez karein.
Parent keyAisi key jiske neeche indented data ho. dnf: apne arguments ka parent hai.
Child keyParent ke neeche nested key. name aur state, dnf ke children hain.
Mapping (dictionary)Key-value pairs ka collection, jaise name: git. Yeh batata hai ke kaunsi value kis key se belong karti hai.
Sequence (list)Items ka ordered collection. Har list item aam tor par hyphen aur space se shuru hota hai: - git.
List itemSequence ka ek element. Package list mein git, curl aur tree alag list items hain.
KeyColon se pehle wala label, jaise hosts, tasks, name ya state.
ValueKey ko di gayi information, jaise state: present mein present.
ScalarEk single value: string, number, Boolean ya null. Misalein: Ansible, false aur 200.
Nested structureEk mapping ya list ke andar doosri mapping ya list, jo zyada indentation se dikhayi jati hai.
PlaybookYAML file jismein ek ya zyada plays hotay hain. Top level aam tor par plays ki list hoti hai.
PlayAisi mapping jo target hosts ko ordered tasks ke saath connect karti hai.
Tasktasks list mein kaam ka ek named unit. Ek task aam tor par ek module call karta hai.
ModuleAnsible ka kaam karne wala unit, jaise file, copy, dnf ya ping.
Module argumentModule ko diya gaya input. file module ke arguments mein path, state aur mode shamil hain.
KeywordAnsible ka defined playbook term, jaise hosts, tasks, become ya gather_facts.
Block scalar |Multiline text shuru karta aur line breaks preserve karta hai. Yeh copy: content: ke saath useful hai.
Variable expressionDouble braces ke andar text, jaise {{ inventory_hostname }}, jise Ansible runtime par evaluate karta hai.

Explanation ke Saath Example

dnf:                 # parent key aur module
  name:              # dnf ka child; iski value ek list hai
    - git             # list item
    - curl            # list item
    - tree            # list item
  state: present     # child key: scalar value
Parent: dnfChildren: name, stateList items: git, curl, treeScalar: present

25 Sawalon ka Knowledge Check

Har sawal ka ek jawab select karein. Feedback foran nazar aayega. 20-minute timer zero honay par quiz automatically submit ho jayega.

Final Result

0/25

Jawabon ka Review