최신RedHat Red Hat Certified Specialist in Developing Automation with Ansible Automation Platform - EX374무료샘플문제
문제1
Build the execution environment image using Podman.
Build the execution environment image using Podman.
정답:
cd my_execution_env
podman build -t my_execution_env:1.0 -f context/Dockerfile .
Explanation:
The podman build command creates a container image based on the Dockerfile, packaging all dependencies and configurations.
podman build -t my_execution_env:1.0 -f context/Dockerfile .
Explanation:
The podman build command creates a container image based on the Dockerfile, packaging all dependencies and configurations.
문제2
Test the inventory in Automation Controller.
Test the inventory in Automation Controller.
정답:
1. Select the inventory in Automation Controller.
2. Click Sync to fetch the latest data from the dynamic source.
Explanation:
Sync tests validate the integration of dynamic inventories in Automation Controller.
2. Click Sync to fetch the latest data from the dynamic source.
Explanation:
Sync tests validate the integration of dynamic inventories in Automation Controller.
문제3
Use block to group tasks and apply privilege escalation only to the group.
Use block to group tasks and apply privilege escalation only to the group.
정답:
- name: Block example hosts: all
tasks:
- block:
- name: Update package cache apt:
update_cache: yes
- name: Install nginx
apt:
name: nginx
state: present
become: yes
Explanation:
Blocks apply common parameters like become to grouped tasks, reducing repetition and improving clarity.
tasks:
- block:
- name: Update package cache apt:
update_cache: yes
- name: Install nginx
apt:
name: nginx
state: present
become: yes
Explanation:
Blocks apply common parameters like become to grouped tasks, reducing repetition and improving clarity.
문제4
Configure your environment to automatically include your collection in Ansible's search path.
Configure your environment to automatically include your collection in Ansible's search path.
정답:
export ANSIBLE_COLLECTIONS_PATHS=~/.ansible/collections:/custom_path/collections
Explanation:
Setting the ANSIBLE_COLLECTIONS_PATHS environment variable ensures custom collection directories are included in the search path.
Explanation:
Setting the ANSIBLE_COLLECTIONS_PATHS environment variable ensures custom collection directories are included in the search path.
문제5
Stash uncommitted changes to the feature-update branch temporarily.
Stash uncommitted changes to the feature-update branch temporarily.
정답:
git stash
Explanation:
Stashing saves the current working directory state, enabling temporary storage and later retrieval.
Explanation:
Stashing saves the current working directory state, enabling temporary storage and later retrieval.
문제6
Create an inventory that uses AWS EC2 tags to group hosts.
Create an inventory that uses AWS EC2 tags to group hosts.
정답:
plugin: aws_ec2
regions:
- us-west-2 keyed_groups:
- key: tags.Name prefix: tag_
Explanation:
Using AWS EC2 tags to group hosts allows dynamic organization of cloud resources in inventories.
regions:
- us-west-2 keyed_groups:
- key: tags.Name prefix: tag_
Explanation:
Using AWS EC2 tags to group hosts allows dynamic organization of cloud resources in inventories.
문제7
Set up a schedule to update EEs in Automation Controller.
Set up a schedule to update EEs in Automation Controller.
정답:
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.
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.
문제8
Deploy an EE to Kubernetes for distributed execution.
Deploy an EE to Kubernetes for distributed execution.
정답:
1. Push the EE image to a container registry accessible by Kubernetes:
podman push my_execution_env:1.0 registry.example.com/my_execution_env:1.0
2. Create a Kubernetes Pod configuration:
apiVersion: v1
kind: Pod
metadata:
name: ansible-execution
spec:
containers:
- name: execution-env
image: registry.example.com/my_execution_env:1.0
command: ["ansible-playbook", "site.yml"]
volumeMounts:
- name: workspace mountPath: /workspace
volumes:
- name: workspace hostPath:
path: /path/to/workspace
3. Apply the configuration:
kubectl apply -f execution_env_pod.yaml
Explanation:
Deploying an EE to Kubernetes allows for scalable and distributed playbook execution across a cluster.
podman push my_execution_env:1.0 registry.example.com/my_execution_env:1.0
2. Create a Kubernetes Pod configuration:
apiVersion: v1
kind: Pod
metadata:
name: ansible-execution
spec:
containers:
- name: execution-env
image: registry.example.com/my_execution_env:1.0
command: ["ansible-playbook", "site.yml"]
volumeMounts:
- name: workspace mountPath: /workspace
volumes:
- name: workspace hostPath:
path: /path/to/workspace
3. Apply the configuration:
kubectl apply -f execution_env_pod.yaml
Explanation:
Deploying an EE to Kubernetes allows for scalable and distributed playbook execution across a cluster.
문제9
Undo changes made to config.txt before staging the file.
Undo changes made to config.txt before staging the file.
정답:
git checkout -- config.txt
Explanation:
git checkout -- <file> reverts changes in the working directory to the last committed state.
Explanation:
git checkout -- <file> reverts changes in the working directory to the last committed state.
문제10
Verify the directory structure of an existing collection.
Verify the directory structure of an existing collection.
정답:
tree ~/.ansible/collections/ansible_collections/my_namespace/my_collection
Explanation:
The tree command provides a visual representation of the collection structure, ensuring proper organization.
Explanation:
The tree command provides a visual representation of the collection structure, ensuring proper organization.
문제11
Retrieve the hostname of a managed node using the ansible_hostname fact and display it.
Retrieve the hostname of a managed node using the ansible_hostname fact and display it.
정답:
- name: Get hostname hosts: all
tasks:
- name: Display hostname debug:
var: ansible_hostname
Explanation:
Using the ansible_hostname fact allows playbooks to dynamically adapt to each managed node's hostname.
tasks:
- name: Display hostname debug:
var: ansible_hostname
Explanation:
Using the ansible_hostname fact allows playbooks to dynamically adapt to each managed node's hostname.
문제12
Create a test directory for automated testing of your collection.
Create a test directory for automated testing of your collection.
정답:
mkdir -p my_namespace/my_collection/tests
echo "---
# Test cases" > my_namespace/my_collection/tests/test.yml
Explanation:
Adding a test directory ensures the collection can be validated through automated test cases.
echo "---
# Test cases" > my_namespace/my_collection/tests/test.yml
Explanation:
Adding a test directory ensures the collection can be validated through automated test cases.
문제13
Sync dynamic inventory with Automation Controller.
Sync dynamic inventory with Automation Controller.
정답:
1. Go to Inventories in Automation Controller.
2. Add a new inventory and set the source as Custom Script.
3. Upload the dynamic inventory script.
Explanation:
Syncing dynamic inventories with Automation Controller ensures up-to-date host management for jobs.
2. Add a new inventory and set the source as Custom Script.
3. Upload the dynamic inventory script.
Explanation:
Syncing dynamic inventories with Automation Controller ensures up-to-date host management for jobs.