added another bunch of things
This commit is contained in:
parent
797290d35d
commit
b7b340c933
@ -1,30 +1,23 @@
|
||||
---
|
||||
# defaults file for deploy_adguard
|
||||
deploy_gitea_runner_directory: /opt/adguard
|
||||
deploy_gitea_runner_directory: /opt/gitea-actions
|
||||
deploy_gitea_runner_timezone: "Europe/Paris"
|
||||
deploy_gitea_runner_start_service: false
|
||||
deploy_gitea_runner_server_url: https://git.example.com
|
||||
deploy_gitea_runner_server_token: ""
|
||||
deploy_gitea_runner_name: gitea-runner
|
||||
deploy_gitea_runner_config:
|
||||
log:
|
||||
level: debug
|
||||
runner:
|
||||
file: .runner
|
||||
capacity: 1
|
||||
envs:
|
||||
env_file: .env
|
||||
timeout: 3h
|
||||
insecure: false
|
||||
fetch_timeout: 5s
|
||||
fetch_interval: 15s
|
||||
labels:
|
||||
- alpine-latest:docker://node:16-alpine
|
||||
- alpine-3.18:docker://node:16-alpine3.18
|
||||
- alpine-3.17:docker://node:16-alpine3.17
|
||||
- alpine-3.16:docker://node:16-alpine3.16
|
||||
- ubuntu-latest:docker://ghcr.io/catthehacker/ubuntu:act-latest
|
||||
- ubuntu-22.04:docker://ghcr.io/catthehacker/ubuntu:act-22.04
|
||||
- ubuntu-20.04:docker://ghcr.io/catthehacker/ubuntu:act-20.04
|
||||
cache:
|
||||
enabled: false
|
||||
enabled: true
|
||||
container:
|
||||
network: "gitea-actions_internal"
|
||||
privileged: true
|
||||
|
@ -1,2 +1,20 @@
|
||||
---
|
||||
# handlers file for deploy_gitea_runner
|
||||
# handlers file for deploy_adguard
|
||||
- name: "Reload systemd file"
|
||||
ansible.builtin.systemd:
|
||||
daemon_reload: true
|
||||
listen: "systemctl-daemon-reload"
|
||||
|
||||
- name: "Enable gitea-actions-runnner service"
|
||||
ansible.builtin.service:
|
||||
name: gitea-actions-runnner
|
||||
enabled: true
|
||||
listen: "systemctl-enable-gitea-actions-runnner"
|
||||
|
||||
- name: "Start gitea-actions-runnner service"
|
||||
ansible.builtin.service:
|
||||
name: gitea-actions-runnner
|
||||
state: restarted
|
||||
listen: "systemctl-restart-gitea-actions-runnner"
|
||||
throttle: 1
|
||||
when: deploy_gitea_runner_start_service
|
||||
|
@ -4,7 +4,7 @@ galaxy_info:
|
||||
namespace: 'ednxzu'
|
||||
role_name: 'deploy_gitea_runner'
|
||||
author: 'Bertrand Lanson'
|
||||
description: ''
|
||||
description: 'Deploy gitea-actions CICD runners using docker-compose on Debian based distributions'
|
||||
license: 'license (BSD, MIT)'
|
||||
min_ansible_version: '2.10'
|
||||
platforms:
|
||||
@ -15,11 +15,12 @@ galaxy_info:
|
||||
- name: Debian
|
||||
versions:
|
||||
- bullseye
|
||||
- bookworm
|
||||
galaxy_tags:
|
||||
- 'ubuntu'
|
||||
- 'debian'
|
||||
- 'adguard'
|
||||
- 'adblock'
|
||||
- 'gitea'
|
||||
- 'cicd'
|
||||
- 'docker'
|
||||
|
||||
dependencies: []
|
||||
|
35
tasks/configure.yml
Normal file
35
tasks/configure.yml
Normal file
@ -0,0 +1,35 @@
|
||||
---
|
||||
# task/configure file for deploy_adguard
|
||||
- name: "Copy gitea-actions-runnner.service file"
|
||||
ansible.builtin.template:
|
||||
src: "gitea-actions-runnner.service.j2"
|
||||
dest: "/etc/systemd/system/gitea-actions-runnner.service"
|
||||
owner: root
|
||||
group: root
|
||||
mode: '0644'
|
||||
notify:
|
||||
- systemctl-daemon-reload
|
||||
|
||||
- name: "Configure docker-compose deployment"
|
||||
block:
|
||||
- name: "Copy docker-compose.yml template"
|
||||
ansible.builtin.template:
|
||||
src: "docker-compose.yml.j2"
|
||||
dest: "{{ deploy_gitea_runner_directory }}/docker-compose.yml"
|
||||
owner: root
|
||||
group: root
|
||||
mode: '0600'
|
||||
notify:
|
||||
- systemctl-enable-gitea-actions-runnner
|
||||
- systemctl-restart-gitea-actions-runnner
|
||||
|
||||
- name: "Copy config.yaml"
|
||||
ansible.builtin.template:
|
||||
src: "config.yaml.j2"
|
||||
dest: "{{ deploy_gitea_runner_directory }}/config.yaml"
|
||||
owner: root
|
||||
group: root
|
||||
mode: '0600'
|
||||
when: deploy_gitea_runner_config != {}
|
||||
notify:
|
||||
- systemctl-restart-gitea-actions-runnner
|
@ -1,2 +1,7 @@
|
||||
---
|
||||
# task/main file for deploy_gitea_runner
|
||||
- name: "Import prerequisites.yml"
|
||||
ansible.builtin.include_tasks: prerequisites.yml
|
||||
|
||||
- name: "Import configure.yml"
|
||||
ansible.builtin.include_tasks: configure.yml
|
||||
|
27
tasks/prerequisites.yml
Normal file
27
tasks/prerequisites.yml
Normal file
@ -0,0 +1,27 @@
|
||||
---
|
||||
# task/prerequisites file for deploy_gitea_runner
|
||||
- name: "Create gitea_actions directory"
|
||||
ansible.builtin.file:
|
||||
path: "{{ deploy_gitea_runner_directory }}"
|
||||
state: directory
|
||||
owner: root
|
||||
group: root
|
||||
mode: '0755'
|
||||
|
||||
- name: "Create gitea_actions/data directory"
|
||||
ansible.builtin.file:
|
||||
path: "{{ deploy_gitea_runner_directory }}/data"
|
||||
state: directory
|
||||
owner: root
|
||||
group: root
|
||||
mode: '0755'
|
||||
|
||||
- name: "Create gitea_actions/cache directory"
|
||||
ansible.builtin.file:
|
||||
path: "{{ deploy_gitea_runner_directory }}/cache"
|
||||
state: directory
|
||||
owner: root
|
||||
group: root
|
||||
mode: '0755'
|
||||
when: deploy_gitea_runner_config['cache']['enabled'] is defined
|
||||
and deploy_gitea_runner_config['cache']['enabled']
|
@ -1,2 +1,2 @@
|
||||
# {{ ansible_managed }}
|
||||
{{ deploy_adguard_config | to_yaml }}
|
||||
{{ deploy_gitea_runner_config | to_nice_yaml }}
|
@ -9,18 +9,22 @@ services:
|
||||
target: /config.yaml
|
||||
environment:
|
||||
CONFIG_FILE: /config.yaml
|
||||
GITEA_INSTANCE_URL: "https://git.ednz.fr"
|
||||
GITEA_RUNNER_REGISTRATION_TOKEN: "cWetxKkQT0EpdEkh5K9E7Cq5a7t0RWv5BCUnmuxP"
|
||||
GITEA_RUNNER_NAME: "hs1-actions-runner"
|
||||
GITEA_INSTANCE_URL: "{{ deploy_gitea_runner_server_url }}"
|
||||
GITEA_RUNNER_REGISTRATION_TOKEN: "{{ deploy_gitea_runner_server_token }}"
|
||||
GITEA_RUNNER_NAME: "{{ deploy_gitea_runner_name }}"
|
||||
volumes:
|
||||
- data:/data
|
||||
{% if deploy_gitea_runner_config['cache']['enabled'] is defined and deploy_gitea_runner_config['cache']['enabled'] %}
|
||||
- cache:/cache
|
||||
{%- endif %}
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
{% if deploy_gitea_runner_config['cache']['port'] is defined %}
|
||||
ports:
|
||||
- target: 1234
|
||||
published: 1234
|
||||
- target: {{ deploy_gitea_runner_config['cache']['port'] }}
|
||||
published: {{ deploy_gitea_runner_config['cache']['port'] }}
|
||||
protocol: tcp
|
||||
mode: ingress
|
||||
{%- endif %}
|
||||
networks:
|
||||
- internal
|
||||
|
||||
@ -32,14 +36,16 @@ volumes:
|
||||
data:
|
||||
driver_opts:
|
||||
o: bind
|
||||
device: /opt/gitea-actions/data
|
||||
device: {{ deploy_gitea_runner_directory }}/data
|
||||
type: none
|
||||
{% if deploy_gitea_runner_config['cache']['enabled'] is defined and deploy_gitea_runner_config['cache']['enabled'] %}
|
||||
cache:
|
||||
driver_opts:
|
||||
o: bind
|
||||
device: /opt/gitea-actions/cache
|
||||
device: {{ deploy_gitea_runner_directory }}/cache
|
||||
type: none
|
||||
{%- endif %}
|
||||
|
||||
configs:
|
||||
config_yaml:
|
||||
file: /opt/gitea-actions/config.yaml
|
||||
file: {{ deploy_gitea_runner_directory }}/config.yaml
|
||||
|
@ -1,13 +0,0 @@
|
||||
[Unit]
|
||||
Description=Free and open source, powerful network-wide ads & trackers blocking DNS server.
|
||||
After=docker.service
|
||||
Requires=docker.service
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
RemainAfterExit=yes
|
||||
ExecStart=/bin/bash -c "docker-compose -f {{ deploy_adguard_directory }}/docker-compose.yml up --detach"
|
||||
ExecStop=/bin/bash -c "docker-compose -f {{ deploy_adguard_directory }}/docker-compose.yml down"
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
13
templates/gitea-actions-runnner.service.j2
Normal file
13
templates/gitea-actions-runnner.service.j2
Normal file
@ -0,0 +1,13 @@
|
||||
[Unit]
|
||||
Description=Act runner is a runner for Gitea based on Gitea fork of act.
|
||||
After=docker.service
|
||||
Requires=docker.service
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
RemainAfterExit=yes
|
||||
ExecStart=/bin/bash -c "docker-compose -f {{ deploy_gitea_runner_directory }}/docker-compose.yml up --detach"
|
||||
ExecStop=/bin/bash -c "docker-compose -f {{ deploy_gitea_runner_directory }}/docker-compose.yml down"
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
Loading…
Reference in New Issue
Block a user