Intermediate Ansible test (Intermediate)
30 questions · 35 minutes · Free
Roles, templates, handlers and vault.
Take the Intermediate Ansible test
What it covers
- Roles
- Jinja2 templates
- Handlers
- Ansible Vault
- Conditionals and loops
Interview format
- Questions: 30 questions — 18 multiple choice, 12 multi-answer
- Time: 35 minutes, timed from the first question
- Difficulty: Intermediate
- Skill area: DevOps & cloud
- Price: Free
Earn a certificate
The Intermediate Ansible test is one of the 8 tests of the DevOps Engineer: Intermediate learning path. Pass it and the other 7 tests at 70% or more and readyforhires issues you a verifiable certificate in your name, with its own code and verify link to share or add to LinkedIn.
Sample questions
5 sample questions from the Intermediate Ansible test, with the answers. Samples are taken out of the live test, so you will not meet these when you sit it.
Which statement accurately describes how Ansible Vault encrypts variables?
- Ansible Vault does not support encryption and relies on environment variables for security.
- Ansible Vault uses RSA encryption for encrypting variables.
- Ansible Vault encrypts variables using AES-256 encryption, ensuring secure storage and transmission of sensitive data.
- Ansible Vault encrypts variables using SHA-256 for secure storage.
Answer: C. Ansible Vault encrypts variables using AES-256 encryption, ensuring secure storage and transmission of sensitive data.
Ansible Vault uses AES-256 encryption to protect sensitive data, which is a strong and widely accepted encryption standard. This ensures that variables are securely stored and only accessible to those who possess the correct decryption password. Other options may suggest incorrect encryption methods or unrelated features.
What is the behavior of Ansible Vault when encrypting task parameters?
- Ansible Vault only encrypts the file names of tasks, not the contents of the parameters themselves.
- Ansible Vault automatically decrypts all encrypted task parameters without requiring any user input.
- Ansible Vault encrypts task parameters at runtime, but the decryption process is handled automatically by the system.
- Ansible Vault encrypts the contents of a task parameter, making it unreadable unless the correct decryption password is provided during playbook execution.
Answer: D. Ansible Vault encrypts the contents of a task parameter, making it unreadable unless the correct decryption password is provided during playbook execution.
Ansible Vault encrypts the contents of a task parameter, making it unreadable unless the correct decryption password is provided during playbook execution. This ensures that sensitive information such as passwords or API keys is protected. Other options may describe unrelated behaviors or features of Ansible, but they do not accurately reflect how Ansible Vault encrypts task parameters.
When should you use 'delegate_to' and 'local_action' for task delegation in Ansible roles, and what are their respective purposes?
- Use 'delegate_to' to execute on the control machine and 'local_action' to execute on a remote host.
- Use 'run_on' to execute on a remote host and 'run_locally' to execute on the control machine.
- Use 'run_on' to specify the host group and 'run_locally' to execute on the control machine.
- Use 'delegate_to' to run the task on a specific host, and 'local_action' to run the task on the control machine.
Answer: D. Use 'delegate_to' to run the task on a specific host, and 'local_action' to run the task on the control machine.
The 'delegate_to' keyword is used to specify a particular host on which a task should be executed, while 'local_action' is used to execute a task on the control machine (the machine running Ansible). These are appropriate for different scenarios: 'delegate_to' is used when a task needs to be run on a specific remote host, whereas 'local_action' is used for tasks that should be executed on the control node, such as when interacting with the local file system or using modules that are not available on remote hosts.
Which of the following statements best describes Ansible's support for nested loops?
- Ansible supports nested loops through the use of custom modules, but not through Jinja2 templates.
- Ansible does not support nested loops directly, but can be achieved using nested loop constructs in Jinja2 templates.
- Ansible supports nested loops directly in playbooks without any additional tools.
- Ansible only supports single-level loops and does not allow for any form of nesting.
Answer: B. Ansible does not support nested loops directly, but can be achieved using nested loop constructs in Jinja2 templates.
Ansible supports nested loops through the use of Jinja2 templates, which allow for complex loop structures. However, Ansible itself does not have built-in support for nested loops in playbooks. The other options are incorrect because they either describe features that do not exist or are not accurate representations of Ansible's capabilities.
Which statement accurately describes how handler task registration works in Ansible?
- Handlers run automatically at the start of every play, regardless of task status.
- Handlers are tasks that run only when notified by a task that reports 'changed'.
- Handlers are executed before any other tasks in the play, even if no tasks notify them.
- Handlers are triggered by any task, regardless of whether it reports 'changed' or 'ok'.
Answer: B. Handlers are tasks that run only when notified by a task that reports 'changed'.
Handlers are specifically designed to run only when a task that notifies them reports a 'changed' status. This ensures that handlers are only executed when necessary, such as when a configuration file has been modified and a service needs to be restarted or reloaded. Other options may describe general task behavior or unrelated Ansible features, but they are not accurate descriptions of how handler task registration works.
Frequently asked questions
- How many questions are in the Intermediate Ansible test?
- 30 questions (18 multiple choice, 12 multi-answer), with 35 minutes to answer them.
- What does the Intermediate Ansible test cover?
- Roles, Jinja2 templates, Handlers, Ansible Vault, Conditionals and loops.
- Is the Intermediate Ansible test free?
- Yes. It is free to take with a readyforhires account.
- What level is the Intermediate Ansible test?
- Intermediate, in DevOps & cloud.