Decoupling Ansible 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.
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
chocolateyand add a description.