Replace docker_projects_dir by project_dir variable.

This commit is contained in:
Viyurz 2024-03-30 11:58:59 +01:00
parent 604e836b96
commit 14b484dd37
Signed by: Viyurz
SSH key fingerprint: SHA256:IskOHTmhHSJIvAt04N6aaxd5SZCVWW1Guf9tEcxIMj8
23 changed files with 63 additions and 75 deletions

View file

@ -1,8 +1,7 @@
domain: viyurz.fr
timezone: "Europe/Paris"
host_uid: 1000
docker_projects_dir: "{{ ansible_env['HOME'] }}/docker-projects"
project_dir: "{{ docker_projects_dir }}/{{ role_name }}"
project_dir: "{{ ansible_env['HOME'] }}/docker-projects/{{ role_name }}"
docker_host: "unix:///run/user/{{ host_uid }}/docker.sock"
# UID shift for mapping between host & containers

View file

@ -1,12 +1,12 @@
- name: "Create {{ coturn_project_dir }} project directory"
- name: "Create {{ project_dir }} project directory"
file:
path: "{{ coturn_project_dir }}"
path: "{{ project_dir }}"
state: directory
- name: Template docker-compose.yaml to project directory
template:
src: docker-compose.yaml
dest: "{{ coturn_project_dir }}/docker-compose.yaml"
dest: "{{ project_dir }}/docker-compose.yaml"
owner: "{{ host_uid }}"
group: "{{ host_uid }}"
mode: '640'
@ -14,7 +14,7 @@
- name: Template turnserver.conf to project directory
template:
src: turnserver.conf
dest: "{{ coturn_project_dir }}/turnserver.conf"
dest: "{{ project_dir }}/turnserver.conf"
owner: "{{ host_uid }}"
mode: '640'
# Store result to restart services if the file changed
@ -23,7 +23,7 @@
# Separate task because template module cannot chown/chgrp to a non-existing user/group
- name: "Change group of turnserver.conf to coturn GID ({{ users['coturn'] + uid_shift }})"
file:
path: "{{ coturn_project_dir }}/turnserver.conf"
path: "{{ project_dir }}/turnserver.conf"
group: "{{ users['coturn'] + uid_shift }}"
become: true
@ -62,7 +62,7 @@
- name: Pull project services
community.docker.docker_compose:
project_src: "{{ coturn_project_dir }}"
project_src: "{{ project_dir }}"
recreate: never
pull: true
debug: true
@ -76,6 +76,6 @@
- name: Create/Restart project services
community.docker.docker_compose:
project_src: "{{ coturn_project_dir }}"
project_src: "{{ project_dir }}"
# Restart if config file(s) changed
restarted: "{{ coturn_template_turnserver_result['changed'] | bool }}"

View file

@ -1 +0,0 @@
coturn_project_dir: "{{ docker_projects_dir }}/{{ role_name }}"

View file

@ -1,12 +1,12 @@
- name: "Create {{ element_project_dir }} project directory"
- name: "Create {{ project_dir }} project directory"
file:
path: "{{ element_project_dir }}"
path: "{{ project_dir }}"
state: directory
- name: Template docker-compose.yaml to project directory
template:
src: docker-compose.yaml
dest: "{{ element_project_dir }}/docker-compose.yaml"
dest: "{{ project_dir }}/docker-compose.yaml"
owner: "{{ host_uid }}"
group: "{{ host_uid }}"
mode: '640'
@ -14,7 +14,7 @@
- name: Template config.json to project directory
template:
src: config.json
dest: "{{ element_project_dir }}/config.json"
dest: "{{ project_dir }}/config.json"
owner: "{{ host_uid }}"
group: "{{ host_uid }}"
mode: '644'
@ -22,7 +22,7 @@
- name: Pull project services
community.docker.docker_compose:
project_src: "{{ element_project_dir }}"
project_src: "{{ project_dir }}"
recreate: never
pull: true
debug: true
@ -36,6 +36,6 @@
- name: Create/Restart project services
community.docker.docker_compose:
project_src: "{{ element_project_dir }}"
project_src: "{{ project_dir }}"
# Restart if config file(s) changed
restarted: "{{ element_template_config_result['changed'] | bool }}"

