mirror of
https://github.com/davestephens/ansible-nas
synced 2024-11-15 08:27:19 +00:00
Gitea now stops when gitea_enabled: false
This commit is contained in:
parent
ae14d884d0
commit
75c3ae23da
4 changed files with 85 additions and 57 deletions
8
nas.yml
8
nas.yml
|
@ -139,7 +139,6 @@
|
|||
- role: gitea
|
||||
tags:
|
||||
- gitea
|
||||
when: (gitea_enabled | default(False))
|
||||
|
||||
- role: gitlab
|
||||
tags:
|
||||
|
@ -460,3 +459,10 @@
|
|||
tags:
|
||||
- znc
|
||||
when: (znc_enabled | default(False))
|
||||
|
||||
post_tasks:
|
||||
- name: Clean up stopped applications
|
||||
command: /bin/true
|
||||
notify: "stop disabled applications"
|
||||
tags:
|
||||
- stop_disabled_applications
|
||||
|
|
|
@ -16,3 +16,4 @@ gitea_mysql_memory: 1g
|
|||
|
||||
# docker
|
||||
gitea_container_name: gitea
|
||||
gitea_mysql_container_name: gitea-mysql
|
||||
|
|
|
@ -1,6 +1,24 @@
|
|||
---
|
||||
- name: "Restart Gitea"
|
||||
- name: Restart Gitea
|
||||
docker_container:
|
||||
name: "{{ gitea_container_name }}"
|
||||
restart: true
|
||||
listen: "restart gitea"
|
||||
|
||||
- name: Stop Gitea
|
||||
docker_container:
|
||||
name: "{{ gitea_container_name }}"
|
||||
state: absent
|
||||
when: gitea_enabled is false
|
||||
listen:
|
||||
- "stop gitea"
|
||||
- "stop disabled applications"
|
||||
|
||||
- name: Stop Gitea Mysql
|
||||
docker_container:
|
||||
name: "{{ gitea_mysql_container_name }}"
|
||||
state: absent
|
||||
when: gitea_enabled is false
|
||||
listen:
|
||||
- "stop gitea"
|
||||
- "stop disabled applications"
|
||||
|
|
|
@ -1,58 +1,61 @@
|
|||
---
|
||||
- name: Create Gitea Directories
|
||||
file:
|
||||
path: "{{ item }}"
|
||||
state: directory
|
||||
recurse: yes
|
||||
with_items:
|
||||
- "{{ gitea_data_directory }}/gitea"
|
||||
- "{{ gitea_data_directory }}/mysql"
|
||||
- name: Gitea
|
||||
block:
|
||||
- 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 }}"
|
||||
- name: Create MySQL container for Gitea
|
||||
docker_container:
|
||||
name: "{{ gitea_mysql_container_name }}"
|
||||
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 }}"
|
||||
|
||||
- name: Create Gitea container
|
||||
docker_container:
|
||||
name: "{{ gitea_container_name }}"
|
||||
image: gitea/gitea:latest
|
||||
pull: true
|
||||
links:
|
||||
- gitea-mysql:db
|
||||
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"
|
||||
SSH_DOMAIN: "{{ ansible_nas_hostname }}"
|
||||
SSH_PORT: "{{ gitea_port_ssh }}"
|
||||
ROOT_URL: "http://{{ gitea_hostname }}:{{ gitea_port_http }}/"
|
||||
USER_UID: "1000"
|
||||
USER_GID: "1000"
|
||||
restart_policy: unless-stopped
|
||||
memory: "{{ gitea_memory }}"
|
||||
labels:
|
||||
traefik.enable: "{{ gitea_available_externally | string }}"
|
||||
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"
|
||||
- name: Create Gitea container
|
||||
docker_container:
|
||||
name: gitea
|
||||
image: gitea/gitea:latest
|
||||
pull: true
|
||||
links:
|
||||
- gitea-mysql:db
|
||||
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"
|
||||
SSH_DOMAIN: "{{ ansible_nas_hostname }}"
|
||||
SSH_PORT: "{{ gitea_port_ssh }}"
|
||||
ROOT_URL: "http://{{ gitea_hostname }}:{{ gitea_port_http }}/"
|
||||
USER_UID: "1000"
|
||||
USER_GID: "1000"
|
||||
restart_policy: unless-stopped
|
||||
memory: "{{ gitea_memory }}"
|
||||
labels:
|
||||
traefik.enable: "{{ gitea_available_externally | string }}"
|
||||
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"
|
||||
when: gitea_enabled is true
|
||||
|
|
Loading…
Reference in a new issue