Loading

Quipoin Menu

Learn • Practice • Grow

ansible / Ansible Galaxy
tutorial

Ansible Galaxy

You don’t have to write every role from scratch. Ansible Galaxy is a community hub where you can find, download, and share roles. It’s like a package manager for Ansible content.

What Is Ansible Galaxy?

Galaxy is a website (galaxy.ansible.com) and a command‑line tool. It lets you search for roles contributed by the community, install them, and manage dependencies.

Ansible Galaxy is the hub for sharing and consuming Ansible roles.

Searching for Roles

From the command line:
ansible-galaxy search nginx
Or browse the website.

Installing a Role

Install a role from Galaxy (e.g., geerlingguy.nginx):
ansible-galaxy install geerlingguy.nginx
This installs the role into ~/.ansible/roles/. To install into a project‑local roles/ directory, use -p roles.

Using a Galaxy Role in Your Playbook

Once installed, use it like any other role:
- hosts: webservers
roles:
- geerlingguy.nginx

Requirements File

For reproducibility, create a requirements.yml file listing roles:
- src: geerlingguy.nginx
- src: geerlingguy.mysql
version: 3.0.0
Install all roles from the file:
ansible-galaxy install -r requirements.yml

Publishing Your Own Role

You can publish roles to Galaxy after creating an account and linking your GitHub repository. The role must have a meta/main.yml with proper metadata.


Two Minute Drill
  • Ansible Galaxy is a role repository and command‑line tool.
  • Install roles with ansible-galaxy install username.rolename.
  • Use a requirements.yml file for version‑controlled dependencies.
  • You can publish your own roles to Galaxy.

Need more clarification?

Drop us an email at career@quipoinfotech.com