homelab/roles/gitea/tasks/main.yml

86 lines
2.6 KiB
YAML
Raw Normal View History

2020-07-28 03:20:50 +00:00
- name: Create Gitea Network
docker_network:
name: "{{ gitea_name }}"
- name: Start Gitea's database container
docker_container:
name: "{{ gitea_dbname }}"
image: mariadb:{{ gitea_dbversion }}
2020-07-29 04:43:31 +00:00
state: started
2020-07-28 03:20:50 +00:00
restart_policy: always
volumes: "{{ gitea_dbroot }}:/var/lib/mysql"
2022-05-22 04:19:56 +00:00
container_default_behavior: "no_defaults"
2020-07-28 03:20:50 +00:00
networks_cli_compatible: true
networks:
- name: "{{ gitea_name }}"
env:
MYSQL_RANDOM_ROOT_PASSWORD: "true"
MYSQL_DATABASE: "{{ gitea_dbname }}"
MYSQL_USER: "{{ gitea_dbuser }}"
MYSQL_PASSWORD: "{{ gitea_dbpass }}"
2022-05-22 04:19:56 +00:00
- name: Start Gitea container (traefik routing)
2020-07-28 03:20:50 +00:00
docker_container:
name: "{{ gitea_name }}"
image: gitea/gitea:{{ gitea_version }}
2020-07-29 04:43:31 +00:00
state: started
2020-07-28 03:20:50 +00:00
restart_policy: always
2022-05-22 04:19:56 +00:00
container_default_behavior: "no_defaults"
2020-07-28 03:20:50 +00:00
networks_cli_compatible: true
2020-09-12 04:32:34 +00:00
ports: "{{ gitea_ports }}"
2020-07-28 03:20:50 +00:00
networks:
- name: "{{ gitea_name }}"
- name: traefik
volumes:
- "{{ gitea_root }}:/data"
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
env:
USER_UID: "1000"
USER_GID: "1000"
DB_TYPE: mysql
DB_HOST: "{{ gitea_dbname }}"
DB_NAME: "{{ gitea_dbname }}"
DB_USER: "{{ gitea_dbuser }}"
DB_PASSWD: "{{ gitea_dbpass }}"
2020-09-20 06:33:37 +00:00
ROOT_URL: "https://{{ gitea_domain }}/"
SSH_DOMAIN: "{{ gitea_domain }}"
DOMAIN: "{{ gitea_domain }}"
2020-07-28 03:20:50 +00:00
labels:
traefik.http.routers.gitea.rule: "Host(`{{ gitea_domain }}`)"
traefik.http.routers.gitea.entrypoints: websecure
traefik.http.routers.gitea.tls.certresolver: letsencrypt
traefik.http.routers.gitea.middlewares: "securehttps@file"
2020-07-28 03:20:50 +00:00
traefik.http.services.gitea.loadbalancer.server.port: "3000"
traefik.docker.network: traefik
traefik.enable: "true"
2022-05-22 04:19:56 +00:00
when: traefik_version is defined
- name: Start Gitea container
docker_container:
name: "{{ gitea_name }}"
image: gitea/gitea:{{ gitea_version }}
state: started
restart_policy: always
container_default_behavior: "no_defaults"
networks_cli_compatible: true
ports: "{{ gitea_ports }}"
networks:
- name: "{{ gitea_name }}"
volumes:
- "{{ gitea_root }}:/data"
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
env:
USER_UID: "1000"
USER_GID: "1000"
DB_TYPE: mysql
DB_HOST: "{{ gitea_dbname }}"
DB_NAME: "{{ gitea_dbname }}"
DB_USER: "{{ gitea_dbuser }}"
DB_PASSWD: "{{ gitea_dbpass }}"
ROOT_URL: "https://{{ gitea_domain }}/"
SSH_DOMAIN: "{{ gitea_domain }}"
DOMAIN: "{{ gitea_domain }}"
when: traefik_version is not defined