Build own collections
Install collections
ansible-galaxy collection install amazon.aws --force
- collection will store data in ~/.ansible/collections
- https://github.com/CompiledCollections/compiled.builtin/tree/main/plugins
Crate own collections
- namespace: qt
- collection: demo
ansible-galaxy collection init qt.demo
galaxy.yml README.md meta/ plugins/ roles/ docs/
galaxy.yml – ID card of collection (name, version and author)
README.md – provide info about this collection how user can use it
plugins – where my modules and filtters live
roles – roles contains tasks, varibales, …etc
docs – info
meta – info of collections and its modules
build and install collection
ansible-galaxy collection build
ansible-galaxy collection install qt-demo-1.0.0.tar.gz --force
- name: demo
hosts: all
tasks:
- name: Run the role
ansible.builtin.include_role:
name: qt.demo.hello
- name: call module
qt.demo.greet:
name: student
register: result
- name: show result
ansible.builtin.debug:
msg: "{{ result.message }}"
