parameterize directories

This commit is contained in:
Pim Kunis 2023-01-07 20:32:42 +01:00
parent 5bf6d7acbc
commit cd17ed372c
21 changed files with 88 additions and 66 deletions

View file

@ -1,22 +1,22 @@
- name: Create Mastodon app directory
file:
path: /srv/mastodon
path: "{{ service_dir }}"
state: directory
- name: Copy .env.production
copy:
src: "{{ role_path }}/files/.env.production"
dest: /srv/mastodon/.env.production
dest: "{{ service_dir }}.env.production"
- name: Copy Docker Compose script
template:
src: "{{ role_path }}/templates/docker-compose.yml.j2"
dest: /srv/mastodon/docker-compose.yml
dest: "{{ service_dir }}/docker-compose.yml"
- name: Create Mastodon data directory
file:
path: /data/mastodon
path: "{{ data_dir }}"
state: directory
mode: 0777
- name: Start Docker Compose
docker_compose:
project_src: /srv/mastodon
project_src: "{{ service_dir }}"
pull: true
remove_orphans: true

View file

@ -9,7 +9,7 @@ services:
healthcheck:
test: ['CMD', 'pg_isready', '-U', 'postgres']
volumes:
- /data/mastodon/postgres14:/var/lib/postgresql/data
- {{ data_dir }}/postgres14:/var/lib/postgresql/data
environment:
- 'POSTGRES_HOST_AUTH_METHOD=trust'
- 'POSTGRES_PASSWORD={{ mastodon_postgres_password }}'
@ -24,7 +24,7 @@ services:
healthcheck:
test: ['CMD', 'redis-cli', 'ping']
volumes:
- /data/mastodon/redis:/data
- {{ data_dir }}/redis:/data
environment:
- 'REDIS_PASSWORD={{ mastodon_redis_password }}'
@ -46,7 +46,7 @@ services:
- db
- redis
volumes:
- /data/mastodon/public/system:/mastodon/public/system
- {{ data_dir }}/public/system:/mastodon/public/system
labels:
- traefik.http.routers.mastodon.entrypoints=websecure
- traefik.http.routers.mastodon.rule=Host(`social.pizzapim.nl`)
@ -91,7 +91,7 @@ services:
networks:
- default
volumes:
- /data/mastodon/public/system:/mastodon/public/system
- {{ data_dir }}/public/system:/mastodon/public/system
healthcheck:
test: ['CMD-SHELL', "ps aux | grep '[s]idekiq\ 6' || false"]

View file

@ -1,3 +1,7 @@
service_name: mastodon
data_dir: "{{ base_data_dir }}/{{ service_name }}"
service_dir: "{{ base_service_dir }}/{{ service_name }}"
mastodon_postgres_password: !vault |
$ANSIBLE_VAULT;1.1;AES256
34643131323762373635383736636432643161646130373565333432323337646435656233383131