infra/roles/mayan/tasks/mayan.yml

100 lines
2.3 KiB
YAML

---
- name: create media dir
file:
path: "{{ systemuserlist.mayan.home }}/media"
state: directory
mode: 0750
owner: mayan
group: mayan
- name: create db dir
file:
path: "{{ systemuserlist.mayan.home }}/db"
state: directory
- name: template env file
template:
src: mayan.env.j2
dest: "{{ systemuserlist.mayan.home }}/mayan.env"
owner: mayan
group: mayan
mode: 0644
- name: postgres container
docker_container:
name: "mayan-postgresql"
image: "postgres:10.15-alpine"
auto_remove: no
pull: yes
container_default_behavior: compatibility
restart_policy: "unless-stopped"
env:
POSTGRES_USER: mayan
POSTGRES_DB: mayan
POSTGRES_PASSWORD: "{{ systemuserlist.mayan.postgres_pass }}"
volumes:
- "{{ systemuserlist.mayan.home }}/db:/var/lib/postgresql/data"
networks_cli_compatible: no
networks:
- name: bridgewithdns
tags:
- mayan-container
- docker-containers
- name: redis container
docker_container:
name: "mayan-redis"
image: "redis:latest"
auto_remove: no
restart_policy: "unless-stopped"
detach: yes
pull: yes
state: started
command: redis-server --appendonly "no" --databases "2"
labels:
dockerlogs_format: redis
env:
REDIS_HOST: "mayan-redis"
container_default_behavior: compatibility
networks_cli_compatible: no
networks:
- name: bridgewithdns
tags:
- mayan-container
- redis
- docker-containers
- name: mayan container
docker_container:
name: mayan
image: mayanedms/mayanedms:s4
detach: yes
pull: yes
auto_remove: no
restart_policy: "unless-stopped"
state: started
user: root:root # container starts as root, chowns and then switches to uid in env file
env_file: "{{ systemuserlist.mayan.home }}/mayan.env"
volumes:
- "{{ systemuserlist.mayan.home }}/media:/var/lib/mayan"
container_default_behavior: compatibility
networks_cli_compatible: no
networks:
- name: bridgewithdns
ipv4_address: "{{ bridgewithdns.mayan }}"
tags:
- mayan-container
- docker-containers
- name: template nginx vhost
template:
src: 01-mayan.j2
dest: /etc/nginx/sites-enabled/01-mayan
owner: root
group: root
mode: 0644
tags:
- nginx
- mayan-nginx