Ravindra BagaleCourses & study guides मराठी

Ravi Sir's Cards › DevOps

Chapter 11: Ansible Introduction: Cards

मराठी cards · Open the chapter

Revision cards

Why Ansible: one playbook for many servers. Configuring servers one by one is slow and drifts apart.
Revision card 1 of 18: Why Ansible: one playbook for many servers · Download PNG · Open card page

Lesson: 11.1 Why Ansible — one playbook for many servers

Inventory: who are we configuring?. Ansible must know which servers to touch.
Revision card 2 of 18: Inventory: who are we configuring? · Download PNG · Open card page

Lesson: 11.2 Inventory — who are we configuring?

Modules and ad-hoc commands. Not every task needs a full playbook.
Revision card 3 of 18: Modules and ad-hoc commands · Download PNG · Open card page

Lesson: 11.3 Modules and ad-hoc commands

Idempotence: run twice, safe result. Re-running setup must not break or duplicate things.
Revision card 4 of 18: Idempotence: run twice, safe result · Download PNG · Open card page

Lesson: 11.4 Idempotence — run twice, safe result

Playbook: nginx welcome for badge-api. A playbook turns a setup guide into code.
Revision card 5 of 18: Playbook: nginx welcome for badge-api · Download PNG · Open card page

Lesson: 11.5 Playbook — Nginx welcome for badge API

ansible.cfg for friendlier labs. Typing the same flags every run is tiring and error-prone.
Revision card 6 of 18: ansible.cfg for friendlier labs · Download PNG · Open card page

Lesson: 11.5b ansible.cfg for friendlier labs

Handlers: restart only when needed. Restarting on every run causes needless blips.
Revision card 7 of 18: Handlers: restart only when needed · Download PNG · Open card page

Lesson: 11.6 Handlers — restart only when needed

Simple role folder layout. One huge playbook becomes unreadable.
Revision card 8 of 18: Simple role folder layout · Download PNG · Open card page

Lesson: 11.7 Simple role folder layout

Variables, Vault awareness and secrets. Plain-text passwords in Git leak.
Revision card 9 of 18: Variables, Vault awareness and secrets · Download PNG · Open card page

Lesson: 11.8 Variables, vault awareness and secrets

Ansible vs shell scripts: choose deliberately. Using the wrong tool makes simple things hard.
Revision card 10 of 18: Ansible vs shell scripts: choose deliberately · Download PNG · Open card page

Lesson: 11.9 Ansible vs shell scripts — choose deliberately

Check mode and diff. Running straight on prod is risky.
Revision card 11 of 18: Check mode and diff · Download PNG · Open card page

Lesson: 11.9b Check mode and diff

Tags: run part of a playbook. Running a long playbook for one small change is slow.
Revision card 12 of 18: Tags: run part of a playbook · Download PNG · Open card page

Lesson: 11.9c Tags — run part of a playbook

Dynamic inventory (awareness). Cloud servers change IPs; hand-written lists go stale.
Revision card 13 of 18: Dynamic inventory (awareness) · Download PNG · Open card page

Lesson: 11.9d Dynamic inventory (awareness)

Troubleshooting table. A few errors cause most Ansible pain.
Revision card 14 of 18: Troubleshooting table · Download PNG · Open card page

Lesson: 11.10 Troubleshooting table

limit and serial (awareness). Changing all servers at once can take the whole site down.
Revision card 15 of 18: limit and serial (awareness) · Download PNG · Open card page

Lesson: 11.10b Limit and serial (awareness)

Git layout for Ansible labs. Messy repos make it unclear what runs where.
Revision card 16 of 18: Git layout for Ansible labs · Download PNG · Open card page

Lesson: 11.11 Git layout for Ansible labs

Lab: playbook installs nginx welcome. One full run proves the whole flow.
Revision card 17 of 18: Lab: playbook installs nginx welcome · Download PNG · Open card page

Lesson: 11.12 Lab — playbook installs Nginx welcome

What good looks like after this chapter. A clear finish line shows what you've learned.
Revision card 18 of 18: What good looks like after this chapter · Download PNG · Open card page

Lesson: 11.13 What good looks like after this chapter

Interview cards

What is Ansible and why is it agentless? A tool that configures servers from YAML playbooks; it uses plain SSH, so no software is needed on targets except Python.
Interview card 1 of 18: What is Ansible and why is it agentless? · Download PNG · Open card page

Lesson: 11.1 Why Ansible — one playbook for many servers

What is an Ansible inventory? A file (or script) listing hosts and groups, plus connection variables like user and IP.
Interview card 2 of 18: What is an Ansible inventory? · Download PNG · Open card page

Lesson: 11.2 Inventory — who are we configuring?

What is an Ansible module? A reusable unit like apt, copy or service that does one job and reports changed or ok.
Interview card 3 of 18: What is an Ansible module? · Download PNG · Open card page

