Testing Ansible Community Collections Installation
This commit is contained in:
parent
619dc4dbb2
commit
a487ccee7d
1 changed files with 32 additions and 0 deletions
32
installation/ansibleCollections.yml
Normal file
32
installation/ansibleCollections.yml
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
---
|
||||||
|
- 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 ansible‑galaxy 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 %}
|
||||||
Loading…
Reference in a new issue