ansible-galaxy

Perform various Role and Collection related operations.

Synopsis

usage: ansible-galaxy [-h] [--version] [-v] TYPE ...

Description

command to manage Ansible roles in shared repositories, the default of which is Ansible Galaxy https://galaxy.ansible.com.

Common Options

--version

show program’s version number, config file location, configured module search path, module location, executable location and exit

-h, --help

show this help message and exit

-v, --verbose

verbose mode (-vvv for more, -vvvv to enable connection debugging)

Actions

collection

Perform the action on an Ansible Galaxy collection. Must be combined with a further action like init/install as listed below.

collection download

--clear-response-cache

Clear the existing server response cache.

--no-cache

Do not use the server response cache.

--pre

Include pre-release versions. Semantic versioning pre-releases are ignored by default

--token <API_KEY>, --api-key <API_KEY>

The Ansible Galaxy API key which can be found at https://galaxy.ansible.com/me/preferences.

-c, --ignore-certs

Ignore SSL certificate validation errors.

-n, --no-deps

Don’t download collection(s) listed as dependencies.

-p <DOWNLOAD_PATH>, --download-path <DOWNLOAD_PATH>

The directory to download the collections to.

-r <REQUIREMENTS>, --requirements-file <REQUIREMENTS>

A file containing a list of collections to be downloaded.

-s <API_SERVER>, --server <API_SERVER>

The Galaxy API server URL

collection init

Creates the skeleton framework of a role or collection that complies with the Galaxy metadata format. Requires a role or collection name. The collection name must be in the format <namespace>.<collection>.

--collection-skeleton <COLLECTION_SKELETON>

The path to a collection skeleton that the new collection should be based upon.

--init-path <INIT_PATH>

The path in which the skeleton collection will be created. The default is the current working directory.

--token <API_KEY>, --api-key <API_KEY>

The Ansible Galaxy API key which can be found at https://galaxy.ansible.com/me/preferences.

-c, --ignore-certs

Ignore SSL certificate validation errors.

-f, --force

Force overwriting an existing role or collection

-s <API_SERVER>, --server <API_SERVER>

The Galaxy API server URL

collection build

Build an Ansible Galaxy collection artifact that can be stored in a central repository like Ansible Galaxy. By default, this command builds from the current working directory. You can optionally pass in the collection input path (where the galaxy.yml file is).

--output-path <OUTPUT_PATH>

The path in which the collection is built to. The default is the current working directory.

--token <API_KEY>, --api-key <API_KEY>

The Ansible Galaxy API key which can be found at https://galaxy.ansible.com/me/preferences.

-c, --ignore-certs

Ignore SSL certificate validation errors.

-f, --force

Force overwriting an existing role or collection

-s <API_SERVER>, --server <API_SERVER>

The Galaxy API server URL

collection publish

Publish a collection into Ansible Galaxy. Requires the path to the collection tarball to publish.

--import-timeout <IMPORT_TIMEOUT>

The time to wait for the collection import process to finish.

--no-wait

Don’t wait for import validation results.

--token <API_KEY>, --api-key <API_KEY>

The Ansible Galaxy API key which can be found at https://galaxy.ansible.com/me/preferences.

-c, --ignore-certs

Ignore SSL certificate validation errors.

-s <API_SERVER>, --server <API_SERVER>

The Galaxy API server URL

collection install

--clear-response-cache

Clear the existing server response cache.

--force-with-deps

Force overwriting an existing collection and its dependencies.

--no-cache

Do not use the server response cache.

--pre

Include pre-release versions. Semantic versioning pre-releases are ignored by default

--token <API_KEY>, --api-key <API_KEY>

The Ansible Galaxy API key which can be found at https://galaxy.ansible.com/me/preferences.

-U, --upgrade

Upgrade installed collection artifacts. This will also update dependencies unless –no-deps is provided

-c, --ignore-certs

Ignore SSL certificate validation errors.

-f, --force

Force overwriting an existing role or collection

-i, --ignore-errors

