Ansible Automation Technology & Digital Applications 5 — Questions and Answers
Question 1: What is the purpose of Ansible's 'lookup' plugins?
- Retrieve data from external sources like files, databases, or APIs for use in playbooks (Correct answer)
- Look up module documentation from the command line
- Search inventory for matching hostnames
- Find and display task results in real time
Correct answer: Retrieve data from external sources like files, databases, or APIs for use in playbooks
Lookup plugins fetch data from external sources (files, environment variables, HashiCorp Vault, etc.) and return values that can be used as variable data in playbooks.
Question 2: In Ansible automation, what does 'idempotency' mean for technology operations teams?
- Running the same playbook multiple times produces the same result without unintended side effects (Correct answer)
- Tasks execute only once per host regardless of play count
- Each task must wait for the previous one to complete
- Playbooks can only be run during maintenance windows
Correct answer: Running the same playbook multiple times produces the same result without unintended side effects
Idempotency means a playbook can be applied repeatedly and will only make changes when the current state differs from the desired state, preventing configuration drift.
Question 3: Which Ansible tool analyzes playbooks for common mistakes, style issues, and best practice violations?
- ansible-lint (Correct answer)
- ansible-check
- playbook-validator
- ansible-audit
Correct answer: ansible-lint
ansible-lint scans playbooks and roles for rule violations, deprecated syntax, and best practice issues to improve code quality before execution.
Question 4: What mechanism does Ansible use to notify administrators of task failures in automated pipelines?
- Callback plugins that can send alerts to Slack, email, or monitoring systems (Correct answer)
- Built-in SMTP client in each module
- Automatic PagerDuty integration
- Log files written to /var/log/ansible only
Correct answer: Callback plugins that can send alerts to Slack, email, or monitoring systems
Callback plugins intercept playbook events (task failure, play complete) and can forward notifications to external systems like Slack, Splunk, or monitoring platforms.
Question 5: When managing heterogeneous environments, how does Ansible handle different OS families with a single playbook?
- Using 'when' conditions with ansible_os_family or ansible_distribution facts (Correct answer)
- Writing separate playbooks for each OS
- Using the 'multi_os' module parameter
- Requiring all hosts to run the same OS
Correct answer: Using 'when' conditions with ansible_os_family or ansible_distribution facts
Conditional 'when' clauses using gathered facts like ansible_os_family allow a single playbook to branch logic for different operating systems (RedHat, Debian, Windows, etc.).
Question 6: What is the advantage of using Ansible's 'block' keyword with 'rescue' and 'always' sections?
- Provides structured error handling similar to try/catch/finally for groups of tasks (Correct answer)
- Blocks tasks from running on specified hosts
- Groups tasks for parallel execution
- Prevents tasks from being interrupted by handlers
Correct answer: Provides structured error handling similar to try/catch/finally for groups of tasks
The block/rescue/always structure lets you group tasks, define fallback actions on failure (rescue), and ensure cleanup tasks always run regardless of outcome.
Question 7: Which approach best describes Ansible's agentless architecture advantage in enterprise digital environments?
- No software installation required on managed nodes — only SSH and Python are needed (Correct answer)
- A lightweight agent under 1MB is installed automatically on first run
- Managed nodes pull configuration from a central server on a schedule
- Agents are deployed via the ansible-agent package from Galaxy
Correct answer: No software installation required on managed nodes — only SSH and Python are needed
Ansible's agentless design means only an SSH connection and Python interpreter are required on managed nodes, eliminating agent installation, updates, and security patching overhead.
What is the purpose of Ansible's 'lookup' plugins?