84 lines
2.0 KiB
YAML
84 lines
2.0 KiB
YAML
|
---
|
||
|
- name: Deploy Gitea
|
||
|
hosts: swarm-host
|
||
|
become: true
|
||
|
vars:
|
||
|
containers:
|
||
|
- "gitea_app_1"
|
||
|
- "gitea_db_1"
|
||
|
images:
|
||
|
- "postgres"
|
||
|
- "gitea/gitea:latest"
|
||
|
vols:
|
||
|
- "gitea_data"
|
||
|
- "gitea_sql"
|
||
|
|
||
|
tasks:
|
||
|
|
||
|
- name: stop containers
|
||
|
docker_container:
|
||
|
name: "{{ item }}"
|
||
|
state: absent
|
||
|
loop: "{{ containers }}"
|
||
|
ignore_errors: true
|
||
|
|
||
|
- name: Pull images
|
||
|
docker_image:
|
||
|
name: "{{ item }}"
|
||
|
source: pull
|
||
|
loop: "{{ images }}"
|
||
|
|
||
|
- name: deploy containers
|
||
|
docker_stack:
|
||
|
state: present
|
||
|
name: gitea
|
||
|
compose:
|
||
|
#project_name: gitea
|
||
|
#definition:
|
||
|
- version: "3"
|
||
|
|
||
|
networks:
|
||
|
gitea:
|
||
|
external: false
|
||
|
|
||
|
volumes:
|
||
|
gitea_data:
|
||
|
gitea_sql:
|
||
|
|
||
|
services:
|
||
|
app:
|
||
|
image: gitea/gitea:latest
|
||
|
environment:
|
||
|
- USER_UID=1000
|
||
|
- USER_GID=1000
|
||
|
- DB_TYPE=postgres
|
||
|
- DB_HOST=db:5432
|
||
|
- DB_NAME=gitea
|
||
|
- DB_USER=gitea
|
||
|
- DB_PASSWD=gitea
|
||
|
restart: always
|
||
|
networks:
|
||
|
- gitea
|
||
|
volumes:
|
||
|
- gitea_data:/data
|
||
|
- /etc/timezone:/etc/timezone:ro
|
||
|
- /etc/localtime:/etc/localtime:ro
|
||
|
ports:
|
||
|
- "3000:3000"
|
||
|
- "222:22"
|
||
|
depends_on:
|
||
|
- db
|
||
|
|
||
|
db:
|
||
|
image: postgres
|
||
|
restart: always
|
||
|
environment:
|
||
|
- POSTGRES_USER=gitea
|
||
|
- POSTGRES_PASSWORD=gitea
|
||
|
- POSTGRES_DB=gitea
|
||
|
networks:
|
||
|
- gitea
|
||
|
volumes:
|
||
|
- gitea_sql:/var/lib/postgresql/data
|
||
|
|