Ansible Basics 10: Ansible Galaxy

One of the key features that contributes to Ansible’s popularity is its extensive ecosystem of community-contributed content, known as Ansible Galaxy. Ansible Galaxy is a hub for discovering and sharing Ansible roles, which are reusable automation components that encapsulate tasks, variables, and other Ansible functionality. These roles are created and shared by the Ansible community, allowing users to quickly find and incorporate pre-built automation into their own projects.

Continue reading “Ansible Basics 10: Ansible Galaxy”

Ansible Basics 09: Ansible Roles

Ansible roles are a powerful organizational mechanism that allows you to structure your Ansible content in a modular and reusable way. They provide a structured approach to managing tasks, variables, files, and other artifacts within your playbooks. You can push your Ansible roles in SCM and follow the changes and different versions. Ansible roles are the industry standard way to distribute and share Ansible code with the community.

Continue reading “Ansible Basics 09: Ansible Roles”

Using Ansible Galaxy for managing Ansible roles and collections

Ansible Galaxy is a hub for finding and sharing Ansible content, such as roles and collections. Roles are pre-packaged units of work that can be referenced in Ansible playbooks and immediately put to work. Collections are larger units that can contain multiple roles, modules, plugins, and other Ansible components.

Continue reading “Using Ansible Galaxy for managing Ansible roles and collections”

Conditional statements – making decisions in Ansible code

In a playbook or in a role sometimes we want to run different tasks based on different conditions. In most cases it depends on a fact (detail about the managed host) or some data collected during the playbook run. Ansible conditionals are there to make it possible to run different tasks based on different conditions, or skip executing tasks entirely.

Continue reading “Conditional statements – making decisions in Ansible code”

Creating an Ansible role from a playbook: modular, reusable code

After we ran ad-hoc commands and created a monolith playbook, we will increase our level of automation. We will separate our code much better with introducing modular, reusable file structures called roles. Ansible roles will load variables, handlers and tasks automatically for us based on a defined directory and file structure.

Continue reading “Creating an Ansible role from a playbook: modular, reusable code”