FREE RHCE Automation and Deployment Questions and Answers

0%

Which configurations in ansible.cfg are used for privilege escalation?

Correct! Wrong!

*become: Specifies the method of privilege escalation.
*become_method: Defines how Ansible should escalate privileges (e.g., sudo, su).
*become_user: Specifies the user to become when escalating privileges.
*become_ask_pass: Determines whether Ansible should prompt for a password when escalating privileges.

These configurations are crucial for managing tasks that require elevated privileges on managed hosts using Ansible.

What command syntax is used to perform a syntax check on an Ansible playbook?

Correct! Wrong!

* ansible-playbook: Command used to run Ansible playbooks.
* --syntax-check: Option used to perform a syntax check on the playbook without executing tasks.
* playbook.yml: Specifies the YAML file containing the Ansible playbook.

This command is essential for validating the syntax of Ansible playbooks before deployment, ensuring that the playbook structure and syntax are correct. Understanding how to verify playbook syntax helps in maintaining playbook reliability and correctness during automation tasks.

What command syntax is used to perform a dry run (check mode) of an Ansible playbook without making changes?

Correct! Wrong!

* -C or --check: Option used to run Ansible playbook in check mode or dry run mode.
* ansible-playbook: Command used to execute Ansible playbooks.
* playbook.yml: Specifies the YAML file containing the Ansible playbook.

In check mode (-C), Ansible will simulate the playbook execution and report changes that would occur without actually applying them. This is useful for verifying the impact of playbook changes before executing them. Understanding how to safely test playbook changes helps ensure system stability and reliability during automation tasks.

How do you save the output from an Ansible module to a variable?

Correct! Wrong!

* register: Ansible keyword used to capture the output of a module.
* var_name: Name of the variable where the module output will be stored.

This technique allows Ansible playbooks to store the result of module executions for subsequent tasks or conditional checks.
Understanding how to use the register is crucial for effective playbook automation and management.

How do you output or display the value of a variable in Ansible?

Correct! Wrong!

* debug: Ansible module used to display the value of variables or other information during playbook execution.
* var: Parameter within the debug module that specifies the variable name to be displayed.

This method helps troubleshoot playbook execution by showing the current values of variables. Understanding how to effectively use debug ensures proper management and validation of variables within Ansible playbooks.

What keyword is used for looping over a list (which can be a variable) in Ansible?

Correct! Wrong!

The loop keyword in Ansible is used to iterate over a list or a variable containing a list.
It allows tasks to be repeated for each item in the list, enabling efficient automation of repetitive tasks.

Which Ansible configuration groups are commonly used to define default settings and privilege escalation options?

Correct! Wrong!

* [defaults] is a standard Ansible configuration group that defines default settings for tasks, such as module paths and inventory locations.
* [privilege_escalation] is a configuration group that includes settings related to privilege escalation, such as settings for running tasks with elevated privileges.

Understanding these Ansible configuration groups is crucial for configuring Ansible to manage systems effectively, especially concerning default behaviors and security-related operations.

Premium Tests $49/mo
FREE February-2025