live chatMcAfee Secure sites help keep you safe from identity theft, credit card fraud, spyware, spam, viruses and online scams
Pass4Test 10%OFF Discount Code

RedHat Red Hat Certified Specialist in Developing Automation with Ansible Automation Platform - EX374 Exam Questions

QUESTION NO: 1
Extract all IP addresses from a list containing mixed data using a filter.
Correct Answer:
- name: Filter IP addresses hosts: localhost
vars:
mixed_data: ["192.168.1.1", "hello", "10.0.0.2", "world"] tasks:
- name: Extract IPs debug:
var: "{{ mixed_data | select('ipaddr') | list }}"
Explanation:
The select filter with ipaddr identifies and extracts valid IP addresses from a mixed data list.
QUESTION NO: 2
Override the default user for all hosts in the web_servers group.
Correct Answer:
echo "ansible_user: webadmin" > group_vars/web_servers.yml
Explanation:
Defining group-level variables overrides individual host settings, ensuring uniformity across similar hosts.
QUESTION NO: 3
Verify if the EE meets security compliance standards.
Correct Answer:
podman scan my_execution_env:1.0
Explanation:
The podman scan command checks for vulnerabilities in the EE image, ensuring it meets security standards.
QUESTION NO: 4
Create a role in the collection to configure an Apache web server.
Correct Answer:
ansible-galaxy init roles/apache --collection my_namespace.my_collection
Explanation:
The ansible-galaxy init command creates a skeleton role within the specified collection, which can be customized to configure the Apache web server.
QUESTION NO: 5
Test the connectivity of managed nodes from within the EE.
Correct Answer:
podman run --rm -v $(pwd):/workspace -w /workspace my_execution_env:1.0 ansible all -m ping -i inventory.yml
Explanation:
Testing connectivity from within the EE ensures that the environment can interact with managed nodes correctly.
QUESTION NO: 6
Set up a schedule to update EEs in Automation Controller.
Correct Answer:
1. Go to Schedules in Automation Controller.
2. Create a schedule for the Execution Environment Sync.
3. Set the frequency to match organizational update policies.
Explanation:
Scheduling updates ensures EEs are always up-to-date with the latest dependencies and fixes.
QUESTION NO: 7
Execute a task on multiple delegated hosts using a loop.
Correct Answer:
- name: Delegate to multiple hosts hosts: web1
tasks:
- name: Ping multiple hosts ping:
delegate_to: "{{ item }}" with_items:
- db1
- db2
Explanation:
The loop iterates over a list of hosts and delegates the ping task to each, verifying connectivity for multiple targets.
QUESTION NO: 8
Transform a list of strings to uppercase using a filter and display the result.
Correct Answer:
- name: Convert to uppercase hosts: localhost
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.
QUESTION NO: 9
Publish the collection to Ansible Galaxy.
Correct Answer:
ansible-galaxy collection publish my_namespace-my_collection-1.0.0.tar.gz --api-key <your_galaxy_api_key>
Explanation:
The publish command uploads the collection to Ansible Galaxy, making it accessible to the community or other users.
QUESTION NO: 10
Verify the installed collections on your system.
Correct Answer:
ansible-galaxy collection list
Explanation:
The list command displays all installed collections, confirming the availability of required collections.
QUESTION NO: 11
List all running containers for EE jobs on the control node.
Correct Answer:
podman ps --filter "ancestor=my_execution_env:1.0"
Explanation:
Listing running containers helps monitor active EE instances and ensures they are functioning as expected.
QUESTION NO: 12
Run a command on db1 but store the results in the context of web1.
Correct Answer:
- name: Store delegated results hosts: web1
tasks:
- name: Get uptime from db1
command: uptime
delegate_to: db1
register: db1_uptime
- name: Display uptime debug:
var: db1_uptime
Explanation:
The register variable captures the results of a delegated task, storing them within the current host's context for further processing.
QUESTION NO: 13
Use your custom filter in a playbook to transform text.
Correct Answer:
# playbook.yml
- name: Use custom filter hosts: localhost
tasks:
- name: Transform text debug:
msg: "{{ 'ansible' | my_namespace.my_collection.my_filter }}"
Explanation:
Testing the custom filter ensures it integrates seamlessly with the collection and provides the expected output.