最新的RedHat Red Hat Certified Specialist in Developing Automation with Ansible Automation Platform - EX374免費考試真題

Transform a list of numbers by doubling each value.
正確答案:
- name: Double numbers in a list hosts: localhost
vars:
numbers: [1, 2, 3, 4] tasks:
- name: Transform list debug:
var: "{{ numbers | map('multiply', 2) | list }}"
Explanation:
Using the map filter with multiply applies transformations to each element in a list.
Configure db1 to use a specific shell for commands via a host variable.
正確答案:
echo "ansible_shell_type: bash" > host_vars/db1.yml
Explanation:
Defining ansible_shell_type ensures compatibility with the host's shell environment, avoiding errors during execution.
Create a plugin directory in your collection and add a custom module.
正確答案:
mkdir -p my_namespace/my_collection/plugins/modules echo -e "#!/usr/bin/python
print('Hello, world!')" > my_namespace/my_collection/plugins/modules/hello.py chmod +x my_namespace/my_collection/plugins/modules/hello.py
Explanation:
Adding a custom module extends the collection's functionality, allowing users to implement specific operations.
Split a string into a list of words using a filter.
正確答案:
- name: Split string hosts: localhost vars:
sentence: "Ansible is powerful" tasks:
- name: Split words debug:
var: "{{ sentence | split(' ') }}"
Explanation:
The split filter divides a string into a list based on a delimiter, enabling flexible text processing.
Run a delegated task to back up a database on a different host.
正確答案:
- name: Backup database hosts: web1
tasks:
- name: Run backup on db1
command: mysqldump -u root -p mydb > /tmp/mydb.sql
delegate_to: db1
Explanation:
Delegating database backups ensures the task is executed directly on the database server, reducing network overhead.
Write a playbook to retry a failed task up to three times.
正確答案:
- name: Retry task hosts: all
tasks:
- name: Retryable task
command: echo "Retry example"
retries: 3
delay: 5
until: false
Explanation:
The retries directive attempts task execution multiple times, useful for transient issues.
Set up an inventory where web1 and web2 belong to staging, while web3 belongs to production. Assign http_port as 8080 for staging.
正確答案:
# inventory.yml
staging:
hosts:
web1:
web2:
vars:
http_port: 8080
production:
hosts:
web3:
Explanation:
Group-level variables apply uniformly to all hosts within a group, ensuring consistent configurations across environments.
List all running containers for EE jobs on the control node.
正確答案:
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.
Check if a string starts with a specific prefix.
正確答案:
- name: Validate string prefix hosts: localhost
vars:
text: "ansible_automation" tasks:
- name: Check prefix fail:
msg: "Invalid prefix"
when: not text.startswith("ansible")
Explanation:
The startswith method ensures strings adhere to expected prefixes, enforcing naming conventions.
Test the connectivity to the Git repository in Automation Controller.
正確答案:
1. Go to the project in Automation Controller.
2. Click Sync and monitor for errors.
Explanation:
Syncing tests whether Automation Controller can connect to the repository and fetch content without issues.
Analyze logs of an EE job run in Automation Controller.
正確答案:
1. Navigate to Jobs 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.
Validate the CIDR format of a network address using a filter.
正確答案:
- name: Validate CIDR format hosts: localhost
vars:
cidr: "192.168.1.0/24" tasks:
- name: Ensure CIDR is valid fail:
msg: "Invalid CIDR format"
when: not cidr | ipaddr('network')
Explanation:
The ipaddr filter checks if a string is a valid network in CIDR notation, ensuring network data integrity.
Set up a project in Automation Controller to pull content from Automation Hub.
正確答案:
1. Go to Projects.
2. Create a new project:
o Name: Automation Hub Project
o Source Control Type: Automation Hub
o URL: https://automation-hub.example.com/
3. Sync the project.
Explanation:
Pulling content from Automation Hub ensures the latest roles and playbooks are available for use.
Use a dynamic inventory to filter hosts by a specific tag.
正確答案:
ansible-inventory -i aws_ec2.yml --host tag_web
Explanation:
Filtering hosts by tag ensures that only the relevant resources are targeted for playbook execution.
Schedule an EE-based job in Automation Controller.
正確答案:
1. Open a job template and navigate to Schedules.
2. Click Add and configure:
o Frequency: Daily
o Time: 12:00 PM.
3. Save the schedule.
Explanation:
Scheduling EEs ensures consistent task execution at regular intervals without manual intervention.

聯系我們

如果您有任何問題,請留下您的電子郵件地址,我們將在12小時內回复電子郵件給您。

我們的工作時間:( GMT 0:00-15:00 )
週一至週六

技術支持: 立即聯繫 

English 日本語 Deutsch 한국어