homelab/roles/mastodon/tasks/main.yml

90 lines
2.3 KiB
YAML
Raw Normal View History

2024-09-29 18:04:34 +05:00
---
2024-10-21 21:16:05 +05:00
- name: Create mastodon docker network
become: true
community.docker.docker_network:
name: mastodon
- name: Create redis container
include_role:
name: redis
vars:
preset: persistent
container_name: redis-mastodon
docker_networks:
- name: mastodon
docker_volume: redis-mastodon
- name: Create redis cache container
include_role:
name: redis
vars:
preset: cache
container_name: redis-mastodon-cache
docker_networks:
- name: mastodon
- name: Create mastodon's public volume
become: true
community.docker.docker_volume:
name: mastodon-public-system
- name: Create mastodon config directory
become: true
ansible.builtin.file:
path: /etc/mastodon
state: directory
mode: '1750'
owner: root
group: root
- name: Copy env file
become: true
ansible.builtin.template:
src: mastodon.env.j2
dest: /etc/mastodon/.env
mode: '0660'
owner: root
group: root
- name: Create web container
become: true
community.docker.docker_container:
name: mastodon-web
image: ghcr.io/mastodon/mastodon:{{ version }}
env_file: /etc/mastodon/.env
command: ["bundle", "exec", "puma", "-C", "config/puma.rb"]
networks:
- name: mastodon
- name: postgresql
- name: minio
- name: haproxy
- name: authentik
ports:
- 127.0.0.1:3000:3000
volumes:
- mastodon-public-system:/mastodon/public/system
restart_policy: unless-stopped
- name: Create streaming container
become: true
community.docker.docker_container:
name: mastodon-streaming
image: ghcr.io/mastodon/mastodon-streaming:{{ version }}
env_file: /etc/mastodon/.env
command: ["node", "./streaming/index.js"]
networks:
- name: mastodon
- name: postgresql
- name: haproxy
ports:
- 127.0.0.1:3001:4000
restart_policy: unless-stopped
- name: Create sidekiq container
become: true
community.docker.docker_container:
name: mastodon-sidekiq
image: ghcr.io/mastodon/mastodon:{{ version }}
env_file: /etc/mastodon/.env
command: ["bundle", "exec", "sidekiq"]
networks:
- name: mastodon
- name: postgresql
- name: minio
- name: authentik
volumes:
- mastodon-public-system:/mastodon/public/system
restart_policy: unless-stopped