LinuxCommandLibrary

ansible-galaxy

TLDR

Install a role from Galaxy

$ ansible-galaxy install [username.role_name]
copy
Install collection from Galaxy
$ ansible-galaxy collection install [community.docker]
copy
Install from requirements file
$ ansible-galaxy install -r [requirements.yml]
copy
List installed roles
$ ansible-galaxy list
copy
Initialize a new role
$ ansible-galaxy init [role_name]
copy
Search for roles
$ ansible-galaxy search [nginx]
copy

SYNOPSIS

ansible-galaxy [role|collection] command [options]

DESCRIPTION

ansible-galaxy manages Ansible roles and collections from Ansible Galaxy and other sources. Galaxy is a public repository of community-contributed content, providing reusable automation components.
The tool can install, create, and manage roles (traditional content) and collections (bundled content including modules, plugins, and roles).

PARAMETERS

install name

Install role or collection
init name
Create new role scaffold
list
List installed roles/collections
search query
Search Galaxy for roles
remove name
Remove installed role/collection
-r file, --role-file file
Requirements file
-p path, --roles-path path
Installation path for roles
--force
Force overwrite existing
-s server, --server server
Galaxy server URL
--offline
Work offline (installed content only)

CAVEATS

Galaxy content is community-maintained; review before use in production. Collection names are namespaced (namespace.collection). Roles and collections have different installation paths.

HISTORY

ansible-galaxy was introduced with Ansible Galaxy in 2013 to share and distribute roles. Collections support was added in Ansible 2.9 (2019) as a new content distribution format.

SEE ALSO

Copied to clipboard