mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-12-02 15:39:57 +00:00
Refactor Nextcloud fullstack and config tasks:
- Load proxy in fullstack - Simplify config merging logic - Improve handler flushing and container config update Context: https://chatgpt.com/share/692dc9d4-a884-800f-85e5-e92471c7b52b
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
- name: "load docker and db for {{ application_id }}"
|
- name: "load docker, db and proxy for {{ application_id }}"
|
||||||
include_role:
|
include_role:
|
||||||
name: sys-stk-full-stateful
|
name: sys-stk-full-stateful
|
||||||
vars:
|
vars:
|
||||||
|
|||||||
@@ -1,29 +1,29 @@
|
|||||||
- name: Merge all files in infinito directory (container)
|
# Merge all (config) files in infinito directory (container)
|
||||||
block:
|
|
||||||
- name: Add dynamic config merging from Jinja template
|
|
||||||
template:
|
|
||||||
src: include.php.j2
|
|
||||||
dest: "{{ NEXTCLOUD_HOST_INCL_PATH }}"
|
|
||||||
notify: docker compose restart
|
|
||||||
|
|
||||||
- name: Flush handlers so Nextcloud container is restarted and ready
|
- name: Add dynamic config merging from Jinja template
|
||||||
meta: flush_handlers
|
template:
|
||||||
|
src: include.php.j2
|
||||||
|
dest: "{{ NEXTCLOUD_HOST_INCL_PATH }}"
|
||||||
|
notify: docker compose restart
|
||||||
|
|
||||||
- name: "Wait until Nextcloud is reachable on port {{ ports.localhost.http[application_id] }}"
|
- name: Flush handlers so Nextcloud container is restarted and ready
|
||||||
wait_for:
|
meta: flush_handlers
|
||||||
host: 127.0.0.1
|
|
||||||
port: "{{ ports.localhost.http[application_id] }}"
|
|
||||||
timeout: 120
|
|
||||||
delay: 2
|
|
||||||
state: started
|
|
||||||
|
|
||||||
- name: Copy include instructions to the container
|
- name: "Wait until Nextcloud is reachable on port {{ ports.localhost.http[application_id] }}"
|
||||||
command: >
|
wait_for:
|
||||||
docker cp {{ NEXTCLOUD_HOST_INCL_PATH }} {{ NEXTCLOUD_CONTAINER }}:{{ NEXTCLOUD_DOCKER_INCL_PATH }}
|
host: 127.0.0.1
|
||||||
|
port: "{{ ports.localhost.http[application_id] }}"
|
||||||
|
timeout: 120
|
||||||
|
delay: 2
|
||||||
|
state: started
|
||||||
|
|
||||||
- name: Append generated config to config.php only if not present
|
- name: Copy include instructions to the container
|
||||||
command: >
|
command: >
|
||||||
docker exec -u {{ NEXTCLOUD_DOCKER_USER }} {{ NEXTCLOUD_CONTAINER }} sh -c "
|
docker cp {{ NEXTCLOUD_HOST_INCL_PATH }} {{ NEXTCLOUD_CONTAINER }}:{{ NEXTCLOUD_DOCKER_INCL_PATH }}
|
||||||
grep -q '{{ NEXTCLOUD_DOCKER_CONF_ADD_PATH }}' {{ NEXTCLOUD_DOCKER_CONFIG_FILE }} ||
|
|
||||||
cat {{ NEXTCLOUD_DOCKER_INCL_PATH }} >> {{ NEXTCLOUD_DOCKER_CONFIG_FILE }}"
|
- name: Append generated config to config.php only if not present
|
||||||
notify: docker compose restart
|
command: >
|
||||||
|
docker exec -u {{ NEXTCLOUD_DOCKER_USER }} {{ NEXTCLOUD_CONTAINER }} sh -c "
|
||||||
|
grep -q '{{ NEXTCLOUD_DOCKER_CONF_ADD_PATH }}' {{ NEXTCLOUD_DOCKER_CONFIG_FILE }} ||
|
||||||
|
cat {{ NEXTCLOUD_DOCKER_INCL_PATH }} >> {{ NEXTCLOUD_DOCKER_CONFIG_FILE }}"
|
||||||
|
notify: docker compose restart
|
||||||
|
|||||||
@@ -1,9 +1,4 @@
|
|||||||
---
|
---
|
||||||
- name: "load docker, db and proxy for {{ application_id }}"
|
|
||||||
include_role:
|
|
||||||
name: sys-stk-full-stateful
|
|
||||||
vars:
|
|
||||||
|
|
||||||
- name: Setup the full docker stack
|
- name: Setup the full docker stack
|
||||||
include_tasks: 01_fullstack.yml
|
include_tasks: 01_fullstack.yml
|
||||||
vars:
|
vars:
|
||||||
|
|||||||
Reference in New Issue
Block a user