Fundamentals & Architecture
What is a task in Ansible?
Explain the architecture of Ansible, including the Control Node, Managed Nodes, and Inventory.
What is Ansible and what are its key advantages over other configuration management tools?
What are the key features of Ansible?
What is the difference between a playbook, a play, and a task in Ansible?
What language is used to write Ansible Playbooks?
What is a YAML file and how do we use it in Ansible?
What is idempotence in Ansible and why does it matter, and how do you ensure idempotency in your tasks?
Explain Ansible's agentless architecture and its implications.
How can Ansible's configuration management assist an organization in handling system updates and maintaining integrity?
Comparisons & Use Cases
What are Ansible's primary use cases such as configuration management, application deployment, orchestration, and provisioning?
What is provisioning in Ansible?
What is orchestration in Ansible?
How does Ansible's approach differ from other configuration management tools like Puppet, Chef, or SaltStack (agentless vs agent-based, push vs pull, YAML vs DSLs)?
What is Red Hat Ansible Automation Platform (formerly Ansible Tower/AWX), and what capabilities does it add over command-line Ansible?
Explain the core differences between Ansible and Terraform, and when you would use each (provisioning vs configuration management).
When would you use Ansible AWX/Automation Platform?
How do Ansible and Terraform complement each other in a modern CI/CD pipeline or infrastructure lifecycle?
Inventory Management
What is an inventory in Ansible, and explain static vs dynamic inventories.
What is a group in inventory?
How do you define hosts and groups in an Ansible inventory?
What are the implicit 'all' and 'ungrouped' groups in an Ansible inventory?
What are dynamic inventory plugins for cloud providers like AWS, Azure, and GCP?
How do you manage multiple environments such as development, staging, and production in Ansible?
What are host patterns in Ansible and how do you use the --limit option to target a subset of hosts?
How do nested (child) groups work in an Ansible inventory?
What are connection variables like ansible_host, ansible_user, ansible_port, and ansible_connection, and how are they used?
What is host_key_checking and why might you disable it?
What is ansible-inventory and how do you use it to inspect or debug your inventory?
What are some best practices for securing your inventory files and access control?
Playbooks & Ad Hoc Commands
What is an ad-hoc command in Ansible, and how does it differ from a playbook?
What is an Ansible playbook and what language is used to write it?
What command would you use to check the syntax of an Ansible playbook without running it?
Why is naming your tasks considered a best practice, and how does it affect output and tagging?
How does import_playbook work and when would you use it to combine multiple playbooks?
What is the order of execution within a play (pre_tasks, roles, tasks, post_tasks, handlers)?
Modules & Plugins
Can you explain the difference between Ansible modules and Ansible playbooks?
What are Ansible modules, and how do they report results such as changed, ok, and failed?
What is the difference between the copy and template modules?
Explain the difference between Ansible modules and plugins.
What are Ansible modules, and can you explain the difference between core and extra modules?
Explain Ansible modules in detail.
What is the difference between the command, shell, and raw modules, and when would you use each?
When would you use lineinfile versus blockinfile to manage file content?
What are connection plugins in Ansible, and what is the difference between ssh, paramiko, local, and winrm?
Why is it a best practice to prefer dedicated modules over the command or shell modules?
Why does Ansible require Python on managed nodes, and how do the raw and gather_facts steps relate to this?
What are lookups and the lookup plugin in Ansible, and give an example of when you would use one?
Not all Ansible modules are inherently idempotent — how can a playbook author enforce idempotency when using modules like shell or command?
How do you create and use custom modules in Ansible?
What is a callback plugin in Ansible?
What are the different types of plugins in Ansible (callback, lookup, filter, inventory, strategy, vars) and how do they differ from modules?
What is the difference between an action plugin and a module in Ansible?
Variables & Facts
What are Ansible variables and how are they defined and used in playbooks?
What are host_vars and group_vars, and how are they used?
What are registered variables, and how do you use them?
How is the set_fact module different from defining variables using vars, vars_files, or include_vars?
How can you access shell environment variables in Ansible?
How do dot notation and array notation of variables differ in Ansible?
What are extra variables (-e) and where do they sit in the variable precedence order?
What are magic variables such as hostvars, inventory_hostname, and groups, and when would you use them?
What is vars_prompt and when would you use it to collect input at runtime?
What is the difference between role defaults and role vars in terms of variable precedence?
What are Ansible facts and how are they gathered, and how does fact gathering/caching work and when should you disable it?
Explain the Ansible variable precedence ladder and common pitfalls.
When is it unsafe to bulk-set task arguments from a variable?
What are custom facts (facts.d / local facts) and how do you define them on a managed host?
Roles Collections & Reusability
What is Ansible Galaxy and how does it facilitate role management?
What is the ansible.builtin namespace and what does it contain?
What are Ansible Collections and why are they used?
What is an Ansible role and how do you create one, and how do roles promote modularity and collaboration in automation workflows?
What are Ansible roles and how do they differ from playbooks?
What is an Ansible collection namespace?
How do you pin versions of Collections in requirements.yml?
Describe the purpose of each key file in a standard Ansible role directory (e.g., tasks/main.yml, handlers/main.yml, defaults/main.yml, vars/main.yml, meta/main.yml).
Explain the difference between Ansible playbooks, roles, and collections.
What is the best way to make content reusable/redistributable in Ansible?
How do you structure playbooks to include and reuse multiple roles efficiently?
What is Ansible Galaxy, and how does it relate to Ansible Collections?
What is a Fully Qualified Collection Name (FQCN) and why does Ansible recommend using it?
What is the difference between ansible-core and the community Ansible package?
How do you pass parameters to a role when calling it?
What is the difference between include_role, import_role, and the roles: keyword?
How do role dependencies defined in meta/main.yml work?
Security Vault & Privilege Escalation
What is become in Ansible, and how is it used for privilege escalation?
How does the --ask-become-pass option work and when do you need it?
How do you secure sensitive data in Ansible, and describe the workflow for using Ansible Vault to encrypt passwords and other sensitive data.
How does Ansible ensure security in general, considering SSH, Vault, and least privilege?
How do you manage multiple vault passwords or vault IDs in Ansible?
How do you encrypt a single variable using ansible-vault encrypt_string versus encrypting an entire file?
What does ansible-vault rekey do and how do you supply a vault password with --vault-password-file?
What are the different become_method options (sudo, su, doas) and how do you configure become_user?
How do you handle external secret lookups (e.g., HashiCorp Vault, AWS Secrets Manager), Vault IDs, and multi-vault workflows?
How do you securely manage sensitive data like passwords and API keys in Ansible playbooks without using Ansible Vault?
Control Flow & Error Handling
What is a conditional in Ansible, and how do you use when statements to control task execution?
What is a tag in Ansible, and how do you use --tags and --skip-tags?
What are handlers in Ansible, how are they triggered, and why do they run only once even if notified multiple times?
What is a loop in Ansible, when would you use it, and how can you implement looping over a list of hosts in a group?
How do you handle errors in an Ansible playbook using ignore_errors, failed_when, and rescue blocks?
What are blocks in Ansible and how do block/rescue/always work for grouping tasks and error handling?
How do you retry a task until a condition is met using until, retries, and delay?
What is the difference between the with_items family of loops and the newer loop keyword?
What is the difference between changed_when and failed_when, and how do they customize task status?
What does ignore_unreachable do and how is it different from ignore_errors?
What do the assert and fail modules do and when would you use them?
What are the 'always' and 'never' special tags and how do they behave with --tags and --skip-tags?
What is loop_control and what options does it provide (e.g., loop_var, label, pause)?
What is the difference between include_tasks and import_tasks (dynamic vs static)?
What does the flush_handlers directive do and when would you use it?
What is the 'listen' keyword in handlers and how does it enable notifying multiple handlers?
How does force_handlers change handler behavior when a play fails?
Delegation & Conditional Execution
Explain the use of the delegate_to directive and provide a scenario where it would be useful.
What is the local_action directive and how does it relate to delegate_to: localhost?
Explain delegate_to and run_once in Ansible and their purpose.
What does delegate_facts do and how does it differ from delegate_to?
Configuration & Tooling
What is ansible-doc and how do you use it to explore module documentation?
What is the ansible.cfg file, and what are some common settings configured within it?
What are the benefits of using Ansible Navigator?
Where can the ansible.cfg file live and how is its precedence determined?
What is ansible-lint and how does it help improve playbook quality?
How do ANSIBLE_* environment variables interact with ansible.cfg and command-line overrides?
What are execution environments in Ansible and what problem do they solve?
Templating & Jinja2
What is a template in Ansible, and how does it use Jinja2 syntax to generate dynamic configuration files?
What does the 'default' Jinja2 filter do in Ansible, and how is it different from 'mandatory'?
What are some commonly used Jinja2 filters in Ansible such as map, select, combine, and regex_replace?
How do you write and use a custom filter plugin in Ansible?
Performance & Execution Strategies
How does the serial keyword control batch sizes in a rolling update?
What are forks in Ansible and how do they control parallelism across hosts?
What are the different task execution strategies in Ansible such as linear, free, and serial, and when would you use each?
What is pipelining in Ansible, and how does it improve performance?
How do you optimize Ansible playbook performance in large-scale environments using forks, pipelining, fact caching, and limiting scope?
How do you implement rolling updates in Ansible?
Explain the concept of asynchronous task execution in Ansible and how it benefits long-running or parallel tasks.
How would you use Ansible to orchestrate a zero-downtime deployment?
What do any_errors_fatal and max_fail_percentage do, and how do they affect a play across multiple hosts?
What is throttle in Ansible and how does it limit task concurrency?
Integrations & Automation Workflows
How would you use Ansible to automate the deployment process?
How do you implement CI/CD integration with Ansible?
How do you integrate Ansible with external tools and platforms like GitLab CI/CD pipelines, HashiCorp Vault, or monitoring systems?
How does Ansible integrate with Kubernetes for managing clusters, deployments, and services?
How would you use Ansible to automate configuration drift detection and remediation?
How can Ansible help when migrating workloads from on-premises infrastructure to the cloud?
How does Ansible manage Windows hosts, and what is different about using WinRM instead of SSH?
Testing Debugging & Troubleshooting
How do you interpret the PLAY RECAP and the ok/changed/failed/skipped/unreachable counts?
What does the --diff flag show when running a playbook, and how does it help?
What is check mode (--check) in Ansible, and when would you use it?
How do you debug a failing Ansible playbook, and what command-line flags and Ansible modules would you use?
What is Molecule and how is it used for testing Ansible roles?