This commit is contained in:
Tobias J. Endres 2025-02-11 19:14:02 +01:00
parent 11209733bc
commit 99e7ac7d36
3 changed files with 60 additions and 0 deletions

View File

@ -0,0 +1,10 @@
# roles/gitea/defaults/main.yml
gitea_version: "latest"
gitea_container_name: "gitea"
gitea_data_path: "/opt/gitea"
gitea_port: 3000
postgres_host: "ep-lively-flower-a261zayj.eu-central-1.pg.koyeb.app"
postgres_port: 5432
postgres_db: "gitea"
postgres_user: "koyeb-adm"
postgres_password: "npg_2ZJkRNASWx9D"

View File

@ -0,0 +1,33 @@
- name: Create Gitea data directory
file:
path: "{{ gitea_data_path }}"
state: directory
owner: "1000"
group: "1000"
mode: '0755'
become: true
- name: Copy Docker Compose file
template:
src: docker-compose.yml.j2
dest: "{{ gitea_data_path }}/docker-compose.yml"
mode: '0644'
become: true
- name: Deploy Gitea container using Docker Compose V2
community.docker.docker_compose_v2:
project_src: "{{ gitea_data_path }}"
state: present
become: true
- name: Ensure Gitea container is running
community.docker.docker_container_info:
name: "{{ gitea_container_name }}"
register: container_info
- name: Restart Gitea container if not running
community.docker.docker_container:
name: "{{ gitea_container_name }}"
state: started
restart: true
when: not container_info.container.State.Running

View File

@ -0,0 +1,17 @@
services:
gitea:
image: gitea/gitea:{{ gitea_version }}
container_name: {{ gitea_container_name }}
environment:
- USER_UID=1000
- USER_GID=1000
- DB_TYPE=postgres
- DB_HOST={{ postgres_host }}:{{ postgres_port }}
- DB_NAME={{ postgres_db }}
- DB_USER={{ postgres_user }}
- DB_PASSWD={{ postgres_password }}
restart: always
volumes:
- {{ gitea_data_path }}:/data
ports:
- "{{ gitea_port }}:3000"