Introduction
In the ever-evolving landscape of automation, creating customized solutions becomes paramount. Ansible Automation Hub provides a platform to showcase and share these custom creations with the world. In this guide, we’ll walk you through the process of crafting your custom Ansible Collection, named “test.test,” and publishing it on Ansible Automation Hub.
Links
- [Ansible Automation Hub](https://www.ansible.com/products/automation-hub)
- https://docs.ansible.com/ansible/latest/dev_guide/developing_collections.html
Step by step
1. Create the Custom Collection
Begin your journey by creating the “test.test” collection using the ansible-galaxy command-line utility:
``bash
ansible-galaxy collection init test.test
`
You’ll receive a confirmation that the “test.test” collection has been successfully created.
`bash
- Collection test.test was created successfully
`
The command generates the following directory tree in the current directory:
`bash
.
└── test
└── test
├── docs
├── galaxy.yml
├── meta
│ └── runtime.yml
├── plugins
│ └── README.md
├── README.md
└── roles
6 directories, 4 files
`
2. Customize the Collection Content
Navigate into the collection directory and modify the “runtime.yml” file located at “test/test/meta/runtime.yml”. You can customize by adding additional modules, plugins, roles, etc.
Here, set the “requires_ansible” parameter to specify the minimum Ansible version required:
`yaml
---
Collections must specify a minimum required ansible version to upload
to galaxy
requires_ansible: '>=2.9.10'
`
3. Build the Ansible Artifact
The following command creates the “test-test-1.0.0.tar.gz” archive that we can publish in Automation Hub. Generate the “test-test-1.0.0.tar.gz” archive using the following command:
`bash
ansible-galaxy collection build
`
Upon execution, the generated archive is ready to be published on Automation Hub.
`bash
Created collection for test.test at /home/luca/collection/test/test/test-test-1.0.0.tar.gz
`
4. Create a Namespace
Access the Automation Hub interface and navigate to Collections > Namespace > Create. Enter “test” as the namespace name. Create the “test” namespace via the Collections > Namespace > Create menu and insert the “test” in the name pop-up window as shown in the following Figure:

5. Create the Collection
Within the newly created namespace, select the “Upload collection” button. Proceed by uploading the “test-test-1.0.0.tar.gz” file, created earlier with the ansible-galaxy` command. Inside the namespace, select the “Upload collection” button to populate the “test.test” collection with the generated file.

Upload the “test-test-1.0.0.tar.gz” file generated by the ansible-gala