All questions
of 27Explain the difference between Ansible Playbooks, Plays, and Tasks.
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
- Playbook: A YAML file containing one or more plays that define automation workflows
- Play: A section within a playbook that maps hosts to tasks and defines how tasks should be executed
- Task: Individual units of work that call Ansible modules to perform specific actions
# Playbook
- name: Web server setup # Play 1
hosts: webservers
tasks:
- name: Install Apache # Task 1
yum:
name: httpd
state: present
- name: Start Apache # Task 2
service:
name: httpd
state: started
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
The model's verdict: “”
The interactive diagram is below the answer - jump to diagram ↓
This answer is explained by a shared concept diagram - open →
What is an Ansible Inventory and what are the different types?
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
Ansible Inventory defines the hosts and groups that Ansible manages. It specifies which machines your playbooks will run against.
Static Inventory (INI format):
[webservers]
web1.example.com
web2.example.com
[databases]
db1.example.com ansible_host=192.168.1.100
[production:children]
webservers
databases
Static Inventory (YAML format):
all:
children:
webservers:
hosts:
web1.example.com:
web2.example.com:
databases:
hosts:
db1.example.com:
ansible_host: 192.168.1.100
Dynamic Inventory:
- Scripts that generate inventory from external sources (AWS, Azure, GCP)
- Returns JSON format with host and group information
- Useful for cloud environments where hosts change frequently
- Can be written in any language that outputs proper JSON
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
The model's verdict: “”
The interactive diagram is below the answer - jump to diagram ↓
This answer is explained by a shared concept diagram - open →
What are Ansible Facts and how do you use them?
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
Ansible Facts are system information automatically collected from managed nodes when a playbook runs. They include details about hardware, OS, network configuration, and installed software.
Accessing facts:
- name: Display OS information
debug:
msg: "This host runs {{ ansible_distribution }} {{ ansible_distribution_version }}"
- name: Conditional based on facts
yum:
name: httpd
state: present
when: ansible_os_family == "RedHat"
Custom facts:
- name: Set custom fact
set_fact:
custom_variable: "custom_value"
- name: Gather facts manually
setup:
- name: Disable fact gathering
hosts: webservers
gather_facts: false
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
The model's verdict: “”
The interactive diagram is below the answer - jump to diagram ↓
This answer is explained by a shared concept diagram - open →
How do you handle sensitive data like passwords in Ansible?
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
Ansible Vault is the primary method for encrypting sensitive data like passwords, API keys, and certificates.
Basic Vault operations:
# Encrypt a file
ansible-vault encrypt secrets.yml
# Decrypt a file
ansible-vault decrypt secrets.yml
# Edit encrypted file
ansible-vault edit secrets.yml
# Run playbook with vault password
ansible-playbook site.yml --ask-vault-pass
# Use vault password file
ansible-playbook site.yml --vault-password-file .vault_pass
Encrypting specific variables:
# vars.yml
username: john
password: !vault |
$ANSIBLE_VAULT;1.1;AES256
66386439653762356265343432393730...
Best practices:
- Store vault password in a file with restricted permissions (chmod 600)
- Use separate vault files for different environments
- Encrypt only sensitive variables, not entire playbooks
- Use
no_log: truein tasks handling sensitive data - Never commit vault passwords to version control
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
The model's verdict: “”
The interactive diagram is below the answer - jump to diagram ↓
This answer is explained by a shared concept diagram - open →
Explain Ansible Roles and their directory structure.
What are Ansible Variables and what is the order of precedence?
How do you implement conditionals in Ansible?
Explain Ansible Handlers and when to use them.
How do you implement loops in Ansible?
Explain Ansible Galaxy and how to create custom roles.
How do you implement error handling in Ansible?
What are Ansible Collections and how do they differ from roles?
How do you manage different environments (dev, staging, prod) in Ansible?
How do you test Ansible playbooks and roles?
Explain Ansible's idempotency and how to ensure it in custom tasks.
How do you handle Ansible playbook debugging and troubleshooting?
How do you monitor and log Ansible operations?
How do you optimize Ansible performance for large infrastructures?
Explain Ansible Vault and advanced encryption techniques.
How do you create and use custom Ansible modules?
What are Ansible plugins and how do you create them?
How do you implement rolling deployments with Ansible?
How do you manage secrets and integrate with external secret management systems?
What are Ansible callbacks and how do you create custom ones?
How do you implement infrastructure as code with Ansible for cloud platforms?
How do you implement Ansible in CI/CD pipelines?
What are some Ansible security best practices?
This answer is part of Pro.
The full written answer, with the trade-offs and follow-ups an interviewer will probe.
No matches
Try a different filter or search term.
Ansible cheatsheet
Ansible Interview Cheat Sheet
- Summary01
- 1. Core Concepts02
- 2. Installation & Setup03
- 3. Inventory04
- 4. Playbook Structure05
- 5. Variables06
- 6. Facts & Magic Variables07
- 7. Conditionals & Loops08
- 8. Handlers09
- 9. Templates (Jinja2)10
- 10. Roles11
- 11. Error Handling12
- + 11 more inside
23 of 27 Ansible answers are gated.
Full answers, code samples, AI explanations - simpler, deeper, or as an interactive diagram. Cancel anytime.
- Full answers + code
- AI explain - simpler, deeper, or visualized
- 1,000 AI credits / month
- Cancel anytime
Change topic
Pick a different technology or stack. Your current topic stays put until you choose a new one.
MEAN
MongoDB, Express, Angular, Node.jsMERN
MongoDB, Express, React, Node.jsLAMP
Linux, Apache, MySQL, PHPRuby on Rails
Convention over ConfigurationJAM
JavaScript, APIs, and MarkupServerless on AWS
Serverless Architecture on AWSInterviewers also test these - they're common to every stack, whichever one you picked above.
Flutter Mobile
Flutter Cross-Platform Mobile DevelopmentInterviewers also test these - they're common to every stack, whichever one you picked above.
Spring Boot
Enterprise Java Development.NET
Microsoft EcosystemVue
Vue.js, Vite, TypeScript, Tailwind, Node.jsGo Backend
Golang, gRPC, PostgreSQL, Redis, RabbitMQFastAPI
Python, FastAPI, SQLAlchemy, PostgreSQLReact Native
React, TypeScript, Redux, FirebaseiOS Native
Swift, SwiftUI, UIKit, FirebaseAndroid Native
Java, Jetpack Compose, FirebaseWeb3 / Ethereum
Solidity, Ethereum, Hardhat, FoundryDevOps / Platform
Docker, Kubernetes, Terraform, CI/CDCore SWE Interview Prep
Data structures, algorithms, OS, concurrency, networking, gitInterviewers also test these - they're common to every stack, whichever one you picked above.
Interviewers also test these - they're common to every stack, whichever one you picked above.