73 lines
1.7 KiB
YAML
73 lines
1.7 KiB
YAML
|
---
|
||
|
- name: Deploy Gitea
|
||
|
hosts: mediaserver-back
|
||
|
become: true
|
||
|
vars:
|
||
|
containers:
|
||
|
- "gitea_app_1"
|
||
|
- "gitea_db_1"
|
||
|
images:
|
||
|
- "postgres"
|
||
|
- "gitea/gitea:latest"
|
||
|
|
||
|
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_compose:
|
||
|
project_name: gitea
|
||
|
definition:
|
||
|
version: "2"
|
||
|
networks:
|
||
|
gitea:
|
||
|
external: false
|
||
|
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:
|
||
|
- /docker/cfg/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:
|
||
|
- /docker/cfg/gitea/sql:/var/lib/postgresql/data
|
||
|
|