최신 EX374 무료덤프 - RedHat Red Hat Certified Specialist in Developing Automation with Ansible Automation Platform

Find the intersection of two lists using filters.
정답:
- name: Find common elements hosts: localhost
vars:
list1: [1, 2, 3]
list2: [3, 4, 5] tasks:
- name: Intersect lists debug:
var: "{{ list1 | intersect(list2) }}"
Explanation:
The intersect filter identifies common elements between lists, supporting comparative operations.
Execute a task on the control node only if a condition on web1 is met.
정답:
- name: Conditional delegation hosts: web1
tasks:
- name: Check file existence stat:
path: /tmp/flag.txt register: flag_check
- name: Notify control node
command: echo "Flag exists"
delegate_to: localhost
when: flag_check.stat.exists
Explanation:
Delegation combined with conditional logic ensures tasks are executed only under specific circumstances.
Create a playbook to skip tasks for hosts with ansible_distribution set to CentOS.
정답:
- name: Skip CentOS hosts: all
tasks:
- name: Run on non-CentOS debug:
msg: "This is not CentOS"
when: ansible_facts['distribution'] != "CentOS"
Explanation:
Skipping tasks based on conditions ensures compatibility and avoids unnecessary errors on unsupported hosts.
Verify the integrity of a built collection before publishing.
정답:
ansible-galaxy collection verify my_namespace-my_collection-1.0.0.tar.gz
Explanation:
The verify command ensures that the collection meets all required standards and is valid for publishing.
Test Automation Controller integration with Automation Hub.
정답:
1. Add Automation Hub credentials:
o URL: https://automation-hub.example.com/
o API Token: Provide your token.
2. Create a project with Automation Hub as the source.
3. Sync the project.
Explanation:
Testing integration verifies the connection to Automation Hub and the ability to pull content successfully.
Convert a dictionary into a list of key-value tuples.
정답:
- name: Dictionary to list hosts: localhost
vars:
my_dict: key1: value1
key2: value2
tasks:
- name: Convert dictionary debug:
var: "{{ my_dict | dict2items }}"
Explanation:
The dict2items filter transforms dictionaries into a list of key-value pairs, facilitating iteration.
Run a playbook in Automation Controller using an execution environment (EE).
정답:
1. Go to Execution Environments.
2. Add a new EE with the image: registry.example.com/my_execution_env:1.0.
3. Assign the EE to a job template and run the playbook.
Explanation:
Execution environments ensure consistent runtime environments for playbook execution.
Update credentials for a dynamic inventory in Automation Controller.
정답:
1. Navigate to Credentials.
2. Edit the associated credential.
3. Update the fields (e.g., username, password) and save.
Explanation:
Updating credentials ensures uninterrupted access to dynamic inventory sources, such as APIs or databases.
Configure a task to run as a specific user, admin, using the become_user directive.
정답:
- name: Execute as admin user hosts: all
tasks:
- name: List files
become: yes
become_user: admin
command: ls /home/admin
Explanation:
The become_user directive specifies which user to act as during a privileged task, useful for user-specific configurations or actions.
Retrieve and display a list of available files in a directory using the lookup plugin.
정답:
- name: List directory files hosts: localhost
tasks:
- name: Get files in directory set_fact:
files: "{{ lookup('pipe', 'ls /tmp') }}"
- debug:
var: files
Explanation:
The pipe lookup plugin executes shell commands, and here it lists files in /tmp. This data is stored in a variable for further processing.
Convert a list of strings to lowercase.
정답:
- name: Convert to lowercase hosts: localhost
vars:
items: ["Ansible", "Automation"] tasks:
- name: Lowercase list debug:
var: "{{ items | map('lower') | list }}"
Explanation:
The map filter applies the lower transformation to each string in a list, enabling consistent formatting.
Upload the EE to Red Hat Automation Hub.
정답:
ansible-builder push --tag automation-hub.example.com/my_execution_env:1.0
Explanation:
Uploading the EE to Automation Hub allows centralized management and sharing of the environment within an organization.
Validate if a given string ends with a specific suffix.
정답:
- name: Validate string suffix hosts: localhost
vars:
filename: "document.txt" tasks:
- name: Check suffix fail:
msg: "File does not end with .txt" when: not filename.endswith(".txt")
Explanation:
The endswith method ensures filenames conform to expected extensions or formats.

우리와 연락하기

문의할 점이 있으시면 메일을 보내오세요. 12시간이내에 답장드리도록 하고 있습니다.

근무시간: ( UTC+9 ) 9:00-24:00
월요일~토요일

서포트: 바로 연락하기