View file

@ -1 +0,0 @@
element_project_dir: "{{ docker_projects_dir }}/{{ role_name }}"

View file

@ -1,12 +1,12 @@
- name: "Create {{ etebase_project_dir }} project directory"
- name: "Create {{ project_dir }} project directory"
file:
path: "{{ etebase_project_dir }}"
path: "{{ project_dir }}"
state: directory
- name: Template docker-compose.yaml to project directory
template:
src: docker-compose.yaml
dest: "{{ etebase_project_dir }}/docker-compose.yaml"
dest: "{{ project_dir }}/docker-compose.yaml"
owner: "{{ host_uid }}"
group: "{{ host_uid }}"
mode: '640'
@ -14,7 +14,7 @@
- name: Template etebase-server.ini to project directory
template:
src: etebase-server.ini
dest: "{{ etebase_project_dir }}/etebase-server.ini"
dest: "{{ project_dir }}/etebase-server.ini"
owner: "{{ host_uid }}"
group: "{{ host_uid }}"
mode: '644'
@ -30,7 +30,7 @@
- name: Pull project services
community.docker.docker_compose:
project_src: "{{ etebase_project_dir }}"
project_src: "{{ project_dir }}"
recreate: never
pull: true
debug: true
@ -50,4 +50,4 @@
- name: Create/Restart project services
community.docker.docker_compose:
project_src: "{{ etebase_project_dir }}"
project_src: "{{ project_dir }}"

View file

@ -1 +0,0 @@
etebase_project_dir: "{{ docker_projects_dir }}/{{ role_name }}"

View file

@ -1,12 +1,12 @@
- name: "Create {{ hedgedoc_project_dir }} project directory"
- name: "Create {{ project_dir }} project directory"
file:
path: "{{ hedgedoc_project_dir }}"
path: "{{ project_dir }}"
state: directory
- name: Template docker-compose.yaml to project directory
template:
src: docker-compose.yaml
dest: "{{ hedgedoc_project_dir }}/docker-compose.yaml"
dest: "{{ project_dir }}/docker-compose.yaml"
owner: "{{ host_uid }}"
group: "{{ host_uid }}"
mode: '640'
@ -31,7 +31,7 @@
- name: Pull project services
community.docker.docker_compose:
project_src: "{{ hedgedoc_project_dir }}"
project_src: "{{ project_dir }}"
recreate: never
pull: true
debug: true
@ -51,4 +51,4 @@
- name: Create/Restart project services
community.docker.docker_compose:
project_src: "{{ hedgedoc_project_dir }}"
project_src: "{{ project_dir }}"

View file

@ -1 +0,0 @@
hedgedoc_project_dir: "{{ docker_projects_dir }}/{{ role_name }}"

View file

@ -1,19 +1,19 @@
- name: "Create {{ homepage_project_dir }} project directory"
- name: "Create {{ project_dir }} project directory"
file:
path: "{{ homepage_project_dir }}"
path: "{{ project_dir }}"
state: directory
- name: Template docker-compose.yaml to project directory
template:
src: docker-compose.yaml
dest: "{{ homepage_project_dir }}/docker-compose.yaml"
dest: "{{ project_dir }}/docker-compose.yaml"
owner: "{{ host_uid }}"
group: "{{ host_uid }}"
mode: '640'
- name: Pull project services
community.docker.docker_compose:
project_src: "{{ homepage_project_dir }}"
project_src: "{{ project_dir }}"
recreate: never
pull: true
debug: true
@ -27,4 +27,4 @@
- name: Create/Restart project services
community.docker.docker_compose:
project_src: "{{ homepage_project_dir }}"
project_src: "{{ project_dir }}"

View file

@ -1 +0,0 @@
homepage_project_dir: "{{ docker_projects_dir }}/{{ role_name }}"

View file

