fix(semaphore/collections): mount to /opt/ansible-collections, set ANSIBLE_COLLECTIONS_PATHS
/home/semaphore/.ansible/ is owned by root after Podman creates the bind-mount dir, so ansible-galaxy can't create sibling tmp dirs. Mount to a neutral /opt/ansible-collections path and point Ansible at it via ANSIBLE_COLLECTIONS_PATHS env var instead.
This commit is contained in:
@@ -30,7 +30,7 @@
|
|||||||
podman exec {{ semaphore_container_name }}
|
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 /home/semaphore/.ansible/collections
|
-p /opt/ansible-collections
|
||||||
--force
|
--force
|
||||||
loop: "{{ semaphore_ansible_collections }}"
|
loop: "{{ semaphore_ansible_collections }}"
|
||||||
loop_control:
|
loop_control:
|
||||||
|
|||||||
@@ -18,9 +18,9 @@ PublishPort={{ semaphore_listen_address }}:{{ semaphore_listen_port }}:3000
|
|||||||
Volume={{ semaphore_data_volume }}:/var/lib/semaphore:Z
|
Volume={{ semaphore_data_volume }}:/var/lib/semaphore:Z
|
||||||
|
|
||||||
# Ansible collections — host-side dir populated by the semaphore role.
|
# Ansible collections — host-side dir populated by the semaphore role.
|
||||||
# Bind-mounted so collections persist across container restarts/rebuilds
|
# Bind-mounted to a neutral path; ANSIBLE_COLLECTIONS_PATHS tells
|
||||||
# without baking them into the image.
|
# ansible-galaxy where to find them without touching ~/.ansible/.
|
||||||
Volume={{ semaphore_collections_dir }}:/home/semaphore/.ansible/collections:Z,ro
|
Volume={{ semaphore_collections_dir }}:/opt/ansible-collections:Z,ro
|
||||||
|
|
||||||
# Database — points at the postgres container on the user-defined network
|
# Database — points at the postgres container on the user-defined network
|
||||||
Environment=SEMAPHORE_DB_DIALECT=postgres
|
Environment=SEMAPHORE_DB_DIALECT=postgres
|
||||||
@@ -52,6 +52,9 @@ Environment=SEMAPHORE_WEB_ROOT={{ semaphore_web_url }}
|
|||||||
# Timezone matches host baseline
|
# Timezone matches host baseline
|
||||||
Environment=TZ=America/Chicago
|
Environment=TZ=America/Chicago
|
||||||
|
|
||||||
|
# Tell Ansible where to find collections installed by the role
|
||||||
|
Environment=ANSIBLE_COLLECTIONS_PATHS=/opt/ansible-collections
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Restart=always
|
Restart=always
|
||||||
TimeoutStartSec=180
|
TimeoutStartSec=180
|
||||||
|
|||||||
Reference in New Issue
Block a user