최신 EX374 무료덤프 - RedHat Red Hat Certified Specialist in Developing Automation with Ansible Automation Platform

Create a playbook to stop execution after encountering an error in any task.
정답:
- name: Stop on error hosts: all
tasks:
- name: Intentional failure
command: exit 1
ignore_errors: no
Explanation:
By default, Ansible stops on errors unless ignore_errors is set to yes. This ensures errors are addressed before proceeding.
Run a playbook in Automation Controller using an execution environment (EE).
정답:
1. Go to Execution Environments.
2. Add a new EE with the image: registry.example.com/my_execution_env:1.0.
3. Assign the EE to a job template and run the playbook.
Explanation:
Execution environments ensure consistent runtime environments for playbook execution.
Apply the stashed changes back to the feature-update branch.
정답:
git stash apply
Explanation:
Applying a stash retrieves the saved changes, allowing them to be continued from the stored state.
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.
Create a playbook to conditionally execute a task based on the presence of a file /tmp/example.
정답:
- name: Conditional execution
hosts: all
tasks:
- name: Create file if it exists
command: touch /tmp/created
when: ansible_facts['distribution'] == "Ubuntu"
Explanation:
Conditional execution using when ensures tasks run only under specific conditions, preventing unnecessary or incorrect operations.
Run a playbook in an EE with a custom inventory file.
정답:
podman run --rm -v $(pwd):/workspace -w /workspace my_execution_env:1.0 ansible-playbook -i custom_inventory.yml site.yml
Explanation:
Using a custom inventory file within the EE ensures that specific hosts are targeted during playbook execution.
Create an inventory plugin configuration for AWS.
정답:
plugin: aws_ec2
regions:
- us-east-1 keyed_groups:
- key: tags.Name prefix: tag_
Explanation:
Inventory plugins like aws_ec2 dynamically fetch hosts from cloud environments, ensuring accurate inventories.
Pull the EE image from the private container registry.
정답:
podman pull registry.example.com/my_execution_env:1.0
Explanation:
Pulling the image retrieves the EE from the registry, making it available locally for use in automation tasks.
Fetch a file from a managed node to the control node using delegation.
정답:
- name: Fetch file to control node hosts: web1
tasks:
- name: Retrieve file fetch:
src: /var/log/example.log
dest: /tmp/example.log
flat: yes
delegate_to: localhost
Explanation:
The fetch module retrieves files from a managed node to the control node, useful for collecting logs or artifacts.
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.
A teammate accidentally pushed sensitive data to the repository. Use an interactive rebase to remove the commit containing the sensitive data.
정답:
git rebase -i HEAD~3
# In the interactive editor, mark the commit with "d" to delete it, then save and exit.
Explanation:
Interactive rebasing enables modification of commit history, such as editing, squashing, or deleting commits, useful for fixing errors.
Assign multiple EEs to a project in Automation Controller.
정답:
1. Add EEs to Execution Environments.
2. Assign each EE to different job templates under the same project.
Explanation:
Using multiple EEs allows projects to run playbooks in varied runtime environments.
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.
Configure a private registry in Automation Controller to fetch EEs.
정답:
1. Navigate to Settings > Registries in the Automation Controller.
2. Add a new registry:
o Name: Private Registry
o URL: registry.example.com
o Authentication: Provide credentials.
3. Save the configuration and test connectivity.
Explanation:
Adding a private registry allows Automation Controller to securely fetch and use custom EEs.
Create a static inventory with groups web and db, each containing two hosts.
정답:
# inventory.yml
web:
hosts:
web1:
ansible_host: 192.168.1.10 web2:
ansible_host: 192.168.1.11 db:
hosts:
db1:
ansible_host: 192.168.1.20 db2:
ansible_host: 192.168.1.21
Explanation:
A static inventory organizes hosts into groups for targeted playbook execution, enabling efficient host management.

우리와 연락하기

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

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

서포트: 바로 연락하기