Red Hat Certified Specialist in Developing Automation with Ansible Automation Platform exam 試験
最新更新時間: 2026/09/21
【秋学習応援セール|10月限定キャンペーン】:EX374 最新真題を買う時、日本語版と英語版両方を同時に獲得できます。
実際の問題集を練習し、試験のポイントを了解し、テストに申し込むするかどうかを決めることができます。
さらに試験準備時間の35%を節約するには、EX374 問題集を使用してください。
Question No : 1
Set up an inventory file to assign a unique hostname to a host while using a different IP address for SSH connections.
正解: # inventory.yml
web1:
ansible_host: 192.168.1.10
hostname: web1.example.com
Explanation:
Using ansible_host for SSH and a custom variable like hostname enables flexible host identification for different use cases.
Question No : 2
Write a playbook to verify if all hosts in the staging group have an accessible HTTP port (http_port).
正解: - 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.
Question No : 3
Create a custom directory for inventory files and use it during a playbook execution.
正解: mkdir -p custom_inventory
echo "[web_servers]" > custom_inventory/inventory.ini
echo "web1 ansible_host=192.168.1.10" >> custom_inventory/inventory.ini ansible-playbook -i custom_inventory playbook.yml
Explanation:
Custom inventory directories organize host definitions for easier management, especially in large-scale deployments.
Question No : 4
Override the default SSH connection type for a host in the inventory to use paramiko.
正解: echo "ansible_connection: paramiko" > host_vars/web1.yml
Explanation:
The ansible_connection variable specifies the connection backend, useful for handling specific infrastructure constraints.
Question No : 5
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.
Question No : 6
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.
Question No : 7
Configure a playbook to dynamically retrieve the ansible_host variable of a host and display it.
正解: # playbook.yml
- name: Retrieve ansible_host hosts: web1
tasks:
- debug:
var: ansible_host
Explanation:
Dynamic variable retrieval helps validate host-level settings such as IP addresses or DNS names.
Question No : 8
Split db1 variables into multiple files: db1_connection.yml and db1_settings.yml. Include connection details and custom database settings.
正解: echo "ansible_user: dbadmin" > host_vars/db1_connection.yml
echo "db_name: my_database" > host_vars/db1_settings.yml
Explanation:
Splitting variables into logical files enhances modularity and improves clarity for managing complex configurations.
Question No : 9
Create a playbook to override the default inventory SSH port by using a special variable at runtime.
正解: # playbook.yml
- name: Test connection with overridden SSH port hosts: web1
tasks:
- ping:
Execution:
ansible-playbook -i inventory.yml playbook.yml -e "ansible_port=2022"
Explanation:
Passing ansible_port as an extra variable ensures runtime overrides without altering the inventory.
Question No : 10
Configure a host db1 to use a specific username dbadmin and SSH key ~/.ssh/db_key. Ensure this is applied via host_vars.
正解: mkdir -p host_vars
echo "ansible_user: dbadmin" > host_vars/db1.yml
echo "ansible_ssh_private_key_file: ~/.ssh/db_key" >> host_vars/db1.yml
Explanation:
Using host_vars allows granular control of variables, such as user credentials and SSH keys, for individual hosts.
Question No : 11
Set up an inventory file to manage hosts using different SSH keys.
正解: # host_vars/web1.yml
ansible_ssh_private_key_file: ~/.ssh/web1_key
Explanation:
Defining ansible_ssh_private_key_file ensures secure, host-specific authentication, vital for multi-host environments.
Question No : 12
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.
Question No : 13
Create an inventory to manage multiple environments like staging and production.
正解: # inventory.yml
staging:
hosts:
web1:
ansible_host: 192.168.1.11 production:
hosts:
web1:
ansible_host: 192.168.1.20
Explanation:
Environment-specific inventories simplify deployments and maintenance across diverse infrastructure setups.
Question No : 14
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.
Question No : 15
Run a playbook on web1 with a specific ansible_connection type.
正解: # host_vars/web1.yml ansible_connection: ssh
Explanation:
The ansible_connection variable defines the protocol for communicating with hosts, useful for automation adjustments.