Skip to content

Instantly share code, notes, and snippets.

@AlanCoding
Last active September 20, 2019 13:25
Show Gist options
  • Save AlanCoding/a05bf233ea0e4d9d99be13ea32761d25 to your computer and use it in GitHub Desktop.
Save AlanCoding/a05bf233ea0e4d9d99be13ea32761d25 to your computer and use it in GitHub Desktop.
For automation of publishing to Galaxy

Publishing to Galaxy via AWX or Tower

Make a project from:

https://github.com/AlanCoding/utility-playbooks/

Create an inventory with localhost.

Create a credential type with the credential type JSON here. Create a credential of that type with the relevant parameters.

Make a JT with that credential, inventory, project, and use playbook:

galaxy_upload.yml

Then 🚀

Behavior

If you specify a version that has already been uploaded, the the final command: should fail, but allow the failure.

ERROR! Error when publishing collection to galaxy (https://galaxy.ansible.com) (HTTP Code: 409, Message: Collection "alancoding-awx-0.0.3" already exists. Code: conflict.collection_exists)

If you specify a version which has not been uploaded, it should upload like this in stdout:

Publishing collection artifact '/tmp/awx_56__6ocy12h/project/awx_clone/awx_collection/alancoding-awx-0.0.5.tar.gz' to galaxy https://galaxy.ansible.com
Collection has been published to the Galaxy server galaxy https://galaxy.ansible.com
Waiting until Galaxy import task https://galaxy.ansible.com/api/v2/collection-imports/352/ has completed
Collection has been successfully published and imported to the Galaxy server galaxy https://galaxy.ansible.com

Link:

https://galaxy.ansible.com/alancoding/awx

{
"name": "Ansible Galaxy or Automation Hub",
"description": "This is used to uploading to Galaxy servers, plan is to use for uploading to \"awx\" namespace",
"kind": "cloud",
"inputs": {
"fields": [
{
"id": "server",
"type": "string",
"default": "https://galaxy.ansible.com",
"label": "Galaxy Server URL"
},
{
"id": "token",
"type": "string",
"label": "Galaxy API Token",
"secret": true
}
],
"required": ["token"]
},
"injectors": {
"extra_vars": {
"galaxy_token": "{{token}}",
"galaxy_server": "{{server}}"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment