Decoupling Ansible Roles
Decouple the roles from the core Ansible repository using Ansible Galaxy roles.
Using roles that live in the Ansible code repository increases reusability. However, reusability is limited to that single repository. When you need to share a role across multiple repositories, use Ansible Galaxy roles.
Ansible Galaxy roles allow you to decouple the role from the core Ansible repository. Galaxy roles are stored in their own git repository, making it possible to develop and version the role independently.
Using the Chocolatey role as an example, you’ll now convert the role to a Galaxy role within its own git repository.
Create a Git repository
Ansible Galaxy roles are very similar to local roles. The major difference is that they are stored outside of the core Ansible repository, in their own repository.
Using GitHub
create a new repository for the chocolatey Ansible Galaxy role.
- Log into GitHub.
- In the upper-right corner of any page, click
+
, and then click New repository. - Name the repository
chocolatey
and add a description.
Get hands-on with 1400+ tech skills courses.