Ansible/installation/ansibleCollections.yml
2025-12-02 19:17:10 +01:00

32 lines
930 B
YAML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
- name: Install useful Ansible community collections
hosts: all
become: true
gather_facts: false
vars:
collections_to_install:
- containers.podman
- community.general
- ansible.posix
- community.kubernetes
tasks:
- name: Ensure ansiblegalaxy is available
ansible.builtin.command: ansible-galaxy --version
register: galaxy_version
changed_when: false
- name: Install the required Ansible collections
ansible.builtin.command: >-
ansible-galaxy collection install {{ item }} --force
loop: "{{ collections_to_install }}"
register: install_results
failed_when: install_results.rc != 0
- name: Summarise installation results
ansible.builtin.debug:
msg: |
{% for result in install_results.results %}
• {{ result.item }} → {{ 'OK' if result.rc == 0 else 'FAILED' }}
{% endfor %}