RedHat Red Hat Certified Specialist in Developing Automation with Ansible Automation Platform - EX374무료 덤프문제 풀어보기

Use delegation to upload a file to an S3 bucket from the control node.
정답:
- name: Upload to S3 hosts: web1 tasks:
- name: Upload file
command: aws s3 cp /tmp/example.txt s3://mybucket/
delegate_to: localhost
Explanation:
Delegating cloud operations to the control node centralizes cloud-related tasks, improving efficiency.
Use ansible_inventory to display host-specific variables.
정답:
ansible-inventory -i inventory.yml --host web1
Explanation:
This command retrieves detailed information about host variables, verifying correctness and debugging issues.
Run a playbook in check mode to simulate the changes it would make without applying them.
정답:
ansible-playbook -i inventory.yml playbook.yml --check
Explanation:
Check mode (--check) validates playbook logic without applying changes, providing a preview of the potential effects of execution.
Write a test playbook to call the custom module hello.py.
정답:
# test_hello.yml
- name: Test custom module hosts: localhost
tasks:
- name: Call hello module
my_namespace.my_collection.hello:
Explanation:
Testing custom modules ensures their proper implementation and usability within the collection.
Create a role in the collection to configure an Apache web server.
정답:
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.
Set up notifications for job completions in Automation Controller.
정답:
1. Navigate to Notifications.
2. Add a new notification:
o Type: Email, Slack, or Webhook.
o Configure details.
3. Link it to a job template.
Explanation:
Notifications provide immediate feedback on job status, improving monitoring and responsiveness.
Override the default user for all hosts in the web_servers group.
정답:
echo "ansible_user: webadmin" > group_vars/web_servers.yml
Explanation:
Defining group-level variables overrides individual host settings, ensuring uniformity across similar hosts.
Configure the inventory so that web1 has both IPv4 and IPv6 addresses and use them conditionally in a playbook.
정답:
# host_vars/web1.yml ansible_host: 192.168.1.10 ansible_ipv6_address: "2001:db8::1" Playbook:
- name: Use IPv4 or IPv6 hosts: web1
tasks:
- debug:
msg: "{{ ansible_ipv6_address if ansible_ipv6_address else ansible_host }}"
Explanation:
Defining multiple addresses and using conditional logic allows flexibility for dual-stack environments.
Use failed_when to define custom failure conditions for a task.
정답:
- name: Custom failure hosts: all
tasks:
- name: Fail if output is not 'success'
command: echo "fail"
register: output
failed_when: "'success' not in output.stdout"
Explanation:
The failed_when directive enables fine-grained control over failure conditions, improving playbook robustness.
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.
Validate the AWS inventory plugin.
정답:
ansible-inventory -i aws_ec2.yml --list
Explanation:
Validating the plugin confirms it retrieves and parses data correctly from AWS.
Write a playbook to use the lookup plugin to retrieve a secret from a file.
정답:
- 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.
Set up a cron job to sync a dynamic inventory script periodically.
정답:
crontab -e
Add:
0 * * * * ansible-inventory -i dynamic_inventory.py --list > inventory_cache.json
Explanation:
Automating inventory sync ensures up-to-date inventory data without manual intervention.
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.
Run a playbook in an EE using Ansible Automation Controller.
정답:
1. Log in to the Automation Controller web UI.
2. Go to Execution Environments and create a new EE entry using the image registry.example.com/my_execution_env:1.0.
3. Associate the EE with a Job Template and run the playbook.
Explanation:
Configuring the EE in the Automation Controller ensures playbooks run consistently across environments.

우리와 연락하기

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

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

서포트: 바로 연락하기 

English Deutsch 繁体中文 日本語