Publish Ansible Collections to a Specific Repository (Server Explicit)

JFrog Artifactory Documentation

Products
JFrog Artifactory
Content Type
User Guide

Publishing an Ansible collection using Ansible client CLI bypasses what is configured in the ansible.cfg file. This method is known as being Server Explicit. You may want to use this method for publishing Ansible collections to a repository other than that configured in the ansible.cfg file.

Note

Using a server explicit command overrides the registry URL your ansible.cfg.

To publish Ansible collections via the Ansible CLI:

Run the following command:

ansible-galaxy collection publish <NAMESPACE.COLLECTION_NAME> -s https://[JFrogPlatformURL]/artifactory/api/ansible/<REPOSITORY_NAME> --token=<TOKEN>

Where:

  • <NAMESPACE.COLLECTION_NAME>: The namespace and collection name you want to publish

  • [JFrogPlatformURL]: The URL of your JPD

  • <REPOSITORY_NAME>: The name of the target repository

  • <TOKEN>: Your Artifactory identity token

For example:

ansible-galaxy collection publish geerlingguy.k8s.tar.gz -s https://company.jfrog.io/artifactory/api/ansible/ansible-virtual --token=w8RvZ3tGkP7sVbNfHjMqYxAcX2pLdE9jU1oI5uC6yFzTmK4rB0eSgWlQhOaD

Note

You can also use JFrog Set me up to copy the snippet populated with your token and environment. For more information, see Use Artifactory Set Me Up for Configuring Package Manager Clients.