Add {{ docker_host }} variable.

This commit is contained in:
Viyurz 2024-03-30 11:32:39 +01:00
parent edb616b612
commit 604e836b96
Signed by: Viyurz
SSH key fingerprint: SHA256:IskOHTmhHSJIvAt04N6aaxd5SZCVWW1Guf9tEcxIMj8
5 changed files with 5 additions and 4 deletions

View file

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

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,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

@ -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,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