@ -1,12 +1,12 @@
- name: "Create {{ mailserver_project_dir }} project directory"
- name: "Create {{ project_dir }} project directory"
file:
path: "{{ mailserver_project_dir }}"
path: "{{ project_dir }}"
state: directory
- name: Template docker-compose.yaml to project directory
template:
src: docker-compose.yaml
dest: "{{ mailserver_project_dir }}/docker-compose.yaml"
dest: "{{ project_dir }}/docker-compose.yaml"
owner: "{{ host_uid }}"
group: "{{ host_uid }}"
mode: '640'
@ -55,7 +55,7 @@
- name: Pull project services
community.docker.docker_compose:
project_src: "{{ mailserver_project_dir }}"
project_src: "{{ project_dir }}"
recreate: never
pull: true
debug: true
@ -75,4 +75,4 @@
- name: Create/Restart project services
community.docker.docker_compose:
project_src: "{{ mailserver_project_dir }}"
project_src: "{{ project_dir }}"

View file

@ -1 +0,0 @@
mailserver_project_dir: "{{ docker_projects_dir }}/{{ role_name }}"

View file

@ -1,12 +1,12 @@
- name: "Create {{ searxng_project_dir }} project directory"
- name: "Create {{ project_dir }} project directory"
file:
path: "{{ searxng_project_dir }}"
path: "{{ project_dir }}"
state: directory
- name: Template docker-compose.yaml to project directory
template:
src: docker-compose.yaml
dest: "{{ searxng_project_dir }}/docker-compose.yaml"
dest: "{{ project_dir }}/docker-compose.yaml"
owner: "{{ host_uid }}"
group: "{{ host_uid }}"
mode: '640'
@ -14,7 +14,7 @@
- name: Copy settings.yml and limiter.toml to project directory
copy:
src: "{{ role_path }}/files/"
dest: "{{ searxng_project_dir }}"
dest: "{{ project_dir }}"
owner: "{{ host_uid }}"
group: "{{ host_uid }}"
mode: '644'
@ -23,7 +23,7 @@
- name: Pull project services
community.docker.docker_compose:
project_src: "{{ searxng_project_dir }}"
project_src: "{{ project_dir }}"
recreate: never
pull: true
debug: true
@ -37,6 +37,6 @@
- name: Create/Restart project services
community.docker.docker_compose:
project_src: "{{ searxng_project_dir }}"
project_src: "{{ project_dir }}"
# Restart if config file(s) changed
restarted: "{{ searxng_copy_files_result['changed'] | bool }}"

View file

@ -1 +0,0 @@
searxng_project_dir: "{{ docker_projects_dir }}/{{ role_name }}"

View file

@ -1,12 +1,12 @@
- name: "Create {{ synapse_project_dir }} project directory"
- name: "Create {{ project_dir }} project directory"
file:
path: "{{ synapse_project_dir }}"
path: "{{ project_dir }}"
state: directory
- name: Template docker-compose.yaml to project directory
template:
src: docker-compose.yaml
dest: "{{ synapse_project_dir }}/docker-compose.yaml"
dest: "{{ project_dir }}/docker-compose.yaml"
owner: "{{ host_uid }}"
group: "{{ host_uid }}"
mode: '640'
@ -14,7 +14,7 @@
- name: Template homeserver.yaml to project directory
template:
src: homeserver.yaml
dest: "{{ synapse_project_dir }}/homeserver.yaml"
dest: "{{ project_dir }}/homeserver.yaml"
owner: "{{ host_uid }}"
mode: '640'
# Store result to restart services if the file changed
@ -23,7 +23,7 @@
# Separate task because template module cannot chown/chgrp to a non-existing user/group
- name: "Change group of homeserver.yaml to synapse GID ({{ users['synapse'] + uid_shift }})"
file:
path: "{{ synapse_project_dir }}/homeserver.yaml"
path: "{{ project_dir }}/homeserver.yaml"
group: "{{ users['synapse'] + uid_shift }}"
become: true
@ -47,7 +47,7 @@
- name: Pull project services
community.docker.docker_compose:
project_src: "{{ synapse_project_dir }}"
project_src: "{{ project_dir }}"
recreate: never
pull: true
debug: true
@ -67,6 +67,6 @@
- name: Create/Restart project services
community.docker.docker_compose:
project_src: "{{ synapse_project_dir }}"
project_src: "{{ project_dir }}"
# Restart if config file(s) changed
restarted: "{{ synapse_template_homeserver_result['changed'] | bool }}"

