
Free Sales Ending Soon - Use Real EX374 PDF Questions [Dec 19, 2025]
Updated Dec-2025 Exam EX374 Dumps - Pass Your Certification Exam
NEW QUESTION # 117
List all running containers for EE jobs on the control node.
Answer:
Explanation:
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.
NEW QUESTION # 118
Update credentials for a dynamic inventory in Automation Controller.
Answer:
Explanation:
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.
NEW QUESTION # 119
Validate if a string matches a specific regular expression.
Answer:
Explanation:
- name: Validate string hosts: localhost vars:
text: "ansible_123" tasks:
- name: Check format fail:
msg: "String format invalid"
when: not text is match('^ansible_[0-9]+$')
Explanation:
The match filter evaluates whether a string adheres to a regex pattern, enforcing data consistency.
NEW QUESTION # 120
Extract all subnets from a list of CIDR notations using a filter.
Answer:
Explanation:
- name: Extract subnets hosts: localhost
vars: cidr_list:
- "192.168.1.0/24"
- "10.0.0.0/16"
tasks:
- name: Get subnets debug:
var: "{{ cidr_list | map('ipaddr', 'network') | list }}"
Explanation:
The ipaddr filter processes each CIDR notation to extract its network address, transforming raw input into structured data.
NEW QUESTION # 121
Use the EE to execute a playbook that requires an external library not in the base image.
Answer:
Explanation:
1. Update requirements.yml:
python:
- name: requests version: ">=2.25.0"
2. Rebuild the EE:
ansible-builder build --tag my_execution_env:1.1
3. Run the playbook:
podman run --rm -v $(pwd):/workspace -w /workspace my_execution_env:1.1 ansible-playbook site.yml
Explanation:
Adding external libraries ensures compatibility with modules requiring additional dependencies.
NEW QUESTION # 122
Write a playbook to use the lookup plugin to retrieve a secret from a file.
Answer:
Explanation:
- name: Retrieve secret hosts: localhost tasks:
- name: Get secret set_fact:
secret: "{{ lookup('file', '/etc/secret.key') }}"
- debug:
var: secret
Explanation:
Using lookup with the file plugin securely retrieves sensitive information from external files.
NEW QUESTION # 123
Inspect the logs of an EE build process.
Answer:
Explanation:
podman logs $(podman ps -aq --filter ancestor=my_execution_env:1.0)
Explanation:
Inspecting logs helps troubleshoot issues that occur during the build process, ensuring a functional EE.
NEW QUESTION # 124
Set up a database query as a dynamic inventory source.
Answer:
Explanation:
# db_inventory.py import sqlite3, json
connection = sqlite3.connect("inventory.db")
cursor = connection.cursor()
cursor.execute("SELECT hostname, ip FROM hosts")
inventory = {"all": {"hosts": {}}}
for row in cursor.fetchall():
inventory["all"]["hosts"][row[0]] = {"ansible_host": row[1]}
print(json.dumps(inventory))
Explanation:
Dynamic inventory from a database ensures inventories are generated based on up-to-date information stored in the database.
NEW QUESTION # 125
Implement a loop using a dictionary and display each key-value pair.
Answer:
Explanation:
- name: Loop through dictionary hosts: localhost
vars:
services: nginx: running mysql: stopped
tasks:
- name: Display service statuses debug:
msg: "Service {{ item.key }} is {{ item.value }}" with_dict: "{{ services }}"
Explanation:
The with_dict loop iterates over dictionary key-value pairs, allowing operations on each pair individually.
NEW QUESTION # 126
Copy a file to all hosts in a group from the control node using delegation.
Answer:
Explanation:
- name: Copy file to all hosts hosts: localhost
tasks:
- name: Copy file copy:
src: /tmp/example.txt
dest: /tmp/example.txt delegate_to: "{{ item }}" with_items: "{{ groups['all'] }}"
Explanation:
Using delegate_to with a loop and groups['all'], the file is copied from the control node to all hosts in the inventory.
NEW QUESTION # 127
Extract all IP addresses from a list containing mixed data using a filter.
Answer:
Explanation:
- 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.
NEW QUESTION # 128
Write a playbook to verify if all hosts in the staging group have an accessible HTTP port (http_port).
Answer:
Explanation:
- name: Verify HTTP port hosts: staging
tasks:
- debug:
msg: "Host {{ inventory_hostname }} is using HTTP port {{ http_port }}"
Explanation:
Playbooks accessing group variables verify configurations, such as application ports, across a group.
NEW QUESTION # 129
Run a task on localhost but save its output in the context of web1.
Answer:
Explanation:
- name: Local execution with remote context hosts: web1
tasks:
- name: Execute locally
command: echo "Local task output"
delegate_to: localhost
register: local_output
- name: Display output debug:
var: local_output
Explanation:
This setup retains control node task output within the delegating host's scope, enabling contextual analysis.
NEW QUESTION # 130
Run a playbook on web1 with a specific ansible_connection type.
Answer:
Explanation:
# host_vars/web1.yml ansible_connection: ssh
Explanation:
The ansible_connection variable defines the protocol for communicating with hosts, useful for automation adjustments.
NEW QUESTION # 131
Create SSH machine credentials to access inventory hosts.
Answer:
Explanation:
ansible-vault create ssh_creds.yml
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.
NEW QUESTION # 132
Write a Dockerfile for building the EE.
Answer:
Explanation:
# context/Dockerfile
FROM quay.io/ansible/ansible-runner:latest
COPY requirements.yml /tmp/requirements.yml
RUN ansible-galaxy collection install -r /tmp/requirements.yml
RUN pip install -r /tmp/requirements.yml
Explanation:
The Dockerfile defines the EE's base image and installs the required collections and Python packages.
NEW QUESTION # 133
Integrate a webhook with Automation Controller to trigger a job.
Answer:
Explanation:
1. Go to Job Templates and enable Webhook.
2. Configure the webhook URL in an external system.
Explanation:
Webhooks enable external triggers for jobs, facilitating integration with CI/CD pipelines or monitoring tools.
NEW QUESTION # 134
......
EX374 Dumps To Pass Red Hat Certified Specialist Exam in One Day: https://prep4sure.dumpexams.com/EX374-vce-torrent.html