Ansible Automation Professional Standards & Competencies 5 — Questions and Answers
Question 1: What professional competency is demonstrated by writing a custom Ansible module in Python rather than using shell commands?
- Preference for Python over YAML
- Delivering idempotent, well-documented, testable automation that integrates natively with Ansible's reporting (Correct answer)
- Avoiding Galaxy dependencies
- Bypassing Ansible's variable system
Correct answer: Delivering idempotent, well-documented, testable automation that integrates natively with Ansible's reporting
Custom modules handle state checking, return structured JSON results, and integrate with Ansible's changed/failed reporting in ways shell cannot.
Question 2: An Ansible professional is onboarding a new team member. Which resource should they point to for authoritative best-practice guidance?
- Stack Overflow top-voted answers
- The official Ansible documentation and Ansible Best Practices guide at docs.ansible.com (Correct answer)
- Older blog posts from before Ansible 2.0
- The ansible-examples GitHub repository exclusively
Correct answer: The official Ansible documentation and Ansible Best Practices guide at docs.ansible.com
The official Ansible documentation and best practices guide is maintained by Red Hat and reflects current standards for each release.
Question 3: What is the professional implication of using 'any_errors_fatal: true' at the play level?
- It suppresses all errors and forces the play to complete
- It stops the entire play on all hosts if any single host fails a task (Correct answer)
- It retries failed tasks automatically until they succeed
- It limits the play to one host at a time
Correct answer: It stops the entire play on all hosts if any single host fails a task
any_errors_fatal immediately aborts the play across all hosts when any host encounters a failure, preventing partial deployments.
Question 4: A professional Ansible practitioner receives a request to automate a process that changes frequently. What design approach best addresses maintainability?
- Hard-code all values in tasks so the logic is explicit
- Parameterize behavior through variables and roles so changes require only variable updates, not task rewrites (Correct answer)
- Write a new playbook for every process variation
- Use shell scripts for frequently changing logic
Correct answer: Parameterize behavior through variables and roles so changes require only variable updates, not task rewrites
Parameterization decouples configuration data from automation logic, making playbooks adaptable to change without structural rewrites.
Question 5: Which professional practice ensures that Ansible automation remains auditable in a regulated enterprise environment?
- Running all playbooks manually without logging
- Storing playbooks in version control, using AWX/Ansible Tower for execution, and retaining job logs (Correct answer)
- Deleting playbook run logs after each execution to save disk space
- Granting all operators root access to control nodes
Correct answer: Storing playbooks in version control, using AWX/Ansible Tower for execution, and retaining job logs
Version control plus a centralized execution platform like AWX provides change history, RBAC, and audit trails required for compliance.
Question 6: What is the professional standard for handling deprecated Ansible modules in existing playbooks?
- Ignore deprecation warnings; they do not affect functionality
- Update playbooks to use the replacement modules before the deprecated ones are removed in a future release (Correct answer)
- Pin the Ansible version permanently to avoid module changes
- Document deprecated usage and defer updates indefinitely
Correct answer: Update playbooks to use the replacement modules before the deprecated ones are removed in a future release
Proactively migrating to replacement modules prevents breakage during Ansible upgrades and maintains compatibility with current best practices.
Question 7: A professional Ansible engineer is asked to enforce consistent code style across a large team. Which tool combination is the industry standard?
- Manual peer review only
- ansible-lint for rule enforcement combined with yamllint for YAML formatting, integrated into CI/CD pipelines (Correct answer)
- Running playbooks in check mode as the primary style check
- Using shellcheck on all Ansible files
Correct answer: ansible-lint for rule enforcement combined with yamllint for YAML formatting, integrated into CI/CD pipelines
ansible-lint and yamllint together enforce Ansible-specific best practices and YAML formatting, and integrating them in CI ensures consistent standards across contributors.
What professional competency is demonstrated by writing a custom Ansible module in Python rather than using shell commands?