Ignore errors during installation and continue with the next specified collection. This will not ignore dependency conflict errors.

-n, --no-deps

Don’t download collections listed as dependencies.

-p <COLLECTIONS_PATH>, --collections-path <COLLECTIONS_PATH>

The path to the directory containing your collections.

-r <REQUIREMENTS>, --requirements-file <REQUIREMENTS>

A file containing a list of collections to be installed.

-s <API_SERVER>, --server <API_SERVER>

The Galaxy API server URL

collection list

List installed collections or roles

--format <OUTPUT_FORMAT>

Format to display the list of collections in.

--token <API_KEY>, --api-key <API_KEY>

The Ansible Galaxy API key which can be found at https://galaxy.ansible.com/me/preferences.

-c, --ignore-certs

Ignore SSL certificate validation errors.

-p, --collections-path

One or more directories to search for collections in addition to the default COLLECTIONS_PATHS. Separate multiple paths with ‘:’.

-s <API_SERVER>, --server <API_SERVER>

The Galaxy API server URL

collection verify

--offline

Validate collection integrity locally without contacting server for canonical manifest hash.

--token <API_KEY>, --api-key <API_KEY>

The Ansible Galaxy API key which can be found at https://galaxy.ansible.com/me/preferences.

-c, --ignore-certs

Ignore SSL certificate validation errors.

-i, --ignore-errors

Ignore errors during verification and continue with the next specified collection.

-p, --collections-path

One or more directories to search for collections in addition to the default COLLECTIONS_PATHS. Separate multiple paths with ‘:’.

-r <REQUIREMENTS>, --requirements-file <REQUIREMENTS>

A file containing a list of collections to be verified.

-s <API_SERVER>, --server <API_SERVER>

The Galaxy API server URL

role

Perform the action on an Ansible Galaxy role. Must be combined with a further action like delete/install/init as listed below.

role init

Creates the skeleton framework of a role or collection that complies with the Galaxy metadata format. Requires a role or collection name. The collection name must be in the format <namespace>.<collection>.

--init-path <INIT_PATH>

The path in which the skeleton role will be created. The default is the current working directory.

--offline

Don’t query the galaxy API when creating roles

--role-skeleton <ROLE_SKELETON>

The path to a role skeleton that the new role should be based upon.

--token <API_KEY>, --api-key <API_KEY>

The Ansible Galaxy API key which can be found at https://galaxy.ansible.com/me/preferences.

--type <ROLE_TYPE>

Initialize using an alternate role type. Valid types include: ‘container’, ‘apb’ and ‘network’.

-c, --ignore-certs

Ignore SSL certificate validation errors.

-f, --force

Force overwriting an existing role or collection

-s <API_SERVER>, --server <API_SERVER>

The Galaxy API server URL

role remove

removes the list of roles passed as arguments from the local system.

--token <API_KEY>, --api-key <API_KEY>

The Ansible Galaxy API key which can be found at https://galaxy.ansible.com/me/preferences.

-c, --ignore-certs

Ignore SSL certificate validation errors.

-p, --roles-path

The path to the directory containing your roles. The default is the first writable one configured via DEFAULT_ROLES_PATH: ~/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles

-s <API_SERVER>, --server <API_SERVER>

The Galaxy API server URL

role delete

Delete a role from Ansible Galaxy.

--token <API_KEY>, --api-key <API_KEY>

The Ansible Galaxy API key which can be found at https://galaxy.ansible.com/me/preferences.

-c, --ignore-certs

Ignore SSL certificate validation errors.

-s <API_SERVER>, --server <API_SERVER>

The Galaxy API server URL

role list

List installed collections or roles

--token <API_KEY>, --api-key <API_KEY>

The Ansible Galaxy API key which can be found at https://galaxy.ansible.com/me/preferences.

-c, --ignore-certs

Ignore SSL certificate validation errors.

-p, --roles-path

The path to the directory containing your roles. The default is the first writable one configured via DEFAULT_ROLES_PATH: ~/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles

-s <API_SERVER>, --server <API_SERVER>

