Chapter 3. Understanding Ansible concepts As a automation developer, review the following Ansible concepts to create successful Ansible playbooks and automation execution environments before beginning your Ansible development project. 3.1. Prerequisites Ansible is installed. For information about installing Ansible, see Installing Ansible in the Ansible documentation. 3.2. About Ansible Playbooks Playbooks are files written in YAML that contain specific sets of human-readable instructions, or "plays", that you send to run on a single target or groups of targets. Playbooks can be used to manage configurations of and deployments to remote machines, as well as sequence multi-tier rollouts involving rolling updates. Use playbooks to delegate actions to other hosts, interacting with monitoring servers and load balancers along the way. Once written, playbooks can be used repeatedly across your enterprise for automation. 3.3. About Ansible Roles A role is Ansible's way of bundling automation content in addition to loading related vars, files, tasks, handlers, and other artifacts automatically by utilizing a known file structure. Instead of creating huge playbooks with hundreds of tasks, you can use roles to break the tasks apart into smaller, more discrete units of work. You can find roles for provisioning infrastructure, deploying applications, and all of the tasks you do every day on Ansible Galaxy. Filter your search by Type and select Role . Once you find a role that you are interested in, you can download it by using the ansible-galaxy command that comes bundled with Ansible: USD ansible-galaxy role install username.rolename 3.4. About Content Collections An Ansible Content Collection is a ready-to-use toolkit for automation. It includes several types of content such as playbooks, roles, modules, and plugins all in one place. The following diagram shows the basic structure of a collection: collection/ ├── docs/ ├── galaxy.yml ├── meta/ │ └── runtime.yml ├── plugins/ │ ├── modules/ │ │ └── module1.py │ ├── inventory/ │ ├── lookup/ │ ├── filter/ │ └── .../ ├── README.md ├── roles/ │ ├── role1/ │ ├── role2/ │ └── .../ ├── playbooks/ │ ├── files/ │ ├── vars/ │ ├── templates/ │ ├── playbook1.yml │ └── tasks/ └── tests/ ├── integration/ └── unit/ In Red Hat Ansible Automation Platform, automation hub serves as the source for Ansible Certified Content Collections. 3.5. About execution environments Automation execution environments are consistent and shareable container images that serve as Ansible control nodes. Automation execution environments reduce the challenge of sharing Ansible content that has external dependencies. Automation execution environments contain: Ansible Core Ansible Runner Ansible Collections Python libraries System dependencies Custom user needs You can define and create an automation execution environment using Ansible Builder. Additional resources For more information about Ansible Builder, see Creating and Consuming Execution Environments .

Commands:
ansible-galaxy role install username.rolename
collection/ ├── docs/ ├── galaxy.yml ├── meta/ │ └── runtime.yml ├── plugins/ │ ├── modules/ │ │ └── module1.py │ ├── inventory/ │ ├── lookup/ │ ├── filter/ │ └── .../ ├── README.md ├── roles/ │ ├── role1/ │ ├── role2/ │ └── .../ ├── playbooks/ │ ├── files/ │ ├── vars/ │ ├── templates/ │ ├── playbook1.yml │ └── tasks/ └── tests/ ├── integration/ └── unit/