Merge pull request 'Add a data_dir variable to prevent confusion' (!40) from data-dir into master

Reviewed-on: https://gitea.n39.eu/Netz39_Admin/netz39-infra-ansible/pulls/40
This commit is contained in:
Alexander Dahl 2022-06-29 20:38:36 +00:00
commit 8f15146e12
4 changed files with 26 additions and 18 deletions

View file

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

View file

@ -5,8 +5,10 @@
vars:
ansible_python_interpreter: /usr/bin/python3
data_dir: "/srv/data"
mosquitto_image: eclipse-mosquitto:2.0.14
mosquitto_data: /srv/data/mosquitto
mosquitto_data: "{{ data_dir }}/mosquitto"
roles:
- role: docker_setup

16
tau.yml
View file

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

View file

@ -4,6 +4,7 @@
become: true
vars:
ansible_python_interpreter: /usr/bin/python3
data_dir: "/srv/data"
roles:
- role: docker_setup
vars:
@ -28,5 +29,5 @@
- "3478:3478/udp" # STUN service
- "6789:6789/tcp" # Speed Test (unifi5 only)
volumes:
- "/srv/data/unifi-controller/data:/unifi/data"
- "/srv/data/unifi-controller/log:/unifi/log"
- "{{ data_dir }}/unifi-controller/data:/unifi/data"
- "{{ data_dir }}/unifi-controller/log:/unifi/log"