ansible Collections:
- ansible collections are packages used to distribute and manage ansible content. EX: ETL –> taldent.etl.dashboard –> Offical docs
Collections contain:
- modules: perform the tasks such as installation, creating users and managing services
- plugins: extended ansible functionality
- Roles: reusable playbooks
- playbooks: automation plays -> tasks, varibale, host, …etc
- Documentation: instructions for using collections
Collections name conventions
- Ansbile collections follow this naming format
namespace.collection_name
amazon.aws
ansible.builtin
Install collections:
- general command install collections
ansible-galaxy collection install amazon.awsansible-galaxy collection install Kubernetes.Core
Get list of collections:
ansible-galaxy collection list
~/.ansible/
--> collections/
--> ansible_collections/
--> amazon/
--> aws/
--> Kubernetes/
--> Core
Community.general
ansible-galaxy collection install Community.general
- name: nginx
host: all
become: yes
tasks:
- name: install nginx
community.general.apk
name: nginx
state: project
Install collections using requirment.yaml file
collections:
- name: amazon.aws
version: ">=12.0.0"
- name: Kubernetes.Core
version: ">=6.6.0"
ansible-galaxy collection install -r requirment.yaml
command create own collections:
ansible-galaxy collection init qt.linux
