fix(semaphore/collections): run ansible-galaxy inside container via podman exec
Binary lives inside the container at /opt/semaphore/apps/ansible/<ver>/venv/bin/. Use podman exec to run the install, writing to /home/semaphore/.ansible/collections which is bind-mounted from the host-side directory.
This commit is contained in:
@@ -17,19 +17,20 @@
|
|||||||
group: root
|
group: root
|
||||||
mode: "0755"
|
mode: "0755"
|
||||||
|
|
||||||
- name: Find ansible-galaxy binary on host
|
- name: Find ansible-galaxy binary inside Semaphore container
|
||||||
ansible.builtin.shell:
|
ansible.builtin.shell:
|
||||||
cmd: "find /opt/semaphore/apps/ansible -name ansible-galaxy -type f | sort -V | tail -1"
|
cmd: "podman exec {{ semaphore_container_name }} find /opt/semaphore/apps/ansible -name ansible-galaxy -type f | sort -V | tail -1"
|
||||||
register: ansible_galaxy_bin
|
register: ansible_galaxy_bin
|
||||||
changed_when: false
|
changed_when: false
|
||||||
failed_when: ansible_galaxy_bin.stdout == ""
|
failed_when: ansible_galaxy_bin.stdout == ""
|
||||||
|
|
||||||
- name: Install Ansible collections into host collections directory
|
- name: Install Ansible collections into host collections directory
|
||||||
ansible.builtin.command:
|
ansible.builtin.shell:
|
||||||
cmd: >
|
cmd: >
|
||||||
|
podman exec {{ semaphore_container_name }}
|
||||||
{{ ansible_galaxy_bin.stdout }} collection install
|
{{ ansible_galaxy_bin.stdout }} collection install
|
||||||
{{ item.name }}{% if item.version is defined %}:{{ item.version }}{% endif %}
|
{{ item.name }}{% if item.version is defined %}:{{ item.version }}{% endif %}
|
||||||
-p {{ semaphore_collections_dir }}
|
-p /home/semaphore/.ansible/collections
|
||||||
--force
|
--force
|
||||||
loop: "{{ semaphore_ansible_collections }}"
|
loop: "{{ semaphore_ansible_collections }}"
|
||||||
loop_control:
|
loop_control:
|
||||||
|
|||||||
Reference in New Issue
Block a user