The Galaxy API server URL

--author <AUTHOR>

GitHub username

--galaxy-tags <GALAXY_TAGS>

list of galaxy tags to filter by

--platforms <PLATFORMS>

list of OS platforms to filter by

--token <API_KEY>, --api-key <API_KEY>

The Ansible Galaxy API key which can be found at https://galaxy.ansible.com/me/preferences.

-c, --ignore-certs

Ignore SSL certificate validation errors.

-s <API_SERVER>, --server <API_SERVER>

The Galaxy API server URL

role import

used to import a role into Ansible Galaxy

--branch <REFERENCE>

The name of a branch to import. Defaults to the repository’s default branch (usually master)

--no-wait

Don’t wait for import results.

--role-name <ROLE_NAME>

The name the role should have, if different than the repo name

--status

Check the status of the most recent import request for given github_user/github_repo.

--token <API_KEY>, --api-key <API_KEY>

The Ansible Galaxy API key which can be found at https://galaxy.ansible.com/me/preferences.

-c, --ignore-certs

Ignore SSL certificate validation errors.

-s <API_SERVER>, --server <API_SERVER>

The Galaxy API server URL

role setup

Setup an integration from Github or Travis for Ansible Galaxy roles

--list

List all of your integrations.

--remove <REMOVE_ID>

Remove the integration matching the provided ID value. Use –list to see ID values.

--token <API_KEY>, --api-key <API_KEY>

The Ansible Galaxy API key which can be found at https://galaxy.ansible.com/me/preferences.

-c, --ignore-certs

Ignore SSL certificate validation errors.

-p, --roles-path

The path to the directory containing your roles. The default is the first writable one configured via DEFAULT_ROLES_PATH: ~/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles

-s <API_SERVER>, --server <API_SERVER>

The Galaxy API server URL

role info

prints out detailed information about an installed role as well as info available from the galaxy API.

--offline

Don’t query the galaxy API when creating roles

--token <API_KEY>, --api-key <API_KEY>

The Ansible Galaxy API key which can be found at https://galaxy.ansible.com/me/preferences.

-c, --ignore-certs

Ignore SSL certificate validation errors.

-p, --roles-path

The path to the directory containing your roles. The default is the first writable one configured via DEFAULT_ROLES_PATH: ~/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles

-s <API_SERVER>, --server <API_SERVER>

The Galaxy API server URL

role install

--force-with-deps

Force overwriting an existing role and its dependencies.

--token <API_KEY>, --api-key <API_KEY>

The Ansible Galaxy API key which can be found at https://galaxy.ansible.com/me/preferences.

-c, --ignore-certs

Ignore SSL certificate validation errors.

-f, --force

Force overwriting an existing role or collection

-g, --keep-scm-meta

Use tar instead of the scm archive option when packaging the role.

-i, --ignore-errors

Ignore errors and continue with the next specified role.

-n, --no-deps

Don’t download roles listed as dependencies.

-p, --roles-path

The path to the directory containing your roles. The default is the first writable one configured via DEFAULT_ROLES_PATH: ~/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles

-r <REQUIREMENTS>, --role-file <REQUIREMENTS>

A file containing a list of roles to be installed.

-s <API_SERVER>, --server <API_SERVER>

The Galaxy API server URL

Environment

The following environment variables may be specified.

ANSIBLE_CONFIG – Override the default ansible config file

Many more are available for most options in ansible.cfg

Files

/etc/ansible/ansible.cfg – Config file, used if present

~/.ansible.cfg – User config file, overrides the default config if present

Author

Ansible was originally written by Michael DeHaan.

See the AUTHORS file for a complete list of contributors.

License

Ansible is released under the terms of the GPLv3+ License.

See also

ansible(1), ansible-config(1), ansible-console(1), ansible-doc(1), ansible-galaxy(1), ansible-inventory(1), ansible-playbook(1), ansible-pull(1), ansible-vault(1),

© 2012–2018 Michael DeHaan
© 2018–2021 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/cli/ansible-galaxy.html