Skip to content

Ansible Galaxy collection repositories ​

Distribute collections with Ansible Galaxy v3. Arka serves collection versions, import tasks, and archives.

Create repositories ​

Run these Bash commands with an authenticated administrator arkactl profile and jq. Replace the endpoint and upstream address. Grant the publisher Hosted write access and the consumer read access to Group and the relevant members. For each identity, sign in and run arkactl --json tokens create --name ansible-ci --expires-in-days 30 | jq -er .plaintext. Store each token directly in your secret manager.

bash
export ARKA_URL=https://packages.example.org
hosted=$(arkactl --json repo create --name ansible-hosted --type hosted --format ansible | jq -er .id)
proxy=$(arkactl --json repo create --name ansible-proxy --type proxy --format ansible \
  --upstream-url https://galaxy.ansible.com | jq -er .id)
arkactl repo create --name ansible-group --type group --format ansible --member "$hosted,$proxy"
export WRITE="$ARKA_URL/repository/ansible-hosted"
export READ="$ARKA_URL/repository/ansible-group"

Publish a collection ​

bash
ansible-galaxy collection build ./my_collection
export ANSIBLE_GALAXY_SERVER_LIST=arka
export ANSIBLE_GALAXY_SERVER_ARKA_URL="$WRITE/api/"
export ANSIBLE_GALAXY_SERVER_ARKA_USERNAME="$ARKA_PUBLISH_USER"
export ANSIBLE_GALAXY_SERVER_ARKA_PASSWORD="$ARKA_WRITE_TOKEN"
ansible-galaxy collection publish acme-tools-1.2.3.tar.gz --server arka

The username/password settings let Ansible Core 2.19.9 authenticate with Basic. Use an Arka token as the password. The Galaxy publish endpoint accepts the client’s base64 multipart archive. CI pipelines that already have an archive can upload it directly.

bash
curl --fail-with-body -sS -H "Authorization: Bearer $ARKA_WRITE_TOKEN" \
  -T acme-tools-1.2.3.tar.gz "$WRITE/artifacts/acme-tools-1.2.3.tar.gz"

Install ​

bash
export ANSIBLE_GALAXY_SERVER_LIST=arka
export ANSIBLE_GALAXY_SERVER_ARKA_URL="$READ/api/"
export ANSIBLE_GALAXY_SERVER_ARKA_USERNAME="$ARKA_READ_USER"
export ANSIBLE_GALAXY_SERVER_ARKA_PASSWORD="$ARKA_READ_TOKEN"
ansible-galaxy collection install 'acme.tools:==1.2.3' --server arka -p "$(mktemp -d)"

Group resolves internal collections and upstream content. Use the consuming account’s Basic credentials for a private Group. For anonymous reads, omit both credential settings. Set the Proxy upstream to the Galaxy v3 site root and end the client URL with /api/.

SymptomWhat to check
Discovery returns 401Check the client’s Basic credentials and verify that GET /api/ returns 200 with valid credentials.
Version missingCheck namespace, name, and version in galaxy.yml, then inspect /api/v3/collections/<namespace>/<name>/versions/.
Publishing waits indefinitelyInspect the publish response’s Location and task JSON. Verify that the client can resolve the public hostname.

Publish Ansible collections

Released under the Apache 2.0 License.