View file

@ -1 +0,0 @@
synapse_project_dir: "{{ docker_projects_dir }}/{{ role_name }}"

View file

@ -1,19 +1,19 @@
- name: "Create {{ syncthing_project_dir }} project directory"
- name: "Create {{ project_dir }} project directory"
file:
path: "{{ syncthing_project_dir }}"
path: "{{ project_dir }}"
state: directory
- name: Template docker-compose.yaml to project directory
template:
src: docker-compose.yaml
dest: "{{ syncthing_project_dir }}/docker-compose.yaml"
dest: "{{ project_dir }}/docker-compose.yaml"
owner: "{{ host_uid }}"
group: "{{ host_uid }}"
mode: '640'
- name: Pull project services
community.docker.docker_compose:
project_src: "{{ syncthing_project_dir }}"
project_src: "{{ project_dir }}"
recreate: never
pull: true
debug: true
@ -27,4 +27,4 @@
- name: Create/Restart project services
community.docker.docker_compose:
project_src: "{{ syncthing_project_dir }}"
project_src: "{{ project_dir }}"

View file

@ -1 +0,0 @@
syncthing_project_dir: "{{ docker_projects_dir }}/{{ role_name }}"

View file

@ -1,12 +1,12 @@
- name: "Create {{ uptime_kuma_project_dir }} project directory"
- name: "Create {{ project_dir }} project directory"
file:
path: "{{ uptime_kuma_project_dir }}"
path: "{{ project_dir }}"
state: directory
- name: Template docker-compose.yaml to project directory
template:
src: docker-compose.yaml
dest: "{{ uptime_kuma_project_dir }}/docker-compose.yaml"
dest: "{{ project_dir }}/docker-compose.yaml"
owner: "{{ host_uid }}"
group: "{{ host_uid }}"
mode: '640'
@ -22,7 +22,7 @@
- name: Pull project services
community.docker.docker_compose:
project_src: "{{ uptime_kuma_project_dir }}"
project_src: "{{ project_dir }}"
recreate: never
pull: true
debug: true
@ -42,4 +42,4 @@
- name: Create/Restart project services
community.docker.docker_compose:
project_src: "{{ uptime_kuma_project_dir }}"
project_src: "{{ project_dir }}"

View file

@ -1 +0,0 @@
uptime_kuma_project_dir: "{{ docker_projects_dir }}/{{ role_name }}"

View file

@ -1,12 +1,12 @@
- name: "Create {{ vaultwarden_project_dir }} project directory"
- name: "Create {{ project_dir }} project directory"
file:
path: "{{ vaultwarden_project_dir }}"
path: "{{ project_dir }}"
state: directory
- name: Template docker-compose.yaml & .env to project directory
template:
src: "{{ item }}"
dest: "{{ vaultwarden_project_dir }}/{{ item }}"
dest: "{{ project_dir }}/{{ item }}"
owner: "{{ host_uid }}"
group: "{{ host_uid }}"
mode: '640'
@ -25,7 +25,7 @@
- name: Pull project services
community.docker.docker_compose:
project_src: "{{ vaultwarden_project_dir }}"
project_src: "{{ project_dir }}"
recreate: never
pull: true
debug: true
@ -45,4 +45,4 @@
- name: Create/Restart project services
community.docker.docker_compose:
project_src: "{{ vaultwarden_project_dir }}"
project_src: "{{ project_dir }}"

View file

@ -1 +0,0 @@
vaultwarden_project_dir: "{{ docker_projects_dir }}/{{ role_name }}"