Introduce a data_dir variable for pottwal

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:15:43 +02:00
parent db91a7afa5
commit 4f78fa9656

View file

@ -5,8 +5,11 @@
vars: vars:
ansible_python_interpreter: /usr/bin/python3 ansible_python_interpreter: /usr/bin/python3
data_dir: "/srv/data"
openhab_image: openhab/openhab:2.5.11 openhab_image: openhab/openhab:2.5.11
openhab_data: /srv/data/openhab openhab_data: "{{ data_dir }}/openhab"
openhab_host_port: 8081 openhab_host_port: 8081
openhab_configuration_source: https://github.com/netz39/n39-openhab.git openhab_configuration_source: https://github.com/netz39/n39-openhab.git
openhab_configuration_version: master openhab_configuration_version: master
@ -30,7 +33,7 @@
- name: Check if gitea data dir exists - name: Check if gitea data dir exists
ansible.builtin.stat: ansible.builtin.stat:
path: "/srv/data/gitea" path: "{{ data_dir }}/gitea"
register: gitea_dir register: gitea_dir
- name: Fail if gitea data dir does not exist - name: Fail if gitea data dir does not exist
ansible.builtin.fail: ansible.builtin.fail:
@ -62,7 +65,7 @@
USER_UID=1000 USER_UID=1000
USER_GID=1000 USER_GID=1000
volumes: volumes:
- "/srv/data/gitea:/data:rw" - "{{ data_dir }}/gitea:/data:rw"
- name: Setup proxy site gitea.n39.eu - name: Setup proxy site gitea.n39.eu
include_role: include_role:
@ -187,7 +190,7 @@
- name: Check if hedgedoc data dir exists - name: Check if hedgedoc data dir exists
ansible.builtin.stat: ansible.builtin.stat:
path: "/srv/data/hedgedoc" path: "{{ data_dir }}/hedgedoc"
register: hedgedoc_dir register: hedgedoc_dir
- name: Fail if hedgedoc data dir does not exist - name: Fail if hedgedoc data dir does not exist
ansible.builtin.fail: ansible.builtin.fail:
@ -199,8 +202,8 @@
path: "{{ item }}" path: "{{ item }}"
state: directory state: directory
with_items: with_items:
- "/srv/data/hedgedoc/data/database" - "{{ data_dir }}/hedgedoc/data/database"
- "/srv/data/hedgedoc/data/uploads" - "{{ data_dir }}/hedgedoc/data/uploads"
- name: Setup docker network - name: Setup docker network
docker_network: docker_network:
@ -221,7 +224,7 @@
POSTGRES_PASSWORD: "{{ hedgedoc_postgres_password }}" POSTGRES_PASSWORD: "{{ hedgedoc_postgres_password }}"
POSTGRES_DB: "hedgedoc" POSTGRES_DB: "hedgedoc"
volumes: volumes:
- "/srv/data/hedgedoc/data/database:/var/lib/postgresql/data" - "{{ data_dir }}/hedgedoc/data/database:/var/lib/postgresql/data"
networks: networks:
- name: hedgedocnet - name: hedgedocnet
@ -247,7 +250,7 @@
CMD_DB_USERNAME: "hedgedoc" CMD_DB_USERNAME: "hedgedoc"
CMD_DB_PASSWORD: "{{ hedgedoc_postgres_password }}" CMD_DB_PASSWORD: "{{ hedgedoc_postgres_password }}"
volumes: volumes:
- /srv/data/hedgedoc/data/uploads:/hedgedoc/public/uploads - "{{ data_dir }}/hedgedoc/data/uploads:/hedgedoc/public/uploads"
networks: networks:
- name: hedgedocnet - name: hedgedocnet