최신RedHat Red Hat Certified Specialist in Developing Automation with Ansible Automation Platform - EX374무료샘플문제
Create an inventory in Automation Controller using a dynamic inventory script.
o Source: Custom Script
o Script: Upload the inventory script (e.g., idm_inventory.py).
2. Sync the inventory.
Explanation:
Dynamic inventory scripts allow fetching host information from external systems like databases or cloud platforms.
Transform a list of strings to uppercase using a filter and display the result.
vars:
names: ["ansible", "automation"] tasks:
- name: Uppercase transformation debug:
var: "{{ names | map('upper') | list }}"
Explanation:
The map filter applies a transformation function, such as upper, to each element in a list, enabling bulk data modifications.
Package the collection into a .tar.gz file for distribution.
Explanation:
The build command packages the collection, creating a compressed file ready for sharing or publishing.
Extract the domain name from an email address using the regex_search filter.
vars:
email: "[email protected]" tasks:
- name: Get domain debug:
var: "{{ email | regex_search('@(.*)') }}"
Explanation:
The regex_search filter allows complex string manipulation by extracting specific patterns like domains from email addresses.
Set up an inventory file to manage hosts using different SSH keys.
ansible_ssh_private_key_file: ~/.ssh/web1_key
Explanation:
Defining ansible_ssh_private_key_file ensures secure, host-specific authentication, vital for multi-host environments.
Perform a delegated task to update firewall rules on a specific host.
tasks:
- name: Add firewall rule on db1
command: firewall-cmd --add-port=8080/tcp
delegate_to: db1
Explanation:
Delegating firewall rule updates ensures secure and host-specific configurations without unnecessary context switching.
Create a Vault file to store sensitive credentials for inventory hosts.
Add:
ansible_user: "admin"
ansible_password: "secure_password"
Explanation:
Storing sensitive data in an encrypted Vault file ensures it remains secure and inaccessible without proper authorization.
Analyze logs of an EE job run in Automation Controller.
2. Open the job details for the executed playbook.
3. View the logs for task outputs and errors.
Explanation:
Job logs provide insights into the execution flow and help debug issues within the EE.
Use an EE image to test an Ansible module.
Explanation:
Testing an Ansible module in the EE ensures compatibility and proper functionality in the runtime environment.
Verify the installed collections on your system.
Explanation:
The list command displays all installed collections, confirming the availability of required collections.
Create an inventory file inventory.yml with a host web1 and a group web_servers. Assign the variable ansible_user as admin for web1.
all:
children:
web_servers:
hosts:
web1:
ansible_user: admin
Explanation:
The inventory file assigns variables like ansible_user for specific hosts or groups. This configuration defines web1 under the web_servers group with admin as the remote user.
Override the default user for all hosts in the web_servers group.
Explanation:
Defining group-level variables overrides individual host settings, ensuring uniformity across similar hosts.
Create SSH machine credentials to access inventory hosts.
Add credentials:
ansible_user: "admin"
ansible_ssh_private_key_file: "~/.ssh/id_rsa"
Explanation:
Machine credentials stored in a Vault file ensure secure and consistent access to inventory hosts.