Introduce a data_dir variable for tau

We've had too many confusions about the actual data directory and
unfortunately there are also inconsistencies. So use the data_dir
variable to mask host specific settings.
This commit is contained in:
Stefan Haun 2022-06-29 00:14:44 +02:00
parent c9fa0ce836
commit db91a7afa5

16
tau.yml
View file

@ -5,6 +5,8 @@
vars: vars:
ansible_python_interpreter: /usr/bin/python3 ansible_python_interpreter: /usr/bin/python3
data_dir: "/srv/docker"
docker_registry_port: 5000 # this is the reg standard port docker_registry_port: 5000 # this is the reg standard port
docker_registry_domain: "docker.n39.eu" docker_registry_domain: "docker.n39.eu"
@ -75,7 +77,7 @@
- name: Check if Docker Registry auth dir exists - name: Check if Docker Registry auth dir exists
ansible.builtin.stat: ansible.builtin.stat:
path: "/srv/docker/registry/auth" path: "{{ data_dir }}/registry/auth"
register: docker_dir register: docker_dir
- name: Fail if docker registry data dir does not exist - name: Fail if docker registry data dir does not exist
ansible.builtin.fail: ansible.builtin.fail:
@ -84,7 +86,7 @@
- name: Ensure the Docker Registry data directory exists - name: Ensure the Docker Registry data directory exists
# This may not be part of the backup # This may not be part of the backup
file: file:
path: "/srv/docker/registry/data" path: "{{ data_dir }}/registry/data"
state: directory state: directory
- name: Setup Docker Registry Container - name: Setup Docker Registry Container
@ -102,8 +104,8 @@
REGISTRY_AUTH_HTPASSWD_REALM: "Netz39 Docker Registry" REGISTRY_AUTH_HTPASSWD_REALM: "Netz39 Docker Registry"
REGISTRY_AUTH_HTPASSWD_PATH: "/auth/htpasswd" REGISTRY_AUTH_HTPASSWD_PATH: "/auth/htpasswd"
volumes: volumes:
- "/srv/docker/registry/data:/var/lib/registry:rw" - "{{ data_dir }}/registry/data:/var/lib/registry:rw"
- "/srv/docker/registry/auth:/auth:rw" - "{{ data_dir }}/registry/auth:/auth:rw"
- name: Setup proxy site for the Docker Registry - name: Setup proxy site for the Docker Registry
include_role: include_role:
@ -115,7 +117,7 @@
- name: Check if Dokuwiki data dir exists - name: Check if Dokuwiki data dir exists
ansible.builtin.stat: ansible.builtin.stat:
path: "/srv/docker/dokuwiki" path: "{{ data_dir }}/dokuwiki"
register: dokuwiki_dir register: dokuwiki_dir
- name: Fail if Dokuwiki data dir does not exist - name: Fail if Dokuwiki data dir does not exist
ansible.builtin.fail: ansible.builtin.fail:
@ -124,7 +126,7 @@
- name: Set correct user for Dokuwiki data - name: Set correct user for Dokuwiki data
ansible.builtin.file: ansible.builtin.file:
path: "/srv/docker/dokuwiki" path: "{{ data_dir }}/dokuwiki"
owner: "1001" # According to container config owner: "1001" # According to container config
recurse: yes recurse: yes
@ -141,7 +143,7 @@
# env: No env here, because we copy the data # env: No env here, because we copy the data
# and the container will never be created from scratch. # and the container will never be created from scratch.
volumes: volumes:
- "/srv/docker/dokuwiki:/bitnami/dokuwiki:rw" - "{{ data_dir }}/dokuwiki:/bitnami/dokuwiki:rw"
- name: Setup proxy site for Dokuwiki - name: Setup proxy site for Dokuwiki
include_role: include_role: