Ansible Automation roles and inventories
Now that we know what Playbooks do in Red Hat® Ansible® Automation Platform, next is to learn how to manage them all. As you progress through using playbooks for your own environment, there will likely be the opportunity to create new variables, file structure changes, and more. With all these automation needs, they can be best managed with Ansible Roles and inventories.
What will you learn?
- What Ansible Roles are and how to use them effectively
- How to manage inventories within Ansible
What do you need before starting?
- Nothing! use this as a starting point.
Ansible Roles
An Ansible Role is a self-contained, portable unit of Ansible automation that serves as the preferred method for grouping related tasks and associated variables, files, handlers, and other assets in a known file structure. Once you start using roles, you can also better coordinate your use of inventories to collect all of these Ansible automations together.
Inventories in Ansible
An inventory is a collection of hosts that may be acted on using Ansible commands and playbooks. Inventory files organize hosts into groups, and can serve as a source of truth for your IT assets. An Ansible inventory can be formatted as simple INI or YAML, but YAML is preferred for use, as they maintain consistency with playbooks. Using an inventory file, a single playbook can maintain hundreds of devices with a single command.
Please note, these variables can change depending on your installation type. For a full list of variables, please see our documentation.
Ansible Content Collections
Ansible Content Collections are a standardized distribution format for automation content like playbooks, rulebooks, roles, modules, other plugins, inventories, and documentation. Think of it as an all-in-one package curated to accomplish certain workflows within your own use cases.
Content collections are offered in two types of ready-to-use categories:
- Red Hat Ansible Certified Content
- This is a category of collections built, supported, and maintained by Red Hat and our technology partners. They are available directly from Ansible automation hub, and focus on integrations between Red Hat and partner platforms to automate across different IT domains and technologies.
- Ansible validated content
- These offer expert guidance for using Ansible Automation Platform to perform operations or tasks in Red Hat and partner platforms. Typically delivered as roles and documentation, validated content contains customizable, opinionated use cases.. These are not supported or maintained by Red Hat, but may be based on Red Hat Ansible Certified Content.
If you don’t find what you need in content collections, you can also develop custom collections and upload them to a private automation hub for distribution within your organization. Once a collection is published, your users can download it for use.