feat: initial commit
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2021-01-15 21:32:00 +01:00
commit e53a7da36c
40 changed files with 516 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
---
gitea_state: present
gitea_version: 1.13.1
gitea_docker_compose_directory: /opt/gitea
gitea_url: git.localhost

View File

@@ -0,0 +1,7 @@
---
- name: restart gitea
service:
name: gitea
state: restarted
daemon_reload: True
enabled: True

View File

@@ -0,0 +1,14 @@
---
- name: configure | deploy systemd configuration
template:
src: etc/systemd/system/gitea.service.j2
dest: /etc/systemd/system/gitea.service
owner: root
group: root
mode: 0644
notify: "restart gitea"
- name: ensure that service is started
service:
name: "gitea"
state: started

View File

@@ -0,0 +1,12 @@
---
- name: install | create directory {{ gitea_docker_compose_directory }}
file:
path: "{{ gitea_docker_compose_directory }}"
state: directory
mode: 0755
- name: install | set compose file
template:
src: opt/gitea/docker-compose.yml.j2
dest: "{{ gitea_docker_compose_directory }}/docker-compose.yml"
notify: 'restart gitea'

View File

@@ -0,0 +1,2 @@
---
- include_tasks: "{{ gitea_state }}.yml"

View File

@@ -0,0 +1,4 @@
---
- include_tasks: "install.yml"
- include_tasks: "configure.yml"
- include_tasks: "start.yml"

View File

@@ -0,0 +1,14 @@
---
- name: start | ensure gitea is up and running
service:
name: gitea
state: started
- name: start | wait for gitea up and running
command: "docker ps"
register: result
retries: 60
changed_when: no
until: "'gitea/gitea:{{ gitea_version}}' in result.stdout"
tags:
- skip_ansible_lint

View File

@@ -0,0 +1,5 @@
---
- name: stop | ensure gitea is up and running
service:
name: gitea
state: stopped

View File

@@ -0,0 +1,11 @@
# {{ ansible_managed }}
[Unit]
Description=gitea
[Service]
Restart=always
ExecStart=/usr/local/bin/docker-compose -f "{{ gitea_docker_compose_directory }}/docker-compose.yml" up
ExecStop=/usr/local/bin/docker-compose -f "{{ gitea_docker_compose_directory }}/docker-compose.yml" stop
[Install]
WantedBy=local.target

View File

@@ -0,0 +1,29 @@
# {{ ansible_managed }}
version: '3.2'
services:
gitea:
image: gitea/gitea:{{ gitea_version }}
environment:
- ROOT_URL="http://{{ gitea_url }}"
- DISABLE_SSH=true
- DISABLE_REGISTRATION=true
- REQUIRE_SIGNIN_VIEW=true
restart: always
labels:
- traefik.enable=true
- traefik.docker.network=traefik_network
- traefik.backend=gitea
- traefik.port=3000
- traefik.frontend.rule=Host:{{ gitea_url }}
networks:
- traefik_network
volumes:
- gitea:/data
volumes:
gitea:
driver: local
networks:
traefik_network:
external: true