Ansible Automation Technology & Digital Applications 2 — Questions and Answers
Question 1: Which Ansible module is used to manage Docker containers on remote hosts?
- docker_container (Correct answer)
- container_manage
- docker_run
- ansible_docker
Correct answer: docker_container
The docker_container module manages the lifecycle of Docker containers including creating, starting, stopping, and removing them.
Question 2: What is the purpose of Ansible Tower's (AWX) workflow templates?
- Chain multiple job templates with conditional logic (Correct answer)
- Store encrypted credentials
- Define inventory sources
- Schedule recurring playbook runs
Correct answer: Chain multiple job templates with conditional logic
Workflow templates in Ansible Tower/AWX allow chaining multiple job templates with success, failure, and always conditions to create complex automation pipelines.
Question 3: In Ansible, what does the 'delegate_to' keyword accomplish?
- Runs a task on a different host than the current target (Correct answer)
- Passes variables to child playbooks
- Delegates role execution to a secondary role
- Assigns task ownership to a specific user
Correct answer: Runs a task on a different host than the current target
The delegate_to directive redirects a specific task to execute on a different host while still using the current host's variables.
Question 4: Which cloud provider module collection would you use to provision an AWS EC2 instance with Ansible?
- amazon.aws (Correct answer)
- ansible.aws
- cloud.amazon
- aws.ansible
Correct answer: amazon.aws
The amazon.aws collection contains modules like ec2_instance for managing AWS resources including EC2 instances.
Question 5: What technology does Ansible use to communicate with Windows hosts by default?
- WinRM (Correct answer)
- SSH
- RDP
- DCOM
Correct answer: WinRM
Ansible uses WinRM (Windows Remote Management) as the default connection method for managing Windows hosts.
Question 6: Which Ansible module would you use to apply a Kubernetes manifest file to a cluster?
- kubernetes.core.k8s (Correct answer)
- ansible.k8s.apply
- k8s_manifest
- kubectl_apply
Correct answer: kubernetes.core.k8s
The kubernetes.core.k8s module manages Kubernetes objects by applying manifest files or inline resource definitions to a cluster.
Question 7: When using Ansible with CI/CD pipelines, what is the recommended way to pass secrets like API keys?
- Ansible Vault encrypted variables passed via environment (Correct answer)
- Hardcode them in the playbook for speed
- Store them in plaintext inventory files
- Embed them in role defaults
Correct answer: Ansible Vault encrypted variables passed via environment
Secrets should be encrypted with Ansible Vault and passed through environment variables or vault password files in CI/CD pipelines.
Which Ansible module is used to manage Docker containers on remote hosts?