Ansible

0%
Theory
Quiz

    Fundamentals & Architecture

    • What is a task in Ansible?

      Junior
    • Explain the architecture of Ansible, including the Control Node, Managed Nodes, and Inventory.

      Junior
    • What is Ansible and what are its key advantages over other configuration management tools?

      Junior
    • What are the key features of Ansible?

      Junior
    • How does Ansible work?

      Junior
    • What is the difference between a playbook, a play, and a task in Ansible?

      Junior
    • What language is used to write Ansible Playbooks?

      Junior
    • What is a YAML file and how do we use it in Ansible?

      Junior
    • What is idempotence in Ansible and why does it matter, and how do you ensure idempotency in your tasks?

      Mid
    • Explain Ansible's agentless architecture and its implications.

      Mid
    • How can Ansible's configuration management assist an organization in handling system updates and maintaining integrity?

      Mid

    Comparisons & Use Cases

    • What are Ansible's primary use cases such as configuration management, application deployment, orchestration, and provisioning?

      Junior
    • What is provisioning in Ansible?

      Junior
    • What is orchestration in Ansible?

      Junior
    • 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)?

      Mid
    • What is Red Hat Ansible Automation Platform (formerly Ansible Tower/AWX), and what capabilities does it add over command-line Ansible?

      Mid
    • Explain the core differences between Ansible and Terraform, and when you would use each (provisioning vs configuration management).

      Mid
    • When would you use Ansible AWX/Automation Platform?

      Mid
    • How do Ansible and Terraform complement each other in a modern CI/CD pipeline or infrastructure lifecycle?

      Senior

    Inventory Management

    • What is an inventory in Ansible, and explain static vs dynamic inventories.

      Junior
    • What is a group in inventory?

      Junior
    • How do you define hosts and groups in an Ansible inventory?

      Junior
    • What are the implicit 'all' and 'ungrouped' groups in an Ansible inventory?

      Junior
    • What are dynamic inventory plugins for cloud providers like AWS, Azure, and GCP?

      Mid
    • How do you manage multiple environments such as development, staging, and production in Ansible?

      Mid
    • What are host patterns in Ansible and how do you use the --limit option to target a subset of hosts?

      Mid
    • How do nested (child) groups work in an Ansible inventory?

      Mid
    • What are connection variables like ansible_host, ansible_user, ansible_port, and ansible_connection, and how are they used?

      Mid
    • What is host_key_checking and why might you disable it?

      Mid
    • What is ansible-inventory and how do you use it to inspect or debug your inventory?

      Mid
    • What are some best practices for securing your inventory files and access control?

      Senior

    Playbooks & Ad Hoc Commands

    • What is an ad-hoc command in Ansible, and how does it differ from a playbook?

      Junior
    • What is an Ansible playbook and what language is used to write it?

      Junior
    • What command would you use to check the syntax of an Ansible playbook without running it?

      Junior
    • What is a playbook run?

      Junior
    • Why is naming your tasks considered a best practice, and how does it affect output and tagging?

      Junior
    • How does import_playbook work and when would you use it to combine multiple playbooks?

      Mid
    • What is the order of execution within a play (pre_tasks, roles, tasks, post_tasks, handlers)?

      Senior

    Modules & Plugins

    • Can you explain the difference between Ansible modules and Ansible playbooks?

      Junior
    • What are Ansible modules, and how do they report results such as changed, ok, and failed?

      Junior
    • What is the difference between the copy and template modules?

      Junior
    • Explain the difference between Ansible modules and plugins.

      Mid
    • What are Ansible modules, and can you explain the difference between core and extra modules?

      Mid
    • Explain Ansible modules in detail.

      Mid
    • What is the difference between the command, shell, and raw modules, and when would you use each?

      Mid
    • When would you use lineinfile versus blockinfile to manage file content?

      Mid
    • What are connection plugins in Ansible, and what is the difference between ssh, paramiko, local, and winrm?

      Mid
    • Why is it a best practice to prefer dedicated modules over the command or shell modules?

      Mid
    • Why does Ansible require Python on managed nodes, and how do the raw and gather_facts steps relate to this?

      Mid
    • What are lookups and the lookup plugin in Ansible, and give an example of when you would use one?

      Mid
    • Not all Ansible modules are inherently idempotent — how can a playbook author enforce idempotency when using modules like shell or command?

      Senior
    • How do you create and use custom modules in Ansible?

      Senior
    • What is a callback plugin in Ansible?

      Senior
    • What are the different types of plugins in Ansible (callback, lookup, filter, inventory, strategy, vars) and how do they differ from modules?

      Senior
    • What is the difference between an action plugin and a module in Ansible?

      Senior

    Variables & Facts

    • What are Ansible variables and how are they defined and used in playbooks?

      Junior
    • What are host_vars and group_vars, and how are they used?

      Junior
    • What are registered variables, and how do you use them?

      Junior
    • How is the set_fact module different from defining variables using vars, vars_files, or include_vars?

      Mid
    • How can you access shell environment variables in Ansible?

      Mid
    • How do dot notation and array notation of variables differ in Ansible?

      Mid
    • What are extra variables (-e) and where do they sit in the variable precedence order?

      Mid
    • What are magic variables such as hostvars, inventory_hostname, and groups, and when would you use them?

      Mid
    • What is vars_prompt and when would you use it to collect input at runtime?

      Mid
    • What is the difference between role defaults and role vars in terms of variable precedence?

      Mid
    • What are Ansible facts and how are they gathered, and how does fact gathering/caching work and when should you disable it?

      Senior
    • Explain the Ansible variable precedence ladder and common pitfalls.

      Senior
    • When is it unsafe to bulk-set task arguments from a variable?

      Senior
    • What are custom facts (facts.d / local facts) and how do you define them on a managed host?

      Senior

    Roles Collections & Reusability

    • What is Ansible Galaxy and how does it facilitate role management?

      Junior
    • What is the ansible.builtin namespace and what does it contain?

      Junior
    • What are Ansible Collections and why are they used?

      Mid
    • What is an Ansible role and how do you create one, and how do roles promote modularity and collaboration in automation workflows?

      Mid
    • What are Ansible roles and how do they differ from playbooks?

      Mid
    • What is an Ansible collection namespace?

      Mid
    • How do you pin versions of Collections in requirements.yml?

      Mid
    • 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).

      Mid
    • Explain the difference between Ansible playbooks, roles, and collections.

      Mid
    • What is the best way to make content reusable/redistributable in Ansible?

      Mid
    • How do you structure playbooks to include and reuse multiple roles efficiently?

      Mid
    • What is Ansible Galaxy, and how does it relate to Ansible Collections?

      Mid
    • What is a Fully Qualified Collection Name (FQCN) and why does Ansible recommend using it?

      Mid
    • What is the difference between ansible-core and the community Ansible package?

      Mid
    • How do you pass parameters to a role when calling it?

      Mid
    • What is the difference between include_role, import_role, and the roles: keyword?

      Senior
    • How do role dependencies defined in meta/main.yml work?

      Senior

    Security Vault & Privilege Escalation

    • What is become in Ansible, and how is it used for privilege escalation?

      Junior
    • How does the --ask-become-pass option work and when do you need it?

      Junior
    • How do you secure sensitive data in Ansible, and describe the workflow for using Ansible Vault to encrypt passwords and other sensitive data.

      Mid
    • How does Ansible ensure security in general, considering SSH, Vault, and least privilege?

      Mid
    • How do you manage multiple vault passwords or vault IDs in Ansible?

      Mid
    • How do you encrypt a single variable using ansible-vault encrypt_string versus encrypting an entire file?

      Mid
    • What does ansible-vault rekey do and how do you supply a vault password with --vault-password-file?

      Mid
    • What are the different become_method options (sudo, su, doas) and how do you configure become_user?

      Mid
    • How do you handle external secret lookups (e.g., HashiCorp Vault, AWS Secrets Manager), Vault IDs, and multi-vault workflows?

      Senior
    • How do you securely manage sensitive data like passwords and API keys in Ansible playbooks without using Ansible Vault?

      Senior

    Control Flow & Error Handling

    • What is a conditional in Ansible, and how do you use when statements to control task execution?

      Junior
    • What is a tag in Ansible, and how do you use --tags and --skip-tags?

      Junior
    • What are handlers in Ansible, how are they triggered, and why do they run only once even if notified multiple times?

      Mid
    • 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?

      Mid
    • How do you handle errors in an Ansible playbook using ignore_errors, failed_when, and rescue blocks?

      Mid
    • What are blocks in Ansible and how do block/rescue/always work for grouping tasks and error handling?

      Mid
    • How do you retry a task until a condition is met using until, retries, and delay?

      Mid
    • What is the difference between the with_items family of loops and the newer loop keyword?

      Mid
    • What is the difference between changed_when and failed_when, and how do they customize task status?

      Mid
    • What does ignore_unreachable do and how is it different from ignore_errors?

      Mid
    • What do the assert and fail modules do and when would you use them?

      Mid
    • What are the 'always' and 'never' special tags and how do they behave with --tags and --skip-tags?

      Mid
    • What is loop_control and what options does it provide (e.g., loop_var, label, pause)?

      Senior
    • What is the difference between include_tasks and import_tasks (dynamic vs static)?

      Senior
    • What does the flush_handlers directive do and when would you use it?

      Senior
    • What is the 'listen' keyword in handlers and how does it enable notifying multiple handlers?

      Senior
    • How does force_handlers change handler behavior when a play fails?

      Senior

    Delegation & Conditional Execution

    • Explain the use of the delegate_to directive and provide a scenario where it would be useful.

      Mid
    • What is the local_action directive and how does it relate to delegate_to: localhost?

      Mid
    • Explain delegate_to and run_once in Ansible and their purpose.

      Senior
    • What does delegate_facts do and how does it differ from delegate_to?

      Senior

    Configuration & Tooling

    • What is ansible-doc and how do you use it to explore module documentation?

      Junior
    • What is the ansible.cfg file, and what are some common settings configured within it?

      Mid
    • What are the benefits of using Ansible Navigator?

      Mid
    • Where can the ansible.cfg file live and how is its precedence determined?

      Mid
    • What is ansible-lint and how does it help improve playbook quality?

      Mid
    • How do ANSIBLE_* environment variables interact with ansible.cfg and command-line overrides?

      Senior
    • What are execution environments in Ansible and what problem do they solve?

      Senior

    Templating & Jinja2

    • What is a template in Ansible, and how does it use Jinja2 syntax to generate dynamic configuration files?

      Mid
    • What does the 'default' Jinja2 filter do in Ansible, and how is it different from 'mandatory'?

      Mid
    • What are some commonly used Jinja2 filters in Ansible such as map, select, combine, and regex_replace?

      Senior
    • How do you write and use a custom filter plugin in Ansible?

      Senior

    Performance & Execution Strategies

    • How does the serial keyword control batch sizes in a rolling update?

      Mid
    • What are forks in Ansible and how do they control parallelism across hosts?

      Mid
    • What are the different task execution strategies in Ansible such as linear, free, and serial, and when would you use each?

      Senior
    • What is pipelining in Ansible, and how does it improve performance?

      Senior
    • How do you optimize Ansible playbook performance in large-scale environments using forks, pipelining, fact caching, and limiting scope?

      Senior
    • How do you implement rolling updates in Ansible?

      Senior
    • Explain the concept of asynchronous task execution in Ansible and how it benefits long-running or parallel tasks.

      Senior
    • How would you use Ansible to orchestrate a zero-downtime deployment?

      Senior
    • What do any_errors_fatal and max_fail_percentage do, and how do they affect a play across multiple hosts?

      Senior
    • What is throttle in Ansible and how does it limit task concurrency?

      Senior

    Integrations & Automation Workflows

    • How would you use Ansible to automate the deployment process?

      Junior
    • How do you implement CI/CD integration with Ansible?

      Mid
    • How do you integrate Ansible with external tools and platforms like GitLab CI/CD pipelines, HashiCorp Vault, or monitoring systems?

      Senior
    • How does Ansible integrate with Kubernetes for managing clusters, deployments, and services?

      Senior
    • How would you use Ansible to automate configuration drift detection and remediation?

      Senior
    • How can Ansible help when migrating workloads from on-premises infrastructure to the cloud?

      Senior
    • How does Ansible manage Windows hosts, and what is different about using WinRM instead of SSH?

      Senior

    Testing Debugging & Troubleshooting

    • How do you interpret the PLAY RECAP and the ok/changed/failed/skipped/unreachable counts?

      Junior
    • What does the --diff flag show when running a playbook, and how does it help?

      Junior
    • What is check mode (--check) in Ansible, and when would you use it?

      Mid
    • How do you debug a failing Ansible playbook, and what command-line flags and Ansible modules would you use?

      Mid
    • What is Molecule and how is it used for testing Ansible roles?

      Senior