DO374
Day 1 | Day 2 | Day 3 | Day 4 |
Introduction | Running Playbooks with Automation Controller (continued) | Managing Task Execution (continued) | Coordinating Rolling Updates (continued) |
Developing Playbooks with Ansible Automation Platform 2 | Working with Ansible Configuration Settings | Transforming Data with Filters and Plug-ins | Creating Content Collections and Execution Environments |
Managing Content Collections and Execution Environments | Managing Inventories | Coordinating Rolling Updates (started) | Comprehensive Review |
Running Playbooks with Automation Controller | Managing Task Execution (started) |
Goal: Develop Ansible Playbooks with Red Hat Ansible Automation Platform 2 following recommended practices.
Objectives:
Describe the architecture of Red Hat Ansible Automation Platform 2 and how its new features help with Ansible automation development.
Install automation content navigator and use it to run an existing playbook with a supported execution environment.
Create and manage Ansible Playbooks in a Git repository, following recommended practices.
Demonstrate and describe common recommended practices for developing and maintaining effective Ansible automation solutions.
User experience: Adapting execution environments to your needs
Components of automation controller
Creator experience: Working with Ansible Automation Platform
Architecture of Red Hat Ansible Automation Platform 2
Output of a playbook run with automation content navigator
Details of a play run with automation content navigator
Details of a task in a play run with automation content navigator
The four areas where Git manages files
Git subcommands used to create a repository
Git subcommands used to add and update local repository content
Git subcommands that interact with a remote repository
Sample Git repository
ansible-navigator
) extends and can replace many previous Ansible commands, including ansible-playbook
.Goal: Run playbooks that use content collections not included in ansible-core
, either from an existing execution environment or by downloading them from automation hub.
Objectives:
Describe how Ansible Content Collections are used to distribute modules and plug-ins, and create plays that use content from them.
Search automation hub for Ansible Content Collections, and install them from the command line by name or by using a requirements.yml file.
Identify the automation execution environments provided by Red Hat and select the correct one for your use case.
Listing collections in automation hub
Generating a token
ansible-navigator doc --mode stdout
command to access the module documentation provided by Ansible Content Collections that are available to your automation execution environment.ansible-navigator images
command to inspect automation execution environments and to list the collections and other resources and collection dependencies provided by an automation execution environment's container image.ansible-galaxy collection install
command installs Ansible Content Collections on the local system.
The --collections-path
(or -p
) option specifies the installation directory.collections/requirements.yml
file to list the Ansible Content Collections that are required for the project.collections/
subdirectory in the directory that contains the playbook.ee-supported-rhel8
automation execution environment is used by default by automation content navigator and automation controller, and includes selected Red Hat Certified Ansible Content Collections in addition to the ansible.builtin
collection.ee-minimal-rhel8
automation execution environment only provides the ansible.builtin
Ansible Content Collection, but you can also use Ansible Content Collections from your project's collections/
directory.ee-29-rhel8
automation execution environment for playbooks that require Ansible 2.9.Goal: Explain what automation controller is and demonstrate how to use it to run playbooks that you developed with automation content navigator.
Objectives:
Describe the architecture and use cases of the automation controller component of Red Hat Ansible Automation Platform.
Navigate and describe the automation controller web UI, and successfully launch a job using a job template, project, credential, and inventory.
Architecture of Ansible Tower 3.8
Architecture of Ansible Automation Platform 2
List of existing credentials
List of existing projects
List of existing inventories
Adding a new host to a group
Adding a new inventory source from a project
List of existing job templates
List of jobs
ansible-navigator
to test Ansible Playbooks in an execution environment can help streamline the process of setting up those playbooks to run successfully on automation controller.Goal: Examine and adjust the configuration of Ansible and automation content navigator to simplify development and to troubleshoot issues.
Objectives:
Browse the current Ansible configuration by using automation content navigator.
Change configuration settings for automation content navigator with its configuration file, and determine where the configuration file is located.
ansible-navigator config
command helps you explore and analyze the current configuration used by the ansible-navigator run
command.ansible.cfg
files that it can see from inside the automation execution environment.
These files include the /etc/ansible/ansible.cfg
file in the execution environment container and the ansible.cfg
file in your project directory.ANSIBLE_NAVIGATOR_CONFIG
environment variable, the ansible-navigator.yml
configuration file in your current directory, or the ~/.ansible-navigator.yml
configuration file in your home directory.ansible-navigator settings --sample
command generates a sample ansible-navigator.yml
configuration file.ansible-navigator settings --effective
command generates a configuration file that reflects your current effective configuration, including options specified on the command line, values of environment variables, and defaults.Goal: Manage inventories by using advanced features of Ansible.
Objectives:
Describe what dynamic inventories are, and install and use an existing script or plug-in as an Ansible dynamic inventory source.
Write static inventory files in YAML format.
Structure host and group variables by using multiple files per host or group, and use special variables to override the host, port, or remote user that Ansible uses for a specific host.
yaml
inventory plug-in to write static inventory files in YAML format.ansible-navigator inventory
command to help you convert an inventory file in INI format into YAML format.group_vars/
and host_vars/
directories to improve project maintainability.Goal: Control and optimize the execution of tasks by Ansible Playbooks.
Objectives:
Control automatic privilege escalation at the play, role, task, or block level.
Configure tasks that can run before roles or after normal handlers, and simultaneously notify multiple handlers.
Label tasks with tags, and run only tasks labeled with specific tags, or start playbook execution at a specific task.
Optimize your playbook to run more efficiently, and use callback plug-ins to profile and analyze which tasks consume the most time.
become
, become_user
, become_method
, and become_flags
directives.pre_tasks
, roles
, tasks
, and post_tasks
.timer
, profile_tasks
, and profile_roles
callback plug-ins to profile playbooks.Goal: Populate, manipulate, and manage data in variables using filters and plug-ins.
Objectives:
Format, parse, and define the values of variables using filters.
Populate variables with data from external sources using lookup plug-ins.
Implement loops using structures other than simple lists by using lookup plug-ins and filters.
Use filters to inspect, validate, and manipulate variables containing networking information.
ansible.utils.ipaddr
.Goal: Use advanced features of Ansible to manage rolling updates in order to minimize downtime, and to ensure the maintainability and simplicity of Ansible Playbooks.
Objectives:
Run a task for a managed host on a different host, and control whether facts gathered by that task are delegated to the managed host or to the other host.
Tune the number of simultaneous connections that Ansible opens to managed hosts, and how Ansible processes groups of managed hosts through the play’s tasks.
Tune the behavior of the serial directive when batching hosts for execution, abort the play if it fails for too many hosts, and create tasks that run only once for each batch or for all hosts in the inventory.
delegate_to
keyword can delegate a task to run on a different host.forks
parameter in the Ansible configuration file specifies the maximum number of parallel connections to managed hosts.serial
keyword configures Ansible to run hosts through a play in multiple batches.max_fail_percentage
keyword configures Ansible to abort the play if more than a certain percentage of hosts in the current batch fail.run_once
keyword specifies that a task runs once for a batch rather than once for each host in the batch.Goal: Write your own Ansible Content Collections, publish them, embed them in a custom automation execution environment, and run them in playbooks by using automation controller.
Objectives:
Create content collections and distribute them for reuse.
Build a custom automation execution environment image by using the ansible-builder command.
Validate that a custom automation execution environment works as expected by testing it with the ansible-navigator command, and then distribute the automation execution environment for reuse.
Run a playbook in automation controller that uses a content collection in the project or content provided by a specific automation execution environment.
Approving Ansible Content Collections
Creating a credential for accessing Ansible automation hub
Associating Ansible automation hub credentials with organizations
Creating a credential for accessing a container registry
Configuring an automation execution environment
Selecting an automation execution environment for a project
Selecting an automation execution environment in a template
ansible-galaxy collection init
command creates the directory structure for new Ansible Content Collections.dependencies
parameter of the galaxy.yml
file, Python packages in the requirements.txt
file, and RPM packages in the bindep.txt
file.ansible-galaxy collection publish
command is used to publish collections on private automation hub.ansible-builder
command creates custom automation execution environments.execution-environment.yml
file is the configuration file for the ansible-builder
command.
It specifies the collections, Python packages, and RPM packages to include in the new automation execution environment.podman images
, podman tag
, and podman push
commands list, tag, and push automation execution environment images to a container registry.requirements.yml
file, but you need to set up stored credentials so that it can authenticate to automation hub.Goal: Review the tasks from Developing Advanced Automation with Red Hat Ansible Automation Platform
Objectives:
Review the tasks from Developing Advanced Automation with Red Hat Ansible Automation Platform
DO374-RHAAP2.2-en-1-20230131
Copyright © Red Hat, Inc.