Ansible Galaxy - Manage Ansible Roles and Collections

Learn how to use Ansible Galaxy to install, remove, list, search, and initialize Ansible roles and collections. Master Ansible role management.

Ansible Galaxy Commands

Ansible Galaxy is a command-line tool that allows you to find, download, install, and manage Ansible roles and collections. It acts as a central hub for sharing and discovering reusable Ansible automation content.

Install Ansible Roles

To install a specific role from Ansible Galaxy, use the install command. You need to specify the role in the format <user>.<role>.

ansible-galaxy install <user>.<role>

Remove Ansible Roles

If you no longer need a role, you can remove it using the remove command, again specifying the role by its user and role name.

ansible-galaxy remove <user>.<role>

List Installed Roles

To see all the roles that are currently installed on your system, use the list command.

ansible-galaxy list

Search for Roles

Ansible Galaxy provides a powerful search functionality to find roles based on keywords. This helps you discover automation content relevant to your needs.

ansible-galaxy search <role>

Create New Roles

When you need to develop your own reusable automation components, you can use Ansible Galaxy to initialize a new role structure with the init command.

ansible-galaxy init <role>

Get Role Information

To retrieve detailed information about a specific role or collection, including its metadata, dependencies, and author, use the info command. This is useful for understanding the role before installation.

ansible-galaxy role info <user>.<role>

Note: You can replace role with collection in the info command to get information about Ansible collections.

External Resources