Compare commits

..

2 commits

27 changed files with 68 additions and 79 deletions

View file

@ -1,8 +1,8 @@
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
uid_shift: 99999

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

@ -40,7 +40,7 @@
lineinfile:
path: "{{ ansible_env['HOME'] }}/.profile"
regex: '^export DOCKER_HOST='
line: "export DOCKER_HOST=unix:///run/user/{{ host_uid }}/docker.sock"
line: "export DOCKER_HOST={{ docker_host }}"
- name: "Make sure lingering is enabled for user {{ host_uid }}"
command:

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,7 +1,7 @@
- name: Backup MySQL database
community.docker.docker_container_exec:
container: hedgedoc-mysql
docker_host: "unix:///run/user/{{ host_uid }}/docker.sock"
docker_host: "{{ docker_host }}"
argv:
- /bin/bash
- "-c"

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

@ -8,7 +8,7 @@
-
--stdin-name dumpall.sql
environment:
DOCKER_HOST: "unix:///run/user/{{ host_uid }}/docker.sock"
DOCKER_HOST: "{{ docker_host }}"
BORG_PASSCOMMAND: "cat {{ borg_passphrase_file }}"
become: true

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,7 +1,7 @@
- name: Backup PostgreSQL database
community.docker.docker_container_exec:
container: synapse-postgres
docker_host: "unix:///run/user/{{ host_uid }}/docker.sock"
docker_host: "{{ docker_host }}"
command: |
pg_dump -c
-d synapse

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 }}"