2020-12-28 22:53:53 +01:00
|
|
|
---
|
2020-12-10 22:15:09 +01:00
|
|
|
- hosts: pottwal.n39.eu
|
|
|
|
become: true
|
|
|
|
|
|
|
|
roles:
|
2020-12-28 22:53:53 +01:00
|
|
|
- role: docker_setup
|
|
|
|
vars:
|
|
|
|
docker_data_root: "/srv/docker"
|
|
|
|
- role: apache
|
2022-10-23 22:49:57 +02:00
|
|
|
- role: apache_letsencrypt # Uses configuration from dehydrated setup
|
2022-09-06 15:10:42 +02:00
|
|
|
- role: ansible-role-dehydrated
|
|
|
|
vars:
|
|
|
|
dehydrated_contact_email: "{{ server_admin }}"
|
|
|
|
dehydrated_domains:
|
2022-09-14 21:40:33 +02:00
|
|
|
- name: gitea.n39.eu
|
|
|
|
- name: uritools.n39.eu
|
|
|
|
- name: uritools-api.n39.eu
|
2022-11-02 00:01:59 +01:00
|
|
|
- name: "{{ shlink_domain_name }}"
|
2022-09-14 21:40:33 +02:00
|
|
|
- name: pad.n39.eu
|
|
|
|
- name: "{{ prosody_domain_name }}"
|
2022-09-15 06:38:56 +02:00
|
|
|
alternate_names:
|
|
|
|
- conference.jabber.n39.eu
|
2022-09-14 21:40:33 +02:00
|
|
|
deploy_cert_hook: "docker exec prosody prosodyctl --root cert import ${DOMAIN} /var/lib/dehydrated/certs"
|
2022-10-20 13:09:26 +02:00
|
|
|
- name: redmine.n39.eu
|
2022-10-20 22:52:15 +02:00
|
|
|
- name: influx.n39.eu
|
2022-10-21 14:35:25 +02:00
|
|
|
- name: uptime.n39.eu
|
2022-09-06 15:10:42 +02:00
|
|
|
- role: penguineer.dehydrated_cron
|
2022-10-23 22:51:33 +02:00
|
|
|
- role: dd24_dyndns_cron
|
2022-08-03 20:19:48 +02:00
|
|
|
# variables are set in the inventory
|
2022-09-14 22:47:02 +02:00
|
|
|
- role: cleanuri
|
|
|
|
vars:
|
|
|
|
cleanuri_ui_domain: uritools.n39.eu
|
|
|
|
cleanuri_ui_host_port: 8090
|
|
|
|
cleanuri_api_domain: uritools-api.n39.eu
|
|
|
|
cleanuri_api_host_port: 8091
|
|
|
|
# RabbitMQ setup can be found in the inventory
|
2020-12-10 22:15:09 +01:00
|
|
|
|
|
|
|
tasks:
|
2022-01-06 12:03:36 +01:00
|
|
|
|
2022-01-30 11:48:09 +01:00
|
|
|
- name: Check if gitea data dir exists
|
|
|
|
ansible.builtin.stat:
|
2022-06-29 00:15:43 +02:00
|
|
|
path: "{{ data_dir }}/gitea"
|
2022-01-30 11:48:09 +01:00
|
|
|
register: gitea_dir
|
|
|
|
- name: Fail if gitea data dir does not exist
|
|
|
|
ansible.builtin.fail:
|
|
|
|
msg: "Gitea data dir is missing, please restore from the backup!"
|
|
|
|
when: not gitea_dir.stat.exists
|
2022-01-06 12:03:36 +01:00
|
|
|
|
2022-01-30 11:48:09 +01:00
|
|
|
# If port 2222 is changed here, it must also be adapted
|
|
|
|
# in the gitea config file (see application volume)!!
|
|
|
|
- name: Setup the docker container for gitea
|
|
|
|
docker_container:
|
|
|
|
name: gitea
|
2022-06-20 01:54:01 +02:00
|
|
|
image: "gitea/gitea:1.16.8"
|
2022-01-30 11:48:09 +01:00
|
|
|
pull: true
|
|
|
|
state: started
|
|
|
|
restart_policy: unless-stopped
|
|
|
|
detach: yes
|
|
|
|
ports:
|
2022-09-06 15:12:01 +02:00
|
|
|
- 127.0.0.1:{{ gitea_host_port }}:3000
|
2022-01-30 11:48:09 +01:00
|
|
|
- 2222:2222
|
|
|
|
env:
|
2022-11-07 16:43:12 +01:00
|
|
|
TZ: "{{ timezone }}"
|
2022-11-07 16:45:03 +01:00
|
|
|
APP_NAME: "Netz39 Gitea"
|
|
|
|
RUN_MODE: "prod"
|
|
|
|
SSH_DOMAIN: "gitea.n39.eu"
|
|
|
|
SSH_PORT: "2222"
|
|
|
|
SSH_START_SERVER: "false"
|
|
|
|
ROOT_URL: "https://gitea.n39.eu"
|
|
|
|
DISABLE_REGISTRATION: "true"
|
|
|
|
USER_UID: "1000"
|
|
|
|
USER_GID: "1000"
|
2022-01-30 11:48:09 +01:00
|
|
|
volumes:
|
2022-06-29 00:15:43 +02:00
|
|
|
- "{{ data_dir }}/gitea:/data:rw"
|
2022-01-06 12:03:36 +01:00
|
|
|
|
2022-01-30 11:48:09 +01:00
|
|
|
- name: Setup proxy site gitea.n39.eu
|
|
|
|
include_role:
|
2022-10-23 22:55:09 +02:00
|
|
|
name: setup_http_site_proxy
|
2022-01-30 11:48:09 +01:00
|
|
|
vars:
|
|
|
|
site_name: "gitea.n39.eu"
|
|
|
|
proxy_port: "{{ gitea_host_port }}"
|
2022-01-06 12:03:36 +01:00
|
|
|
|
2022-01-30 11:42:48 +01:00
|
|
|
- name: Ensure apt-cacher container is running
|
|
|
|
docker_container:
|
|
|
|
name: apt_cacher_ng
|
|
|
|
image: "mrtux/apt-cacher-ng"
|
|
|
|
pull: true
|
|
|
|
state: started
|
|
|
|
restart_policy: unless-stopped
|
|
|
|
detach: yes
|
|
|
|
ports:
|
|
|
|
- 3142:3142
|
2022-11-07 16:43:12 +01:00
|
|
|
env:
|
|
|
|
TZ: "{{ timezone }}"
|
|
|
|
|
2022-01-30 11:42:48 +01:00
|
|
|
|
|
|
|
|
|
|
|
- name: Ensure container for shlink is running
|
|
|
|
docker_container:
|
|
|
|
name: shlink
|
|
|
|
image: shlinkio/shlink:2.6.2
|
|
|
|
pull: true
|
|
|
|
state: started
|
|
|
|
detach: yes
|
|
|
|
ports:
|
2022-09-06 15:12:01 +02:00
|
|
|
- "127.0.0.1:{{ shlink_host_port }}:8080"
|
2022-01-30 11:42:48 +01:00
|
|
|
restart_policy: unless-stopped
|
|
|
|
env:
|
2022-11-07 16:43:12 +01:00
|
|
|
TZ: "{{ timezone }}"
|
2022-01-30 11:42:48 +01:00
|
|
|
SHORT_DOMAIN_HOST: "{{ shlink_domain_name }}"
|
|
|
|
SHORT_DOMAIN_SCHEMA: https
|
|
|
|
GEOLITE_LICENSE_KEY: "{{ shlink_geolite_license_key }}"
|
|
|
|
|
|
|
|
- name: Setup proxy site {{ shlink_domain_name }}
|
|
|
|
include_role:
|
2022-10-23 22:55:09 +02:00
|
|
|
name: setup_http_site_proxy
|
2022-01-30 11:42:48 +01:00
|
|
|
vars:
|
|
|
|
site_name: "{{ shlink_domain_name }}"
|
2022-01-30 11:48:51 +01:00
|
|
|
proxy_port: "{{ shlink_host_port }}"
|
|
|
|
|
2022-09-15 21:42:32 +02:00
|
|
|
- name: Check if prosody data dir exists
|
|
|
|
ansible.builtin.stat:
|
|
|
|
path: "{{ prosody_data_dir }}"
|
|
|
|
register: prosody_dir
|
|
|
|
- name: Fail if prosody data dir does not exist
|
|
|
|
ansible.builtin.fail:
|
|
|
|
msg: "prosody data dir is missing, please restore from the backup!"
|
2022-10-20 21:57:33 +02:00
|
|
|
when: not prosody_dir.stat.exists
|
2022-09-15 21:42:32 +02:00
|
|
|
|
2022-01-30 11:39:05 +01:00
|
|
|
- name: Ensure container for prosody XMPP server is running
|
|
|
|
docker_container:
|
|
|
|
name: prosody
|
|
|
|
image: netz39/prosody:0.11
|
|
|
|
pull: true
|
|
|
|
state: started
|
|
|
|
detach: true
|
|
|
|
restart_policy: unless-stopped
|
|
|
|
ports:
|
|
|
|
# container offers more ports, depends on actual prosody configuration
|
|
|
|
- 5222:5222 # xmpp-client
|
|
|
|
- 5269:5269 # xmpp-server
|
|
|
|
volumes:
|
2022-09-15 21:42:32 +02:00
|
|
|
- "{{ prosody_data_dir }}/etc/prosody:/etc/prosody:rw"
|
|
|
|
- "{{ prosody_data_dir }}/var/lib/prosody:/var/lib/prosody:rw"
|
|
|
|
- "{{ prosody_data_dir }}/var/log/prosody:/var/log/prosody:rw"
|
2022-09-14 21:55:03 +02:00
|
|
|
- "{{ dehydrated_certs_dir }}/{{ prosody_domain_name }}:/var/lib/dehydrated/certs/{{ prosody_domain_name }}:ro"
|
2022-11-07 16:43:12 +01:00
|
|
|
env:
|
|
|
|
TZ: "{{ timezone }}"
|
|
|
|
|
2022-01-30 11:39:05 +01:00
|
|
|
|
2022-09-15 20:41:54 +02:00
|
|
|
- name: Ensure container for static XMPP website is running
|
|
|
|
docker_container:
|
|
|
|
name: jabber-static-website
|
2022-10-17 09:01:41 +02:00
|
|
|
image: joseluisq/static-web-server:2.13.1
|
2022-09-15 20:41:54 +02:00
|
|
|
pull: true
|
|
|
|
state: started
|
|
|
|
detach: true
|
|
|
|
restart_policy: unless-stopped
|
|
|
|
env:
|
2022-11-07 16:43:12 +01:00
|
|
|
TZ: "{{ timezone }}"
|
2022-09-15 20:41:54 +02:00
|
|
|
SERVER_PORT=80
|
|
|
|
SERVER_ROOT=/public
|
|
|
|
ports:
|
|
|
|
- "127.0.0.1:{{ jabber_host_port }}:80"
|
|
|
|
volumes:
|
2022-09-15 21:42:32 +02:00
|
|
|
- "{{ prosody_data_dir }}/var/www:/public:ro"
|
2022-09-15 20:41:54 +02:00
|
|
|
|
2022-09-14 21:55:03 +02:00
|
|
|
- name: Setup proxy site {{ prosody_domain_name }}
|
2022-07-08 07:16:55 +02:00
|
|
|
# point to static website for now
|
|
|
|
include_role:
|
2022-10-23 22:55:09 +02:00
|
|
|
name: setup_http_site_proxy
|
2022-07-08 07:16:55 +02:00
|
|
|
vars:
|
2022-09-14 21:55:03 +02:00
|
|
|
site_name: "{{ prosody_domain_name }}"
|
2022-07-08 07:16:55 +02:00
|
|
|
proxy_port: "{{ jabber_host_port }}"
|
|
|
|
|
2022-06-26 22:54:00 +02:00
|
|
|
- name: Check if hedgedoc data dir exists
|
|
|
|
ansible.builtin.stat:
|
2022-06-29 00:15:43 +02:00
|
|
|
path: "{{ data_dir }}/hedgedoc"
|
2022-06-26 22:54:00 +02:00
|
|
|
register: hedgedoc_dir
|
|
|
|
- name: Fail if hedgedoc data dir does not exist
|
|
|
|
ansible.builtin.fail:
|
|
|
|
msg: "hedgedoc data dir is missing, please restore from the backup!"
|
|
|
|
when: not hedgedoc_dir.stat.exists
|
|
|
|
|
|
|
|
- name: Ensure the hedgedoc directories exist
|
|
|
|
file:
|
2022-10-26 21:49:57 +02:00
|
|
|
path: "{{ item.path }}"
|
|
|
|
mode: "{{ item.mode }}"
|
2022-06-26 22:54:00 +02:00
|
|
|
state: directory
|
|
|
|
with_items:
|
2022-10-26 21:49:57 +02:00
|
|
|
- path: "{{ data_dir }}/hedgedoc/data/database"
|
|
|
|
mode: "0700"
|
|
|
|
- path: "{{ data_dir }}/hedgedoc/data/uploads"
|
|
|
|
mode: "0755"
|
2022-06-26 22:54:00 +02:00
|
|
|
|
|
|
|
- name: Setup docker network
|
|
|
|
docker_network:
|
|
|
|
name: hedgedocnet
|
|
|
|
state: present
|
|
|
|
internal: true
|
|
|
|
|
|
|
|
- name: Install HedgeDoc database container
|
|
|
|
docker_container:
|
|
|
|
name: hedgedocdb
|
|
|
|
image: "postgres:11.6-alpine"
|
|
|
|
pull: true
|
|
|
|
state: started
|
|
|
|
restart_policy: unless-stopped
|
|
|
|
detach: yes
|
|
|
|
env:
|
2022-11-07 16:43:12 +01:00
|
|
|
TZ: "{{ timezone }}"
|
2022-06-28 21:51:22 +02:00
|
|
|
POSTGRES_USER: "hedgedoc"
|
2022-06-26 22:54:00 +02:00
|
|
|
POSTGRES_PASSWORD: "{{ hedgedoc_postgres_password }}"
|
2022-06-28 21:51:22 +02:00
|
|
|
POSTGRES_DB: "hedgedoc"
|
2022-06-26 22:54:00 +02:00
|
|
|
volumes:
|
2022-06-29 00:15:43 +02:00
|
|
|
- "{{ data_dir }}/hedgedoc/data/database:/var/lib/postgresql/data"
|
2022-06-26 22:54:00 +02:00
|
|
|
networks:
|
|
|
|
- name: hedgedocnet
|
2022-07-08 07:20:57 +02:00
|
|
|
|
2022-06-26 22:54:00 +02:00
|
|
|
- name: Ensure container for hedgedoc is running
|
|
|
|
docker_container:
|
|
|
|
name: hedgedoc
|
|
|
|
image: "{{ hedgedoc_image }}"
|
|
|
|
pull: true
|
|
|
|
state: started
|
|
|
|
detach: yes
|
|
|
|
ports:
|
2022-09-06 15:12:01 +02:00
|
|
|
- "127.0.0.1:{{ hedgedoc_host_port }}:3000"
|
2022-06-26 22:54:00 +02:00
|
|
|
restart_policy: unless-stopped
|
|
|
|
env:
|
2022-11-07 16:43:12 +01:00
|
|
|
TZ: "{{ timezone }}"
|
2022-06-28 21:51:22 +02:00
|
|
|
NODE_ENV: "production"
|
2022-06-28 21:43:26 +02:00
|
|
|
CMD_PROTOCOL_USESSL: "true"
|
2022-06-28 21:51:22 +02:00
|
|
|
CMD_DOMAIN: "pad.n39.eu"
|
2022-06-28 21:43:26 +02:00
|
|
|
CMD_URL_ADDPORT: "false"
|
2022-06-28 21:51:22 +02:00
|
|
|
CMD_DB_HOST: "hedgedocdb"
|
|
|
|
CMD_DB_PORT: "5432"
|
|
|
|
CMD_DB_DIALECT: "postgres"
|
|
|
|
CMD_DB_DATABASE: "hedgedoc"
|
|
|
|
CMD_DB_USERNAME: "hedgedoc"
|
2022-06-26 22:54:00 +02:00
|
|
|
CMD_DB_PASSWORD: "{{ hedgedoc_postgres_password }}"
|
|
|
|
volumes:
|
2022-06-29 00:15:43 +02:00
|
|
|
- "{{ data_dir }}/hedgedoc/data/uploads:/hedgedoc/public/uploads"
|
2022-06-26 22:54:00 +02:00
|
|
|
networks:
|
|
|
|
- name: hedgedocnet
|
|
|
|
|
|
|
|
- name: Setup proxy site pad.n39.eu
|
|
|
|
include_role:
|
2022-10-23 22:55:09 +02:00
|
|
|
name: setup_http_site_proxy
|
2022-06-26 22:54:00 +02:00
|
|
|
vars:
|
|
|
|
site_name: pad.n39.eu
|
|
|
|
proxy_port: "{{ hedgedoc_host_port }}"
|
|
|
|
|
2022-10-19 22:20:50 +02:00
|
|
|
- name: Ensure the influxdb directories exist
|
|
|
|
file:
|
|
|
|
path: "{{ item }}"
|
2022-10-26 21:59:37 +02:00
|
|
|
mode: 0700
|
2022-10-19 22:20:50 +02:00
|
|
|
state: directory
|
|
|
|
with_items:
|
|
|
|
- "{{ data_dir }}/influxdb"
|
|
|
|
|
|
|
|
- name: Ensure container for influxdb is running
|
|
|
|
docker_container:
|
|
|
|
name: influxdb
|
|
|
|
image: "{{ influxdb_image }}"
|
|
|
|
pull: true
|
|
|
|
state: started
|
|
|
|
detach: yes
|
|
|
|
ports:
|
|
|
|
- "127.0.0.1:{{ influxdb_host_port }}:8086"
|
|
|
|
restart_policy: unless-stopped
|
|
|
|
env:
|
2022-11-07 16:43:12 +01:00
|
|
|
TZ: "{{ timezone }}"
|
2022-10-19 22:20:50 +02:00
|
|
|
DOCKER_INFLUXDB_INIT_USERNAME: "{{ influxdb_init_username }}"
|
|
|
|
DOCKER_INFLUXDB_INIT_PASSWORD: "{{ influxdb_init_password }}"
|
|
|
|
DOCKER_INFLUXDB_INIT_ORG: Netz39
|
|
|
|
DOCKER_INFLUXDB_INIT_BUCKET: default
|
|
|
|
volumes:
|
|
|
|
- "{{ data_dir }}/influxdb:/var/lib/influxdb2"
|
|
|
|
|
|
|
|
- name: Setup proxy site influx.n39.eu
|
|
|
|
include_role:
|
2022-10-23 22:55:09 +02:00
|
|
|
name: setup_http_site_proxy
|
2022-10-19 22:20:50 +02:00
|
|
|
vars:
|
|
|
|
site_name: influx.n39.eu
|
|
|
|
proxy_port: "{{ influxdb_host_port }}"
|
2022-07-04 18:38:22 +02:00
|
|
|
|
2022-10-20 13:09:26 +02:00
|
|
|
# Expected setup for the data directory
|
|
|
|
# file: configuration.yml
|
|
|
|
# directory: mysql
|
|
|
|
# directory: files
|
|
|
|
# directory: themes
|
|
|
|
- name: Check if redmine data dir exists
|
|
|
|
ansible.builtin.stat:
|
|
|
|
path: "{{ data_dir }}/redmine"
|
|
|
|
register: redmine_dir
|
|
|
|
- name: Fail if redmine data dir does not exist
|
|
|
|
ansible.builtin.fail:
|
|
|
|
msg: "Redmine data dir is missing, please restore from the backup!"
|
|
|
|
when: not redmine_dir.stat.exists
|
|
|
|
|
|
|
|
- name: Setup Redmine docker network
|
|
|
|
docker_network:
|
|
|
|
name: redminenet
|
|
|
|
state: present
|
|
|
|
internal: true
|
|
|
|
|
|
|
|
- name: Setup Redmine MySQL container
|
|
|
|
docker_container:
|
|
|
|
name: redminedb
|
|
|
|
image: "{{ redmine_mysql_image }}"
|
|
|
|
pull: true
|
|
|
|
state: started
|
|
|
|
restart_policy: unless-stopped
|
|
|
|
detach: yes
|
|
|
|
env:
|
2022-11-07 16:43:12 +01:00
|
|
|
TZ: "{{ timezone }}"
|
2022-10-20 13:09:26 +02:00
|
|
|
MYSQL_ROOT_PASSWORD: "{{ redmine_database_password }}"
|
2022-10-26 18:56:20 +02:00
|
|
|
MYSQL_DATABASE: "{{ redmine_database }}"
|
2022-10-20 13:09:26 +02:00
|
|
|
volumes:
|
|
|
|
- "{{ data_dir }}/redmine/mysql:/var/lib/mysql"
|
|
|
|
networks:
|
|
|
|
- name: redminenet
|
|
|
|
|
|
|
|
- name: Setup Redmine container
|
|
|
|
docker_container:
|
|
|
|
name: redmine
|
|
|
|
image: "{{ redmine_image }}"
|
|
|
|
pull: true
|
|
|
|
state: started
|
|
|
|
restart_policy: unless-stopped
|
|
|
|
detach: yes
|
|
|
|
ports:
|
|
|
|
- "127.0.0.1:{{ redmine_host_port }}:3000"
|
|
|
|
env:
|
2022-11-07 16:43:12 +01:00
|
|
|
TZ: "{{ timezone }}"
|
2022-10-20 13:09:26 +02:00
|
|
|
REDMINE_DB_MYSQL: redminedb
|
|
|
|
REDMINE_DB_PASSWORD: "{{ redmine_database_password }}"
|
|
|
|
volumes:
|
|
|
|
- "{{ data_dir }}/redmine/configuration.yml:/usr/src/redmine/config/configuration.yml"
|
|
|
|
- "{{ data_dir }}/redmine/files:/usr/src/redmine/files"
|
|
|
|
- "{{ data_dir }}/redmine/themes:/usr/src/redmine/public/themes"
|
|
|
|
networks:
|
|
|
|
- name: redminenet
|
|
|
|
|
|
|
|
- name: Setup proxy site redmine.n39.eu
|
|
|
|
include_role:
|
2022-10-23 22:55:09 +02:00
|
|
|
name: setup_http_site_proxy
|
2022-10-20 13:09:26 +02:00
|
|
|
vars:
|
|
|
|
site_name: redmine.n39.eu
|
|
|
|
proxy_port: "{{ redmine_host_port }}"
|
|
|
|
|
2022-10-19 18:49:29 +02:00
|
|
|
- name: Ensure the uptime-kuma directories exist
|
|
|
|
file:
|
|
|
|
path: "{{ item }}"
|
2022-10-26 21:49:57 +02:00
|
|
|
mode: "0755"
|
2022-10-19 18:49:29 +02:00
|
|
|
state: directory
|
|
|
|
with_items:
|
2022-10-26 21:49:57 +02:00
|
|
|
- "{{ data_dir }}/uptime-kuma"
|
2022-10-19 18:49:29 +02:00
|
|
|
|
|
|
|
- name: Ensure container for uptime-kuma is running
|
|
|
|
docker_container:
|
|
|
|
name: uptime-kuma
|
2022-10-26 18:56:20 +02:00
|
|
|
image: "louislam/uptime-kuma:1"
|
2022-10-19 18:49:29 +02:00
|
|
|
pull: true
|
|
|
|
state: started
|
|
|
|
detach: yes
|
|
|
|
ports:
|
|
|
|
- "127.0.0.1:{{ uptimekuma_host_port }}:3001"
|
|
|
|
restart_policy: unless-stopped
|
2022-11-07 16:43:12 +01:00
|
|
|
env:
|
|
|
|
TZ: "{{ timezone }}"
|
2022-10-19 18:49:29 +02:00
|
|
|
volumes:
|
|
|
|
- "{{ data_dir }}/uptime-kuma:/app/data"
|
|
|
|
|
|
|
|
- name: Setup proxy site uptime.n39.eu
|
|
|
|
include_role:
|
2022-10-25 16:28:23 +02:00
|
|
|
name: setup_http_site_proxy
|
2022-10-19 18:49:29 +02:00
|
|
|
vars:
|
|
|
|
site_name: uptime.n39.eu
|
|
|
|
proxy_port: "{{ uptimekuma_host_port }}"
|
2022-10-20 13:09:26 +02:00
|
|
|
|
2020-12-11 18:59:47 +01:00
|
|
|
handlers:
|