Install and Manage Community Roles
Beginner6 min
Use Ansible Galaxy to discover, install, and manage community roles and collections to accelerate automation development.
Prerequisites
- -Ansible installed
Steps
1
Search for roles on Galaxy
Searches Ansible Galaxy for nginx roles that support Ubuntu.
$ ansible-galaxy role search nginx --platforms Ubuntu
2
Install a role from Galaxy
Downloads and installs the geerlingguy.docker role to the default roles path.
$ ansible-galaxy role install geerlingguy.docker
Jeff Geerling's roles are among the most popular and well-maintained on Galaxy.
3
Install a collection
Installs the community.general collection which provides hundreds of additional modules.
$ ansible-galaxy collection install community.general
4
Create a requirements file
Defines all role and collection dependencies with version constraints in a single file.
$ cat > requirements.yml << 'EOF'
---
roles:
- name: geerlingguy.docker
version: "6.1.0"
- name: geerlingguy.nginx
collections:
- name: community.general
version: ">=8.0.0"
- name: amazon.aws
EOF
5
Install all dependencies from the requirements file
Installs all roles and collections defined in the requirements file.
$ ansible-galaxy install -r requirements.yml
Full Script
FAQ
Discussion
Loading comments...