ansible-nas/roles/gitea/tasks/main.yml

59 lines
1.8 KiB
YAML
Raw Normal View History

2021-01-13 10:25:57 +00:00
---
- name: Create Gitea Directories
file:
path: "{{ item }}"
state: directory
recurse: yes
with_items:
- "{{ gitea_data_directory }}/gitea"
- "{{ gitea_data_directory }}/mysql"
- name: Create MySQL container for Gitea
docker_container:
name: gitea-mysql
image: mysql:5.7
pull: true
volumes:
- "{{ gitea_data_directory }}/mysql:/var/lib/mysql:rw"
env:
MYSQL_DATABASE: "gitea"
MYSQL_USER: "gitea"
MYSQL_PASSWORD: "gitea"
MYSQL_ROOT_PASSWORD: "gitea"
restart_policy: unless-stopped
memory: "{{ gitea_mysql_memory }}"
2021-01-13 10:25:57 +00:00
- name: Create Gitea container
docker_container:
2022-08-28 10:19:44 +00:00
name: "{{ gitea_container_name }}"
image: gitea/gitea:latest
2021-01-13 10:25:57 +00:00
pull: true
links:
2021-02-21 19:50:07 +00:00
- gitea-mysql:db
2021-01-13 10:25:57 +00:00
volumes:
- "{{ gitea_data_directory }}/gitea:/data:rw"
ports:
- "{{ gitea_port_http }}:3000"
- "{{ gitea_port_ssh }}:22"
env:
DB_TYPE: "mysql"
DB_HOST: "db:3306"
DB_NAME: "gitea"
DB_USER: "gitea"
DB_PASSWD: "gitea"
RUN_MODE: "prod"
2021-01-19 17:18:12 +00:00
SSH_DOMAIN: "{{ ansible_nas_hostname }}"
2021-01-13 10:25:57 +00:00
SSH_PORT: "{{ gitea_port_ssh }}"
ROOT_URL: "http://{{ gitea_hostname }}:{{ gitea_port_http }}/"
USER_UID: "1000"
USER_GID: "1000"
2021-01-13 10:25:57 +00:00
restart_policy: unless-stopped
memory: "{{ gitea_memory }}"
2021-01-13 10:25:57 +00:00
labels:
traefik.enable: "{{ gitea_available_externally | string }}"
2021-01-19 17:18:12 +00:00
traefik.http.routers.gitea.rule: "Host(`{{ gitea_hostname }}.{{ ansible_nas_domain }}`)"
traefik.http.routers.gitea.tls.certresolver: "letsencrypt"
traefik.http.routers.gitea.tls.domains[0].main: "{{ ansible_nas_domain }}"
traefik.http.routers.gitea.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
traefik.http.services.gitea.loadbalancer.server.port: "3000"