Lesson: 11.3 Modules and ad-hoc commands

What does idempotent mean in Ansible? Running the playbook again leaves the system the same; tasks report ok, not changed.
Interview card 4 of 18: What does idempotent mean in Ansible? · Download PNG · Open card page

Lesson: 11.4 Idempotence — run twice, safe result

Write a small playbook to install nginx. A play on hosts: web with become, tasks: apt install nginx, template the config, service started and enabled.
Interview card 5 of 18: Write a small playbook to install nginx. · Download PNG · Open card page

Lesson: 11.5 Playbook — Nginx welcome for badge API

What is ansible.cfg used for? Project defaults like inventory path, remote user, roles path and SSH options, so commands stay short.
Interview card 6 of 18: What is ansible.cfg used for? · Download PNG · Open card page

Lesson: 11.5b ansible.cfg for friendlier labs

What are Ansible handlers? Tasks that run only when notified by a changed task, usually to restart a service, and run once at the end of the play.
Interview card 7 of 18: What are Ansible handlers? · Download PNG · Open card page

Lesson: 11.6 Handlers — restart only when needed

What is an Ansible role? A reusable package with a fixed folder layout (tasks, handlers, templates, defaults) for one component.
Interview card 8 of 18: What is an Ansible role? · Download PNG · Open card page

Lesson: 11.7 Simple role folder layout

How do you store secrets for Ansible? Encrypt them with ansible-vault (or pull from a secret manager) and hide output with no_log.
Interview card 9 of 18: How do you store secrets for Ansible? · Download PNG · Open card page

Lesson: 11.8 Variables, vault awareness and secrets

When would you choose Ansible over Bash? When configuring many servers, needing idempotent reruns, inventory groups, and readable YAML for review.
Interview card 10 of 18: When would you choose Ansible over Bash? · Download PNG · Open card page

Lesson: 11.9 Ansible vs shell scripts — choose deliberately

How do you preview Ansible changes? Run with --check (dry run) and --diff to see exact changes; review, then run for real.
Interview card 11 of 18: How do you preview Ansible changes? · Download PNG · Open card page

Lesson: 11.9b Check mode and diff

What are Ansible tags for? To run or skip only some tasks of a playbook, using --tags or --skip-tags.
Interview card 12 of 18: What are Ansible tags for? · Download PNG · Open card page

Lesson: 11.9c Tags — run part of a playbook

Static vs dynamic inventory? Static: hosts written in a file. Dynamic: generated at run time from a cloud API or CMDB.
Interview card 13 of 18: Static vs dynamic inventory? · Download PNG · Open card page

Lesson: 11.9d Dynamic inventory (awareness)

A host shows UNREACHABLE. What do you check? SSH works by hand with the same user and key, the IP/hostname is right, and the firewall allows port 22.
Interview card 14 of 18: A host shows UNREACHABLE. What do you check? · Download PNG · Open card page

Lesson: 11.10 Troubleshooting table

How do you roll out a change gradually with Ansible? Set serial (e.g. 2 or 25%) so hosts update in batches, plus max_fail_percentage to stop on errors.
Interview card 15 of 18: How do you roll out a change gradually with Ansible? · Download PNG · Open card page

Lesson: 11.10b Limit and serial (awareness)

How do you structure an Ansible repo? ansible.cfg, inventories/ per environment with group_vars, roles/, and top-level playbooks like site.yml.
Interview card 16 of 18: How do you structure an Ansible repo? · Download PNG · Open card page

Lesson: 11.11 Git layout for Ansible labs

Show your Ansible playbook works and is idempotent. Run it, curl the page, run it again and show changed=0 in the recap.
Interview card 17 of 18: Show your Ansible playbook works and is idempotent. · Download PNG · Open card page

Lesson: 11.12 Lab — playbook installs Nginx welcome

What Ansible skills can you show today? Inventory, playbooks, handlers, roles, vault, check mode, and an idempotent rerun.
Interview card 18 of 18: What Ansible skills can you show today? · Download PNG · Open card page

Lesson: 11.13 What good looks like after this chapter

Comparison cards

Ansible vs Bash scripts. Bash script: a list of commands run in order.Ansible: YAML that describes how servers should look; it fixes what's different.
Comparison card 1 of 3: Ansible vs Bash scripts · Download PNG · Open card page

Lesson: 11.9 Ansible vs shell scripts — choose deliberately

Handler vs task. Task: a step that always runs in order.Handler: a step that runs only when a task reports a change and notifies it.
Comparison card 2 of 3: Handler vs task · Download PNG · Open card page

Lesson: 11.6 Handlers — restart only when needed

Static vs dynamic inventory. Static inventory: a file where you type host names or IPs.Dynamic inventory: a plugin that asks the cloud for current servers.
Comparison card 3 of 3: Static vs dynamic inventory · Download PNG · Open card page

Lesson: 11.9d Dynamic inventory (awareness)