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