From 797290d35dd665b09ca38e031eb12c98447e8bb8 Mon Sep 17 00:00:00 2001 From: Bertrand Lanson Date: Thu, 27 Jul 2023 15:11:38 +0200 Subject: [PATCH] added a few files --- defaults/main.yml | 30 ++++++++++++++- templates/.gitkeep | 0 templates/config.yaml.j2 | 2 + templates/docker-compose.yml.j2 | 45 +++++++++++++++++++++++ templates/gitea-actions-runner.service.j2 | 13 +++++++ 5 files changed, 89 insertions(+), 1 deletion(-) delete mode 100644 templates/.gitkeep create mode 100644 templates/config.yaml.j2 create mode 100644 templates/docker-compose.yml.j2 create mode 100644 templates/gitea-actions-runner.service.j2 diff --git a/defaults/main.yml b/defaults/main.yml index b625f4f..3d41c58 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,2 +1,30 @@ --- -# defaults file for deploy_gitea_runner +# defaults file for deploy_adguard +deploy_gitea_runner_directory: /opt/adguard +deploy_gitea_runner_timezone: "Europe/Paris" +deploy_gitea_runner_start_service: false +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 + container: + network: "gitea-actions_internal" + privileged: true diff --git a/templates/.gitkeep b/templates/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/templates/config.yaml.j2 b/templates/config.yaml.j2 new file mode 100644 index 0000000..ec64ae3 --- /dev/null +++ b/templates/config.yaml.j2 @@ -0,0 +1,2 @@ +# {{ ansible_managed }} +{{ deploy_adguard_config | to_yaml }} \ No newline at end of file diff --git a/templates/docker-compose.yml.j2 b/templates/docker-compose.yml.j2 new file mode 100644 index 0000000..df92a92 --- /dev/null +++ b/templates/docker-compose.yml.j2 @@ -0,0 +1,45 @@ +--- +version: '3.9' + +services: + runner: + image: gitea/act_runner:latest + configs: + - source: config_yaml + 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" + volumes: + - data:/data + - cache:/cache + - /var/run/docker.sock:/var/run/docker.sock + ports: + - target: 1234 + published: 1234 + protocol: tcp + mode: ingress + networks: + - internal + +networks: + internal: + driver: bridge + +volumes: + data: + driver_opts: + o: bind + device: /opt/gitea-actions/data + type: none + cache: + driver_opts: + o: bind + device: /opt/gitea-actions/cache + type: none + +configs: + config_yaml: + file: /opt/gitea-actions/config.yaml \ No newline at end of file diff --git a/templates/gitea-actions-runner.service.j2 b/templates/gitea-actions-runner.service.j2 new file mode 100644 index 0000000..9994c39 --- /dev/null +++ b/templates/gitea-actions-runner.service.j2 @@ -0,0 +1,13 @@ +[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 \ No newline at end of file