Add gitea-runner service
This commit is contained in:
parent
41580d3711
commit
63d62bd83f
7 changed files with 79 additions and 19 deletions
_ansible/roles/gitea-runner
23
_ansible/roles/gitea-runner/tasks/main.yml
Normal file
23
_ansible/roles/gitea-runner/tasks/main.yml
Normal file
|
@ -0,0 +1,23 @@
|
|||
---
|
||||
- name: Deploy {{ svc.name }}
|
||||
tags:
|
||||
- git
|
||||
- gitea
|
||||
- ci
|
||||
- gitea-runner
|
||||
block:
|
||||
- import_tasks: steps/create-service-directory.yml
|
||||
- import_tasks: steps/template-docker-compose.yml
|
||||
|
||||
- name: Check if service.env already exists
|
||||
ansible.builtin.stat:
|
||||
path: "{{ (service_path, 'service.env') | path_join }}"
|
||||
register: svc_env_file
|
||||
|
||||
- import_tasks: prompt-registration-token.yml
|
||||
when: not svc_env_file.stat.exists or
|
||||
force_gitea_runner_registration | default(False)
|
||||
|
||||
- import_tasks: steps/template-service-env.yml
|
||||
|
||||
- import_tasks: steps/start-service.yml
|
|
@ -0,0 +1,11 @@
|
|||
- name: Input gitea-runner registration token
|
||||
ansible.builtin.pause:
|
||||
prompt: "Enter a secret"
|
||||
echo: no
|
||||
register: promt_registration_token
|
||||
|
||||
- name: Put registration token into env vars
|
||||
ansible.builtin.set_fact:
|
||||
svc_env: "{{ svc_env | combine({
|
||||
'GITEA_RUNNER_REGISTRATION_TOKEN': promt_registration_token.user_input
|
||||
}, recursive=True) }}"
|
21
_ansible/roles/gitea-runner/vars/main.yml
Normal file
21
_ansible/roles/gitea-runner/vars/main.yml
Normal file
|
@ -0,0 +1,21 @@
|
|||
svc:
|
||||
name: gitea-runner
|
||||
|
||||
svc_env:
|
||||
GITEA_INSTANCE_URL: "https://git.serguzim.me/"
|
||||
GITEA_RUNNER_REGISTRATION_TOKEN:
|
||||
|
||||
compose:
|
||||
watchtower: true
|
||||
image: gitea/act_runner
|
||||
env: true
|
||||
volumes:
|
||||
- data:/data
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
file:
|
||||
services:
|
||||
app:
|
||||
hostname: "{{ ansible_facts.hostname }}"
|
||||
volumes:
|
||||
data:
|
||||
|
Reference in a new issue