Ansible Automation Cheat Sheet 2026
The 30 highest-yield Ansible Automation facts, distilled from real exam questions. Print it, save it as a PDF, or study it here — free, no sign-up.
50 questions
90 min time limit
70% to pass
- What language is the default in which Ansible playbooks are written? → YAML format
- A playbook needs to iterate over a list of users and create a home directory for each. Which Ansible construct is most appropriate? → Using with_items or loop with the user module
- When using Ansible with 'serial' execution (rolling updates), when do handlers run? → At the end of each serial batch, not at the very end of the entire play
- Within an Ansible Collection's directory structure, where should custom modules be placed? → plugins/modules/
- Which command installs all roles and collections listed in a requirements.yml file? → ansible-galaxy install -r requirements.yml
- Which Ansible feature allows you to test variable values before a play runs, preventing misconfigured deployments? → pre_tasks with assert
- Under HIPAA's Technical Safeguard requirements, which Ansible practice best satisfies the 'audit controls' standard? → Storing playbook output in an immutable, timestamped job log in Tower/AWX
- What is the effect of setting `strategy: free` in a play? → Each host executes tasks as fast as it can without waiting for others
- How do you register a task result and use it in a subsequent conditional? → Use `register` to store the result and `when` to reference the registered variable
- What is the difference between 'include_tasks' and 'import_tasks' in Ansible? → include_tasks is dynamic (runtime), import_tasks is static (parse time)
- What does `ansible-lint` rule `no-changed-when` enforce? → Tasks using `shell` or `command` must define `changed_when`
- What is the role of `uri` module in post-deployment quality assurance? → Sends HTTP requests to verify endpoints are reachable and returning expected responses
- What is the purpose of Ansible Tower's (AWX) workflow templates? → Chain multiple job templates with conditional logic
- Which practice reduces the risk of accidental production changes when maintaining separate dev and prod inventories? → Requiring explicit `--limit` to target production hosts
- What keyword is used in an inventory file to define variables that apply to all hosts in a group? → [groupname:vars]
- Which command builds an Ansible Collection into a distributable .tar.gz archive? → ansible-galaxy collection build
- What does `any_errors_fatal: true` do in a play? → Stops the entire play if any host fails
- Which conditional syntax correctly checks if a variable is defined in an Ansible task? → when: my_var is defined
- What does the Ansible documentation recommend as the primary method to test a playbook's changes without applying them? → ansible-playbook --check
- What host pattern would you use to target all hosts in both 'webservers' and 'dbservers' groups? → webservers:dbservers
- Which ansible.cfg setting disables SSH host key checking? → host_key_checking = False
- In a YAML inventory file, how do you define a host with a variable? → hosts:\n server1:\n ansible_user: admin
- Where must Ansible handlers be defined within a playbook? → In a 'handlers' section at the play level, separate from the 'tasks' section
- How does a Ansible Automation professional communicate risks to stakeholders? → By presenting risks clearly with context, potential impacts, and recommended actions
- What is the best-practice way to ensure an Ansible execution environment is reproducible across different control nodes? → Use an execution environment image built with ansible-builder
- What is an Ansible Collection? → A packaged bundle of roles, modules, plugins, and playbooks distributed as a single unit
- How has digital technology transformed Ansible Automation practice? → It has enhanced data collection, analysis, communication, and operational efficiency
- Which ansible-playbook flag runs only tasks that are tagged with a specific tag? → --tags
- What is the risk of disabling SSH host key checking (`ANSIBLE_HOST_KEY_CHECKING=False`) in production? → Vulnerability to man-in-the-middle attacks
- Which keyword forces a task to run only once regardless of how many hosts are targeted? → run_once
Turn these facts into recall:
Was this helpful?