Use a block to deploy all services + add pre_deploy and post_deploy
This commit is contained in:
parent
f50831460c
commit
52b1d1ccd2
|
@ -6,38 +6,35 @@ services:
|
|||
|
||||
### Internal services ###
|
||||
postfix:
|
||||
file: postfix.yml
|
||||
domain: "smtp.{{ base_domain }}"
|
||||
volume_folder: "{{ volume_root_folder }}/postfix"
|
||||
pre_deploy_tasks: true
|
||||
version: "v3.6.1-alpine"
|
||||
|
||||
nginx_proxy:
|
||||
file: nginx_proxy.yml
|
||||
volume_folder: "{{ volume_root_folder }}/nginx"
|
||||
pre_deploy_tasks: true
|
||||
version: "1.3-alpine"
|
||||
acme_companion_version: "2.2"
|
||||
|
||||
openldap:
|
||||
file: openldap.yml
|
||||
domain: "ldap.{{ base_domain }}"
|
||||
volume_folder: "{{ volume_root_folder }}/openldap"
|
||||
pre_deploy_tasks: true
|
||||
version: "1.5.0"
|
||||
phpldapadmin_version: "0.9.0"
|
||||
|
||||
netdata:
|
||||
file: netdata.yml
|
||||
domain: "netdata.{{ base_domain }}"
|
||||
volume_folder: "{{ volume_root_folder }}/netdata"
|
||||
version: "v1"
|
||||
|
||||
portainer:
|
||||
file: portainer.yml
|
||||
domain: "portainer.{{ base_domain }}"
|
||||
volume_folder: "{{ volume_root_folder }}/portainer"
|
||||
version: "2.19.0"
|
||||
|
||||
keycloak:
|
||||
file: keycloak.yml
|
||||
domain: sso.{{ base_domain }}
|
||||
volume_folder: "{{ volume_root_folder }}/keycloak"
|
||||
version: "22.0"
|
||||
|
@ -45,19 +42,20 @@ services:
|
|||
allowed_sender_domain: true
|
||||
|
||||
restic:
|
||||
file: restic.yml
|
||||
volume_folder: "{{ volume_root_folder }}/restic"
|
||||
pre_deploy_tasks: true
|
||||
user: dc-user
|
||||
domain: rynkeby.skovgaard.tel
|
||||
host_key: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBLGol2G+a87ssy0nu/STKBZSiGyhZhZKx/ujfe9IeFo
|
||||
volume_folder: "{{ volume_root_folder }}/restic"
|
||||
repository: restic
|
||||
version: "1.7.0"
|
||||
disabled_in_vagrant: true
|
||||
|
||||
docker_registry:
|
||||
file: docker_registry.yml
|
||||
domain: "docker.{{ base_domain }}"
|
||||
volume_folder: "{{ volume_root_folder }}/docker-registry"
|
||||
pre_deploy_tasks: true
|
||||
post_deploy_tasks: true
|
||||
username: "docker"
|
||||
password: "{{ docker_password }}"
|
||||
version: "2"
|
||||
|
@ -65,23 +63,21 @@ services:
|
|||
### External services ###
|
||||
|
||||
nextcloud:
|
||||
file: nextcloud.yml
|
||||
domain: "cloud.{{ base_domain }}"
|
||||
volume_folder: "{{ volume_root_folder }}/nextcloud"
|
||||
pre_deploy_tasks: true
|
||||
version: 27-apache
|
||||
postgres_version: "10"
|
||||
redis_version: 7-alpine
|
||||
allowed_sender_domain: true
|
||||
|
||||
forgejo:
|
||||
file: forgejo.yml
|
||||
domain: "git.{{ base_domain }}"
|
||||
volume_folder: "{{ volume_root_folder }}/forgejo"
|
||||
version: "1.20"
|
||||
allowed_sender_domain: true
|
||||
|
||||
passit:
|
||||
file: passit.yml
|
||||
domain: "passit.{{ base_domain }}"
|
||||
volume_folder: "{{ volume_root_folder }}/passit"
|
||||
version: stable
|
||||
|
@ -89,34 +85,33 @@ services:
|
|||
allowed_sender_domain: true
|
||||
|
||||
matrix:
|
||||
file: matrix.yml
|
||||
domain: "matrix.{{ base_domain }}"
|
||||
volume_folder: "{{ volume_root_folder }}/matrix"
|
||||
pre_deploy_tasks: true
|
||||
version: v1.90.0
|
||||
postgres_version: 15-alpine
|
||||
allowed_sender_domain: true
|
||||
|
||||
element:
|
||||
file: element.yml
|
||||
domain: "element.{{ base_domain }}"
|
||||
volume_folder: "{{ volume_root_folder }}/element"
|
||||
pre_deploy_tasks: true
|
||||
version: v1.11.43
|
||||
|
||||
privatebin:
|
||||
file: privatebin.yml
|
||||
domain: "paste.{{ base_domain }}"
|
||||
volume_folder: "{{ volume_root_folder }}/privatebin"
|
||||
pre_deploy_tasks: true
|
||||
version: "20221009"
|
||||
|
||||
hedgedoc:
|
||||
file: hedgedoc.yml
|
||||
domain: "pad.{{ base_domain }}"
|
||||
volume_folder: "{{ volume_root_folder }}/hedgedoc"
|
||||
pre_deploy_tasks: true
|
||||
version: 1.9.9-alpine
|
||||
postgres_version: 10-alpine
|
||||
|
||||
data_coop_website:
|
||||
file: websites/data.coop.yml
|
||||
domain: "{{ base_domain }}"
|
||||
www_domain: "www.{{ base_domain }}"
|
||||
version: stable
|
||||
|
@ -124,28 +119,23 @@ services:
|
|||
staging_version: staging
|
||||
|
||||
slides_2022_website:
|
||||
file: websites/2022.slides.data.coop.yml
|
||||
domain: "2022.slides.{{ base_domain }}"
|
||||
version: latest
|
||||
|
||||
fedi_dk_website:
|
||||
file: websites/fedi.dk.yaml
|
||||
domain: fedi.dk
|
||||
version: latest
|
||||
|
||||
vhs_website:
|
||||
file: websites/vhs.data.coop.yaml
|
||||
domain: vhs.data.coop
|
||||
version: latest
|
||||
|
||||
cryptohagen_website:
|
||||
file: websites/cryptohagen.dk.yml
|
||||
domains:
|
||||
- "cryptohagen.dk"
|
||||
- "www.cryptohagen.dk"
|
||||
|
||||
ulovliglogning_website:
|
||||
file: websites/ulovliglogning.dk.yml
|
||||
domains:
|
||||
- "ulovliglogning.dk"
|
||||
- "www.ulovliglogning.dk"
|
||||
|
@ -153,44 +143,42 @@ services:
|
|||
- "www.ulovlig-logning.dk"
|
||||
|
||||
cryptoaarhus_website:
|
||||
file: websites/cryptoaarhus.dk.yml
|
||||
domains:
|
||||
- "cryptoaarhus.dk"
|
||||
- "www.cryptoaarhus.dk"
|
||||
|
||||
drone:
|
||||
file: drone.yml
|
||||
domain: "drone.{{ base_domain }}"
|
||||
volume_folder: "{{ volume_root_folder }}/drone"
|
||||
version: "1"
|
||||
|
||||
mailu:
|
||||
file: mailu.yml
|
||||
version: "1.9"
|
||||
domain: "mail.{{ base_domain }}"
|
||||
volume_folder: "{{ volume_root_folder }}/mailu"
|
||||
pre_deploy_tasks: true
|
||||
dns: 192.168.203.254
|
||||
subnet: 192.168.203.0/24
|
||||
volume_folder: "{{ volume_root_folder }}/mailu"
|
||||
version: "1.9"
|
||||
|
||||
mastodon:
|
||||
file: mastodon.yml
|
||||
domain: "social.{{ base_domain }}"
|
||||
volume_folder: "{{ volume_root_folder }}/mastodon"
|
||||
pre_deploy_tasks: true
|
||||
post_deploy_tasks: true
|
||||
version: v4.2.0
|
||||
postgres_version: 14-alpine
|
||||
redis_version: 6-alpine
|
||||
allowed_sender_domain: true
|
||||
|
||||
rallly:
|
||||
file: rallly.yml
|
||||
domain: "when.{{ base_domain }}"
|
||||
volume_folder: "{{ volume_root_folder }}/rallly"
|
||||
pre_deploy_tasks: true
|
||||
version: "2"
|
||||
postgres_version: 14-alpine
|
||||
allowed_sender_domain: true
|
||||
|
||||
membersystem:
|
||||
file: membersystem.yml
|
||||
domain: "member.{{ base_domain }}"
|
||||
django_admins: "Vidir:valberg@orn.li"
|
||||
volume_folder: "{{ volume_root_folder }}/membersystem"
|
||||
|
@ -199,6 +187,5 @@ services:
|
|||
allowed_sender_domain: true
|
||||
|
||||
watchtower:
|
||||
file: watchtower.yml
|
||||
volume_folder: "{{ volume_root_folder }}/watchtower"
|
||||
version: "1.5.3"
|
||||
|
|
13
roles/docker/tasks/post_deploy/docker_registry.yml
Normal file
13
roles/docker/tasks/post_deploy/docker_registry.yml
Normal file
|
@ -0,0 +1,13 @@
|
|||
# vim: ft=yaml.ansible
|
||||
---
|
||||
- name: Generate htpasswd file
|
||||
shell: docker compose exec registry htpasswd -Bbn docker {{ docker_password }} > auth/htpasswd
|
||||
args:
|
||||
chdir: "{{ services.docker_registry.volume_folder }}"
|
||||
creates: "{{ services.docker_registry.volume_folder }}/auth/htpasswd"
|
||||
|
||||
- name: log in to registry
|
||||
docker_login:
|
||||
registry: "{{ 'docker.data.coop' if vagrant else services.docker_registry.domain }}"
|
||||
username: docker
|
||||
password: "{{ docker_password }}"
|
19
roles/docker/tasks/post_deploy/mastodon.yml
Normal file
19
roles/docker/tasks/post_deploy/mastodon.yml
Normal file
|
@ -0,0 +1,19 @@
|
|||
# vim: ft=yaml.ansible
|
||||
---
|
||||
- name: Configure cron job to remove old Mastodon media daily
|
||||
cron:
|
||||
name: Clean Mastodon media data older than a week
|
||||
cron_file: ansible_mastodon_clean_media
|
||||
job: docker exec mastodon_web_1 tootctl media remove --days 7
|
||||
special_time: daily
|
||||
user: root
|
||||
state: present
|
||||
|
||||
- name: Configure cron job to remove old Mastodon preview cards daily
|
||||
cron:
|
||||
name: Clean Mastodon preview card data older than two weeks
|
||||
cron_file: ansible_mastodon_clean_preview_cards
|
||||
job: docker exec mastodon_web_1 tootctl preview_cards remove --days 14
|
||||
special_time: daily
|
||||
user: root
|
||||
state: present
|
17
roles/docker/tasks/pre_deploy/docker_registry.yml
Normal file
17
roles/docker/tasks/pre_deploy/docker_registry.yml
Normal file
|
@ -0,0 +1,17 @@
|
|||
# vim: ft=yaml.ansible
|
||||
---
|
||||
- name: Create subfolders
|
||||
file:
|
||||
path: "{{ services.docker_registry.volume_folder }}/{{ volume }}"
|
||||
state: directory
|
||||
loop:
|
||||
- auth
|
||||
- registry
|
||||
loop_control:
|
||||
loop_var: volume
|
||||
|
||||
- name: Copy docker registry vhost configuration
|
||||
copy:
|
||||
src: vhost/docker_registry
|
||||
dest: "{{ services.nginx_proxy.volume_folder }}/vhost/{{ services.docker_registry.domain }}"
|
||||
mode: "0644"
|
|
@ -1,16 +1,16 @@
|
|||
# vim: ft=yaml.ansible
|
||||
---
|
||||
- name: Create Element volume folder
|
||||
- name: Create subfolder
|
||||
file:
|
||||
name: "{{ services.element.volume_folder }}/data"
|
||||
state: directory
|
||||
|
||||
- name: Upload Element config.json
|
||||
- name: Upload config.json
|
||||
template:
|
||||
src: element/config.json.j2
|
||||
dest: "{{ services.element.volume_folder }}/data/config.json"
|
||||
|
||||
- name: Upload Element riot.im.conf
|
||||
- name: Upload riot.im.conf
|
||||
copy:
|
||||
src: element/riot.im.conf
|
||||
dest: "{{ services.element.volume_folder }}/data/riot.im.conf"
|
||||
|
@ -19,14 +19,3 @@
|
|||
copy:
|
||||
src: vhost/element
|
||||
dest: "{{ services.nginx_proxy.volume_folder }}/vhost/{{ services.element.domain }}"
|
||||
|
||||
- name: Upload Compose file for Element
|
||||
template:
|
||||
src: compose-files/element.yml.j2
|
||||
dest: "{{ services.element.volume_folder }}/docker-compose.yml"
|
||||
|
||||
- name: Deploy Element
|
||||
docker_compose:
|
||||
project_src: "{{ services.element.volume_folder }}"
|
||||
pull: true
|
||||
state: present
|
17
roles/docker/tasks/pre_deploy/hedgedoc.yml
Normal file
17
roles/docker/tasks/pre_deploy/hedgedoc.yml
Normal file
|
@ -0,0 +1,17 @@
|
|||
# vim: ft=yaml.ansible
|
||||
---
|
||||
- name: Create subfolders
|
||||
file:
|
||||
name: "{{ services.hedgedoc.volume_folder }}/{{ volume }}"
|
||||
state: directory
|
||||
loop:
|
||||
- db
|
||||
- hedgedoc/uploads
|
||||
loop_control:
|
||||
loop_var: volume
|
||||
|
||||
- name: Copy SSO certificate
|
||||
copy:
|
||||
src: sso/sso.data.coop.pem
|
||||
dest: "{{ services.hedgedoc.volume_folder }}/sso.data.coop.pem"
|
||||
mode: "0644"
|
|
@ -1,6 +1,6 @@
|
|||
# vim: ft=yaml.ansible
|
||||
---
|
||||
- name: create mailu volume folders
|
||||
- name: Create subfolders
|
||||
file:
|
||||
name: "{{ services.mailu.volume_folder }}/{{ volume }}"
|
||||
state: directory
|
||||
|
@ -23,12 +23,12 @@
|
|||
loop_control:
|
||||
loop_var: volume
|
||||
|
||||
- name: upload mailu.env file
|
||||
- name: Upload mailu.env file
|
||||
template:
|
||||
src: mailu/env.j2
|
||||
dest: "{{ services.mailu.volume_folder }}/mailu.env"
|
||||
|
||||
- name: hard link to Let's Encrypt TLS certificate
|
||||
- name: Hard link to Let's Encrypt TLS certificate
|
||||
file:
|
||||
src: "{{ services.nginx_proxy.volume_folder }}/certs/{{ services.mailu.domain }}/fullchain.pem"
|
||||
dest: "{{ services.mailu.volume_folder }}/certs/cert.pem"
|
||||
|
@ -36,21 +36,10 @@
|
|||
force: true
|
||||
when: letsencrypt_enabled
|
||||
|
||||
- name: hard link to Let's Encrypt TLS key
|
||||
- name: Hard link to Let's Encrypt TLS key
|
||||
file:
|
||||
src: "{{ services.nginx_proxy.volume_folder }}/certs/{{ services.mailu.domain }}/key.pem"
|
||||
dest: "{{ services.mailu.volume_folder }}/certs/key.pem"
|
||||
state: hard
|
||||
force: true
|
||||
when: letsencrypt_enabled
|
||||
|
||||
- name: Upload Compose file for for Mailu
|
||||
template:
|
||||
src: compose-files/mailu.yml.j2
|
||||
dest: "{{ services.mailu.volume_folder }}/docker-compose.yml"
|
||||
|
||||
- name: Deploy Mailu
|
||||
docker_compose:
|
||||
project_src: "{{ services.mailu.volume_folder }}"
|
||||
pull: true
|
||||
state: present
|
45
roles/docker/tasks/pre_deploy/mastodon.yml
Normal file
45
roles/docker/tasks/pre_deploy/mastodon.yml
Normal file
|
@ -0,0 +1,45 @@
|
|||
# vim: ft=yaml.ansible
|
||||
---
|
||||
- name: Create subfolder for Mastodon data
|
||||
file:
|
||||
name: "{{ services.mastodon.volume_folder }}/mastodon_data"
|
||||
state: directory
|
||||
owner: "991"
|
||||
mode: u=rwx,g=rx,o=rx
|
||||
|
||||
- name: Create subfolder for PostgreSQL data
|
||||
file:
|
||||
name: "{{ services.mastodon.volume_folder }}/postgres_data"
|
||||
state: directory
|
||||
owner: "70"
|
||||
mode: u=rwx,go=
|
||||
|
||||
- name: Create subfolder for PostgreSQL config
|
||||
file:
|
||||
name: "{{ services.mastodon.volume_folder }}/postgres_config"
|
||||
state: directory
|
||||
owner: root
|
||||
mode: u=rwx,g=rx,o=rx
|
||||
|
||||
- name: Create subfolder for Redis data
|
||||
file:
|
||||
name: "{{ services.mastodon.volume_folder }}/redis_data"
|
||||
state: directory
|
||||
owner: "999"
|
||||
group: "1000"
|
||||
mode: u=rwx,g=rx,o=rx
|
||||
|
||||
- name: Upload mastodon.env file
|
||||
template:
|
||||
src: mastodon/env.j2
|
||||
dest: "{{ services.mastodon.volume_folder }}/mastodon.env"
|
||||
|
||||
- name: Upload vhost config for Mastodon domain
|
||||
copy:
|
||||
src: vhost/mastodon
|
||||
dest: "{{ services.nginx_proxy.volume_folder }}/vhost/{{ services.mastodon.domain }}"
|
||||
|
||||
- name: Upload PostgreSQL config
|
||||
copy:
|
||||
src: mastodon/postgresql.conf
|
||||
dest: "{{ services.mastodon.volume_folder }}/postgres_config/postgresql.conf"
|
|
@ -1,24 +1,24 @@
|
|||
# vim: ft=yaml.ansible
|
||||
---
|
||||
- name: Create Matrix volume folders
|
||||
- name: Create subfolders
|
||||
file:
|
||||
name: "{{ services.matrix.volume_folder }}/{{ volume }}"
|
||||
state: directory
|
||||
owner: "991"
|
||||
group: "991"
|
||||
loop:
|
||||
- "data"
|
||||
- "data/uploads"
|
||||
- "data/media"
|
||||
- data
|
||||
- data/uploads
|
||||
- data/media
|
||||
loop_control:
|
||||
loop_var: volume
|
||||
|
||||
- name: Create Matrix DB folder
|
||||
- name: Create Matrix DB subfolder
|
||||
file:
|
||||
name: "{{ services.matrix.volume_folder }}/db"
|
||||
state: directory
|
||||
|
||||
- name: upload vhost config for matrix domain
|
||||
- name: Upload vhost config for Matrix domain
|
||||
copy:
|
||||
src: vhost/matrix
|
||||
dest: "{{ services.nginx_proxy.volume_folder }}/vhost/{{ services.matrix.domain }}"
|
||||
|
@ -28,18 +28,7 @@
|
|||
src: matrix/homeserver.yaml.j2
|
||||
dest: "{{ services.matrix.volume_folder }}/data/homeserver.yaml"
|
||||
|
||||
- name: upload matrix logging config
|
||||
- name: Upload Matrix logging config
|
||||
copy:
|
||||
src: matrix/log.config
|
||||
dest: "{{ services.matrix.volume_folder }}/data/matrix.data.coop.log.config"
|
||||
|
||||
- name: Upload Compose file for Matrix
|
||||
template:
|
||||
src: compose-files/matrix.yml.j2
|
||||
dest: "{{ services.matrix.volume_folder }}/docker-compose.yml"
|
||||
|
||||
- name: Deploy Matrix
|
||||
docker_compose:
|
||||
project_src: "{{ services.matrix.volume_folder }}"
|
||||
pull: true
|
||||
state: present
|
17
roles/docker/tasks/pre_deploy/nextcloud.yml
Normal file
17
roles/docker/tasks/pre_deploy/nextcloud.yml
Normal file
|
@ -0,0 +1,17 @@
|
|||
# vim: ft=yaml.ansible
|
||||
---
|
||||
- name: Create subfolders
|
||||
file:
|
||||
path: "{{ services.nextcloud.volume_folder }}/{{ volume }}"
|
||||
state: directory
|
||||
loop:
|
||||
- app
|
||||
- postgres
|
||||
loop_control:
|
||||
loop_var: volume
|
||||
|
||||
- name: Upload vhost config for Nextcloud domain
|
||||
copy:
|
||||
src: vhost/nextcloud
|
||||
dest: "{{ services.nginx_proxy.volume_folder }}/vhost/{{ services.nextcloud.domain }}"
|
||||
notify: "restart nginx"
|
14
roles/docker/tasks/pre_deploy/nginx_proxy.yml
Normal file
14
roles/docker/tasks/pre_deploy/nginx_proxy.yml
Normal file
|
@ -0,0 +1,14 @@
|
|||
# vim: ft=yaml.ansible
|
||||
---
|
||||
- name: Create subfolders
|
||||
file:
|
||||
name: "{{ services.nginx_proxy.volume_folder }}/{{ volume }}"
|
||||
state: directory
|
||||
loop:
|
||||
- conf
|
||||
- vhost
|
||||
- html
|
||||
- dhparam
|
||||
- certs
|
||||
loop_control:
|
||||
loop_var: volume
|
12
roles/docker/tasks/pre_deploy/openldap.yml
Normal file
12
roles/docker/tasks/pre_deploy/openldap.yml
Normal file
|
@ -0,0 +1,12 @@
|
|||
# vim: ft=yaml.ansible
|
||||
---
|
||||
- name: Create subfolders
|
||||
file:
|
||||
name: "{{ services.openldap.volume_folder }}/{{ volume }}"
|
||||
state: directory
|
||||
loop:
|
||||
- var/lib/ldap
|
||||
- etc/slapd
|
||||
- certs
|
||||
loop_control:
|
||||
loop_var: volume
|
13
roles/docker/tasks/pre_deploy/postfix.yml
Normal file
13
roles/docker/tasks/pre_deploy/postfix.yml
Normal file
|
@ -0,0 +1,13 @@
|
|||
# vim: ft=yaml.ansible
|
||||
---
|
||||
- name: Set up network for Postfix
|
||||
docker_network:
|
||||
name: postfix
|
||||
ipam_config:
|
||||
- subnet: '172.16.0.0/16'
|
||||
gateway: 172.16.0.1
|
||||
|
||||
- name: Create subfolder
|
||||
file:
|
||||
name: "{{ services.postfix.volume_folder }}/dkim"
|
||||
state: directory
|
16
roles/docker/tasks/pre_deploy/privatebin.yml
Normal file
16
roles/docker/tasks/pre_deploy/privatebin.yml
Normal file
|
@ -0,0 +1,16 @@
|
|||
# vim: ft=yaml.ansible
|
||||
---
|
||||
- name: Create subfolders
|
||||
file:
|
||||
name: "{{ services.privatebin.volume_folder }}/{{ volume }}"
|
||||
state: directory
|
||||
loop:
|
||||
- cfg
|
||||
- data
|
||||
loop_control:
|
||||
loop_var: volume
|
||||
|
||||
- name: Upload PrivateBin config
|
||||
copy:
|
||||
src: privatebin/conf.php
|
||||
dest: "{{ services.privatebin.volume_folder }}/cfg/conf.php"
|
11
roles/docker/tasks/pre_deploy/rallly.yml
Normal file
11
roles/docker/tasks/pre_deploy/rallly.yml
Normal file
|
@ -0,0 +1,11 @@
|
|||
# vim: ft=yaml.ansible
|
||||
---
|
||||
- name: Create subfolder
|
||||
file:
|
||||
name: "{{ services.rallly.volume_folder }}/postgres"
|
||||
state: directory
|
||||
|
||||
- name: Copy rallly.env file
|
||||
template:
|
||||
src: rallly/env.j2
|
||||
dest: "{{ services.rallly.volume_folder }}/rallly.env"
|
|
@ -8,7 +8,7 @@
|
|||
mode: '0755'
|
||||
state: directory
|
||||
|
||||
- name: Copy private SSH key
|
||||
- name: Upload private SSH key
|
||||
copy:
|
||||
dest: "{{ services.restic.volume_folder }}/ssh/id_ed25519"
|
||||
owner: root
|
||||
|
@ -31,7 +31,7 @@
|
|||
mode: '0644'
|
||||
state: touch
|
||||
|
||||
- name: Create SSH config
|
||||
- name: Upload SSH config
|
||||
template:
|
||||
src: restic/ssh.config.j2
|
||||
dest: "{{ services.restic.volume_folder }}/ssh/config"
|
||||
|
@ -39,21 +39,10 @@
|
|||
group: root
|
||||
mode: '0600'
|
||||
|
||||
- name: Create SSH known_hosts file
|
||||
- name: Upload SSH known_hosts file
|
||||
template:
|
||||
src: restic/ssh.known_hosts.j2
|
||||
dest: "{{ services.restic.volume_folder }}/ssh/known_hosts"
|
||||
owner: root
|
||||
group: root
|
||||
mode: '0600'
|
||||
|
||||
- name: Upload Compose file for Restic
|
||||
template:
|
||||
src: compose-files/restic.yml.j2
|
||||
dest: "{{ services.restic.volume_folder }}/docker-compose.yml"
|
||||
|
||||
- name: Deploy Restic
|
||||
docker_compose:
|
||||
project_src: "{{ services.restic.volume_folder }}"
|
||||
pull: true
|
||||
state: present
|
|
@ -4,6 +4,37 @@
|
|||
docker_network:
|
||||
name: external_services
|
||||
|
||||
- name: Service block
|
||||
loop: "{{ services | dict2items(key_name='name', value_name='vars') }}"
|
||||
loop_control:
|
||||
loop_var: service
|
||||
when: single_service is not defined and
|
||||
(service.vars.disabled_in_vagrant is not defined or
|
||||
not (service.vars.disabled_in_vagrant and vagrant))
|
||||
block:
|
||||
- name: Create volume folder
|
||||
file:
|
||||
name: "{{ service.vars.volume_folder }}"
|
||||
state: directory
|
||||
|
||||
- name: Upload Compose file
|
||||
template:
|
||||
src: compose-files/{{ service.name }}.yml.j2
|
||||
dest: "{{ service.vars.volume_folder }}/docker-compose.yml"
|
||||
|
||||
- name: Run pre-deployment tasks
|
||||
include_tasks: pre_deploy/{{ service.name }}.yml
|
||||
when: service.vars.pre_deploy_tasks is defined and service.pre_deploy_tasks
|
||||
|
||||
- name: Deploy Compose stack
|
||||
command: docker compose up -d --remove-orphans --pull always
|
||||
args:
|
||||
chdir: "{{ service.vars.volume_folder }}"
|
||||
|
||||
- name: Run post-deployment tasks
|
||||
include_tasks: post_deploy/{{ service.name }}.yml
|
||||
when: service.vars.post_deploy_tasks is defined and service.post_deploy_tasks
|
||||
|
||||
- name: setup services
|
||||
include_tasks: "services/{{ item.service.file }}"
|
||||
loop: "{{ services | dict2items(value_name='service') }}"
|
||||
|
|
|
@ -1,40 +0,0 @@
|
|||
# vim: ft=yaml.ansible
|
||||
---
|
||||
- name: Create Docker registry volume folders
|
||||
file:
|
||||
path: "{{ services.docker_registry.volume_folder }}/{{ volume }}"
|
||||
state: directory
|
||||
loop:
|
||||
- auth
|
||||
- registry
|
||||
loop_control:
|
||||
loop_var: volume
|
||||
|
||||
- name: Copy docker registry vhost configuration
|
||||
copy:
|
||||
src: vhost/docker_registry
|
||||
dest: "{{ services.nginx_proxy.volume_folder }}/vhost/{{ services.docker_registry.domain }}"
|
||||
mode: "0644"
|
||||
|
||||
- name: Upload Compose file for Docker registry
|
||||
template:
|
||||
src: compose-files/docker_registry.yml.j2
|
||||
dest: "{{ services.docker_registry.volume_folder }}/docker-compose.yml"
|
||||
|
||||
- name: Deploy Docker registry
|
||||
docker_compose:
|
||||
project_src: "{{ services.docker_registry.volume_folder }}"
|
||||
pull: true
|
||||
state: present
|
||||
|
||||
- name: Generate htpasswd file
|
||||
shell: "docker compose exec registry htpasswd -Bbn docker {{ docker_password }} > auth/htpasswd"
|
||||
args:
|
||||
chdir: "{{ services.docker_registry.volume_folder }}"
|
||||
creates: "{{ services.docker_registry.volume_folder }}/auth/htpasswd"
|
||||
|
||||
- name: log in to registry
|
||||
docker_login:
|
||||
registry: "{{ 'docker.data.coop' if vagrant else services.docker_registry.domain }}"
|
||||
username: "docker"
|
||||
password: "{{ docker_password }}"
|
|
@ -1,17 +0,0 @@
|
|||
# vim: ft=yaml.ansible
|
||||
---
|
||||
- name: Create Drone volume folder
|
||||
file:
|
||||
path: "{{ services.drone.volume_folder }}"
|
||||
state: directory
|
||||
|
||||
- name: Upload Compose file for Drone
|
||||
template:
|
||||
src: compose-files/drone.yml.j2
|
||||
dest: "{{ services.drone.volume_folder }}/docker-compose.yml"
|
||||
|
||||
- name: Deploy Drone
|
||||
docker_compose:
|
||||
project_src: "{{ services.drone.volume_folder }}"
|
||||
pull: true
|
||||
state: present
|
|
@ -1,17 +0,0 @@
|
|||
# vim: ft=yaml.ansible
|
||||
---
|
||||
- name: Create Forgejo volume folder
|
||||
file:
|
||||
name: "{{ services.portainer.volume_folder }}"
|
||||
state: directory
|
||||
|
||||
- name: Upload Compose file for Forgejo
|
||||
template:
|
||||
src: compose-files/forgejo.yml.j2
|
||||
dest: "{{ services.forgejo.volume_folder }}/docker-compose.yml"
|
||||
|
||||
- name: Deploy Forgejo
|
||||
docker_compose:
|
||||
project_src: "{{ services.forgejo.volume_folder }}"
|
||||
pull: true
|
||||
state: present
|
|
@ -1,28 +0,0 @@
|
|||
# vim: ft=yaml.ansible
|
||||
---
|
||||
- name: create hedgedoc volume folders
|
||||
file:
|
||||
name: "{{ services.hedgedoc.volume_folder }}/{{ volume }}"
|
||||
state: directory
|
||||
loop:
|
||||
- "db"
|
||||
- "hedgedoc/uploads"
|
||||
loop_control:
|
||||
loop_var: volume
|
||||
|
||||
- name: copy sso public certificate
|
||||
copy:
|
||||
src: sso/sso.data.coop.pem
|
||||
dest: "{{ services.hedgedoc.volume_folder }}/sso.data.coop.pem"
|
||||
mode: "0644"
|
||||
|
||||
- name: Upload Compose file for for HedgeDoc
|
||||
template:
|
||||
src: compose-files/hedgedoc.yml.j2
|
||||
dest: "{{ services.hedgedoc.volume_folder }}/docker-compose.yml"
|
||||
|
||||
- name: setup hedgedoc
|
||||
docker_compose:
|
||||
project_src: "{{ services.hedgedoc.volume_folder }}"
|
||||
pull: true
|
||||
state: present
|
|
@ -1,17 +0,0 @@
|
|||
# vim: ft=yaml.ansible
|
||||
---
|
||||
- name: Create Keycloak volume folder
|
||||
file:
|
||||
path: "{{ services.keycloak.volume_folder }}/data"
|
||||
state: directory
|
||||
|
||||
- name: Upload Compose file for for Keycloak
|
||||
template:
|
||||
src: compose-files/keycloak.yml.j2
|
||||
dest: "{{ services.keycloak.volume_folder }}/docker-compose.yml"
|
||||
|
||||
- name: Deploy Keycloak
|
||||
docker_compose:
|
||||
project_src: "{{ services.keycloak.volume_folder }}"
|
||||
pull: true
|
||||
state: present
|
|
@ -1,75 +0,0 @@
|
|||
# vim: ft=yaml.ansible
|
||||
---
|
||||
- name: Create volume folder for Mastodon data
|
||||
file:
|
||||
name: "{{ services.mastodon.volume_folder }}/mastodon_data"
|
||||
state: directory
|
||||
owner: "991"
|
||||
mode: u=rwx,g=rx,o=rx
|
||||
|
||||
- name: Create volume folder for PostgreSQL data
|
||||
file:
|
||||
name: "{{ services.mastodon.volume_folder }}/postgres_data"
|
||||
state: directory
|
||||
owner: "70"
|
||||
mode: u=rwx,go=
|
||||
|
||||
- name: Create volume folder for PostgreSQL config
|
||||
file:
|
||||
name: "{{ services.mastodon.volume_folder }}/postgres_config"
|
||||
state: directory
|
||||
owner: root
|
||||
mode: u=rwx,g=rx,o=rx
|
||||
|
||||
- name: Create volume folder for Redis data
|
||||
file:
|
||||
name: "{{ services.mastodon.volume_folder }}/redis_data"
|
||||
state: directory
|
||||
owner: "999"
|
||||
group: "1000"
|
||||
mode: u=rwx,g=rx,o=rx
|
||||
|
||||
- name: Copy mastodon environment file
|
||||
template:
|
||||
src: mastodon/env.j2
|
||||
dest: "{{ services.mastodon.volume_folder }}/mastodon.env"
|
||||
|
||||
- name: Upload vhost config for Mastodon domain
|
||||
copy:
|
||||
src: vhost/mastodon
|
||||
dest: "{{ services.nginx_proxy.volume_folder }}/vhost/{{ services.mastodon.domain }}"
|
||||
|
||||
- name: Copy PostgreSQL config
|
||||
copy:
|
||||
src: mastodon/postgresql.conf
|
||||
dest: "{{ services.mastodon.volume_folder }}/postgres_config/postgresql.conf"
|
||||
|
||||
- name: Upload Compose file for Mastodon
|
||||
template:
|
||||
src: compose-files/mastodon.yml.j2
|
||||
dest: "{{ services.mastodon.volume_folder }}/docker-compose.yml"
|
||||
|
||||
- name: Deploy Mastodon
|
||||
docker_compose:
|
||||
project_src: "{{ services.mastodon.volume_folder }}"
|
||||
pull: true
|
||||
restarted: true
|
||||
state: present
|
||||
|
||||
- name: Configure cron job to remove old Mastodon media daily
|
||||
cron:
|
||||
name: Clean Mastodon media data older than a week
|
||||
cron_file: ansible_mastodon_clean_media
|
||||
job: docker exec mastodon_web_1 tootctl media remove --days 7
|
||||
special_time: daily
|
||||
user: root
|
||||
state: present
|
||||
|
||||
- name: Configure cron job to remove old Mastodon preview cards daily
|
||||
cron:
|
||||
name: Clean Mastodon preview card data older than two weeks
|
||||
cron_file: ansible_mastodon_clean_preview_cards
|
||||
job: docker exec mastodon_web_1 tootctl preview_cards remove --days 14
|
||||
special_time: daily
|
||||
user: root
|
||||
state: present
|
|
@ -1,17 +0,0 @@
|
|||
# vim: ft=yaml.ansible
|
||||
---
|
||||
- name: Create Membersystem volume folder
|
||||
file:
|
||||
name: "{{ services.membersystem.volume_folder }}"
|
||||
state: directory
|
||||
|
||||
- name: Upload Compose file for Membersystem
|
||||
template:
|
||||
src: compose-files/membersystem.yml.j2
|
||||
dest: "{{ services.membersystem.volume_folder }}/docker-compose.yml"
|
||||
|
||||
- name: Deploy Membersystem
|
||||
docker_compose:
|
||||
project_src: "{{ services.membersystem.volume_folder }}"
|
||||
pull: true
|
||||
state: present
|
|
@ -1,17 +0,0 @@
|
|||
# vim: ft=yaml.ansible
|
||||
---
|
||||
- name: Create Netdata volume folder
|
||||
file:
|
||||
path: "{{ services.netdata.volume_folder }}"
|
||||
state: directory
|
||||
|
||||
- name: Upload Compose file for Netdata
|
||||
template:
|
||||
src: compose-files/netdata.yml.j2
|
||||
dest: "{{ services.netdata.volume_folder }}/docker-compose.yml"
|
||||
|
||||
- name: Deploy Netdata
|
||||
docker_compose:
|
||||
project_src: "{{ services.netdata.volume_folder }}"
|
||||
pull: true
|
||||
state: present
|
|
@ -1,28 +0,0 @@
|
|||
# vim: ft=yaml.ansible
|
||||
---
|
||||
- name: Create Nextcloud volume folders
|
||||
file:
|
||||
path: "{{ services.nextcloud.volume_folder }}/{{ volume }}"
|
||||
state: directory
|
||||
loop:
|
||||
- app
|
||||
- postgres
|
||||
loop_control:
|
||||
loop_var: volume
|
||||
|
||||
- name: upload vhost config for cloud.data.coop
|
||||
copy:
|
||||
src: vhost/nextcloud
|
||||
dest: "{{ services.nginx_proxy.volume_folder }}/vhost/{{ services.nextcloud.domain }}"
|
||||
notify: "restart nginx"
|
||||
|
||||
- name: Upload Compose file for Nextcloud
|
||||
template:
|
||||
src: compose-files/nextcloud.yml.j2
|
||||
dest: "{{ services.nextcloud.volume_folder }}/docker-compose.yml"
|
||||
|
||||
- name: Deploy Nextcloud
|
||||
docker_compose:
|
||||
project_src: "{{ services.nextcloud.volume_folder }}"
|
||||
pull: true
|
||||
state: present
|
|
@ -1,25 +0,0 @@
|
|||
# vim: ft=yaml.ansible
|
||||
---
|
||||
- name: create nginx-proxy volume folders
|
||||
file:
|
||||
name: "{{ services.nginx_proxy.volume_folder }}/{{ volume }}"
|
||||
state: directory
|
||||
loop:
|
||||
- conf
|
||||
- vhost
|
||||
- html
|
||||
- dhparam
|
||||
- certs
|
||||
loop_control:
|
||||
loop_var: volume
|
||||
|
||||
- name: Upload Compose file for nginx-proxy
|
||||
template:
|
||||
src: compose-files/nginx_proxy.yml.j2
|
||||
dest: "{{ services.nginx_proxy.volume_folder }}/docker-compose.yml"
|
||||
|
||||
- name: Deploy nginx-proxy
|
||||
docker_compose:
|
||||
project_src: "{{ services.nginx_proxy.volume_folder }}"
|
||||
pull: true
|
||||
state: present
|
|
@ -1,23 +0,0 @@
|
|||
# vim: ft=yaml.ansible
|
||||
---
|
||||
- name: Create OpenLDAP volume folders
|
||||
file:
|
||||
name: "{{ services.openldap.volume_folder }}/{{ volume }}"
|
||||
state: directory
|
||||
loop:
|
||||
- var/lib/ldap
|
||||
- etc/slapd
|
||||
- certs
|
||||
loop_control:
|
||||
loop_var: volume
|
||||
|
||||
- name: Upload Compose file for OpenLDAP
|
||||
template:
|
||||
src: compose-files/openldap.yml.j2
|
||||
dest: "{{ services.openldap.volume_folder }}/docker-compose.yml"
|
||||
|
||||
- name: Deploy OpenLDAP
|
||||
docker_compose:
|
||||
project_src: "{{ services.openldap.volume_folder }}"
|
||||
pull: true
|
||||
state: present
|
|
@ -1,19 +0,0 @@
|
|||
# vim: ft=yaml.ansible
|
||||
---
|
||||
- name: Create directory for Passit data
|
||||
file:
|
||||
name: "{{ services.passit.volume_folder }}/data"
|
||||
owner: '70'
|
||||
group: root
|
||||
state: directory
|
||||
|
||||
- name: Upload Compose file for Passit
|
||||
template:
|
||||
src: compose-files/passit.yml.j2
|
||||
dest: "{{ services.passit.volume_folder }}/docker-compose.yml"
|
||||
|
||||
- name: Deploy Passit
|
||||
docker_compose:
|
||||
project_src: "{{ services.passit.volume_folder }}"
|
||||
pull: true
|
||||
state: present
|
|
@ -1,17 +0,0 @@
|
|||
# vim: ft=yaml.ansible
|
||||
---
|
||||
- name: create portainer volume folder
|
||||
file:
|
||||
name: "{{ services.portainer.volume_folder }}"
|
||||
state: directory
|
||||
|
||||
- name: Upload Compose file for Portainer
|
||||
template:
|
||||
src: compose-files/portainer.yml.j2
|
||||
dest: "{{ services.portainer.volume_folder }}/docker-compose.yml"
|
||||
|
||||
- name: Deploy Portainer
|
||||
docker_compose:
|
||||
project_src: "{{ services.portainer.volume_folder }}"
|
||||
pull: true
|
||||
state: present
|
|
@ -1,24 +0,0 @@
|
|||
# vim: ft=yaml.ansible
|
||||
---
|
||||
- name: Set up network for Postfix
|
||||
docker_network:
|
||||
name: postfix
|
||||
ipam_config:
|
||||
- subnet: '172.16.0.0/16'
|
||||
gateway: 172.16.0.1
|
||||
|
||||
- name: Create volume folders for Postfix
|
||||
file:
|
||||
name: "{{ services.postfix.volume_folder }}/dkim"
|
||||
state: directory
|
||||
|
||||
- name: Upload Compose file for Postfix
|
||||
template:
|
||||
src: compose-files/postfix.yml.j2
|
||||
dest: "{{ services.forgejo.volume_folder }}/docker-compose.yml"
|
||||
|
||||
- name: Deploy Postfix
|
||||
docker_compose:
|
||||
project_src: "{{ services.postfix.volume_folder }}"
|
||||
pull: true
|
||||
state: present
|
|
@ -1,27 +0,0 @@
|
|||
# vim: ft=yaml.ansible
|
||||
---
|
||||
- name: create privatebin volume folders
|
||||
file:
|
||||
name: "{{ services.privatebin.volume_folder }}/{{ volume }}"
|
||||
state: directory
|
||||
loop:
|
||||
- cfg
|
||||
- data
|
||||
loop_control:
|
||||
loop_var: volume
|
||||
|
||||
- name: upload privatebin config
|
||||
copy:
|
||||
src: privatebin/conf.php
|
||||
dest: "{{ services.privatebin.volume_folder }}/cfg/conf.php"
|
||||
|
||||
- name: Upload Compose file for PrivateBin
|
||||
template:
|
||||
src: compose-files/privatebin.yml.j2
|
||||
dest: "{{ services.privatebin.volume_folder }}/docker-compose.yml"
|
||||
|
||||
- name: Deploy PrivateBin
|
||||
docker_compose:
|
||||
project_src: "{{ services.private.volume_folder }}"
|
||||
pull: true
|
||||
state: present
|
|
@ -1,22 +0,0 @@
|
|||
# vim: ft=yaml.ansible
|
||||
---
|
||||
- name: Create Rallly volume folders
|
||||
file:
|
||||
name: "{{ services.rallly.volume_folder }}/postgres"
|
||||
state: directory
|
||||
|
||||
- name: Copy Rallly environment file
|
||||
template:
|
||||
src: rallly/env.j2
|
||||
dest: "{{ services.rallly.volume_folder }}/rallly.env"
|
||||
|
||||
- name: Upload Compose file for Rallly
|
||||
template:
|
||||
src: compose-files/rallly.yml.j2
|
||||
dest: "{{ services.rallly.volume_folder }}/docker-compose.yml"
|
||||
|
||||
- name: Deploy Rallly
|
||||
docker_compose:
|
||||
project_src: "{{ services.rallly.volume_folder }}"
|
||||
pull: true
|
||||
state: present
|
|
@ -1,17 +0,0 @@
|
|||
# vim: ft=yaml.ansible
|
||||
---
|
||||
- name: Create Watchtower volume folder
|
||||
file:
|
||||
name: "{{ services.watchtower.volume_folder }}"
|
||||
state: directory
|
||||
|
||||
- name: Upload Compose file for Watchtower
|
||||
template:
|
||||
src: compose-files/watchtower.yml.j2
|
||||
dest: "{{ services.watchtower.volume_folder }}/docker-compose.yml"
|
||||
|
||||
- name: Deploy Watchtower
|
||||
docker_compose:
|
||||
project_src: "{{ services.watchtower.volume_folder }}"
|
||||
pull: true
|
||||
state: present
|
Loading…
Reference in a new issue