Creating your own collections
We have learned a great deal about collections and how to manage and maintain them. Let’s now complete your knowledge on this topic by creating your own one from scratch, thus giving you a full overview of how they are put together and how they work.
As with roles (see Chapter 4, Playbooks and Roles), collections are simply an organized set of files within directories. Although you can look up all these directories and create them by hand, we can also get the ansible-galaxy
utility to create a blank template for us to work with.
Let’s start with the fundamentals. We know that we need both a namespace and a collection name. If we publish on the Ansible Galaxy website, then the namespace will be our GitHub handle, as Ansible Galaxy takes this and uses it as your namespace. In our case, we won’t be publishing to Ansible Galaxy, so I’ll choose the namespace practicalansible
, but feel free to substitute this with your GitHub...