diff --git a/ansible/group_vars/all/pve.yml b/ansible/group_vars/all/pve.yml index 7e0f84c..9463acb 100644 --- a/ansible/group_vars/all/pve.yml +++ b/ansible/group_vars/all/pve.yml @@ -24,3 +24,5 @@ pve_hosts: ip: 10.23.1.105 renovate: ip: 10.23.1.110 + gitea_runner: + ip: 20.23.1.114 diff --git a/ansible/hosts b/ansible/hosts index 27be34f..eaa561c 100644 --- a/ansible/hosts +++ b/ansible/hosts @@ -15,3 +15,4 @@ restic pve-gitlab pve-gitlab-runner renovate +gitea-runner diff --git a/ansible/main.yml b/ansible/main.yml index 3f3e129..72dbec8 100644 --- a/ansible/main.yml +++ b/ansible/main.yml @@ -34,6 +34,7 @@ - pve-gitlab-runner - grimes - renovate + - gitea-runner roles: - role: geerlingguy.docker become: true @@ -124,6 +125,10 @@ roles: - gitlab_runner +- hosts: gitea-runner + roles: + - gitea_runner + - hosts: grimes roles: - nebula diff --git a/ansible/roles/gitea_runner/files/docker-compose.yml b/ansible/roles/gitea_runner/files/docker-compose.yml new file mode 100644 index 0000000..e38c157 --- /dev/null +++ b/ansible/roles/gitea_runner/files/docker-compose.yml @@ -0,0 +1,15 @@ +version: "2.3" + +services: + act-runner: + image: vegardit/gitea-act-runner:latest + network_mode: host + volumes: + - ./data:/data + - /var/run/docker.sock:/var/run/docker.sock:ro + environment: + - TZ={{ timezone }} + - GITEA_INSTANCE_URL=https://gitea.theorangeone.net + - GITEA_RUNNER_REGISTRATION_TOKEN={{ gitea_runner_registration_token }} + - GITEA_RUNNER_NAME={{ ansible_hostname }} + restart: unless-stopped diff --git a/ansible/roles/gitea_runner/handlers/main.yml b/ansible/roles/gitea_runner/handlers/main.yml new file mode 100644 index 0000000..27ab00b --- /dev/null +++ b/ansible/roles/gitea_runner/handlers/main.yml @@ -0,0 +1,4 @@ +- name: restart act-runner + shell: + chdir: /opt/act-runner + cmd: "{{ docker_update_command }}" diff --git a/ansible/roles/gitea_runner/tasks/main.yml b/ansible/roles/gitea_runner/tasks/main.yml new file mode 100644 index 0000000..39660e9 --- /dev/null +++ b/ansible/roles/gitea_runner/tasks/main.yml @@ -0,0 +1,20 @@ +- name: Include vault + include_vars: vault.yml + +- name: Create install directory + file: + path: /opt/act-runner + state: directory + owner: "{{ docker_user.name }}" + mode: "{{ docker_compose_directory_mask }}" + become: true + +- name: Install compose file + template: + src: files/docker-compose.yml + dest: /opt/act-runner/docker-compose.yml + mode: "{{ docker_compose_file_mask }}" + owner: "{{ docker_user.name }}" + validate: docker-compose -f %s config + notify: restart act-runner + become: true diff --git a/ansible/roles/gitea_runner/vars/main.yml b/ansible/roles/gitea_runner/vars/main.yml new file mode 100644 index 0000000..feac9f1 --- /dev/null +++ b/ansible/roles/gitea_runner/vars/main.yml @@ -0,0 +1 @@ +gitea_runner_registration_token: "{{ vault_gitea_runner_registration_token }}" diff --git a/ansible/roles/gitea_runner/vars/vault.yml b/ansible/roles/gitea_runner/vars/vault.yml new file mode 100644 index 0000000..4795502 --- /dev/null +++ b/ansible/roles/gitea_runner/vars/vault.yml @@ -0,0 +1,10 @@ +$ANSIBLE_VAULT;1.1;AES256 +39356636363738343339633132326666373534646563366335363336356362343438313030353466 +6564373739333030393666333438386533316332626136350a626439316537343030323761383863 +33666632636132386335393833636232373662626562326531666330373438613738613634643061 +3864336432626338320a373866356363613166366239356630663534646566636131353530623266 +66326334636361386338663739333134333761376239373133396534376139633364336433663362 +30313736303539663839313830336164346536383066393635323366363433616264373165356431 +35663832323132356538666333653135383332653232336336646265356665313165623035363561 +65306666393331383661353961306531636266393765626363616265326566316163396531373638 +3735