move gitea to role, fix deploy script
Some checks failed
Deploy Containers / Prepare (push) Failing after 12s
Some checks failed
Deploy Containers / Prepare (push) Failing after 12s
This commit is contained in:
40
roles/gitea-runner/tasks/main.yml
Normal file
40
roles/gitea-runner/tasks/main.yml
Normal file
@@ -0,0 +1,40 @@
|
||||
---
|
||||
- name: Create folder structure
|
||||
file:
|
||||
path: "{{ item }}"
|
||||
state: directory
|
||||
with_items:
|
||||
- "{{ data_dir }}/gitea"
|
||||
- "{{ data_dir }}/job"
|
||||
|
||||
- name: Check if Act Runner has been downloaded
|
||||
stat:
|
||||
path: "{{ data_dir }}/gitea/act_runner"
|
||||
register: act_runner
|
||||
|
||||
- name: Download Gitea Act Runner
|
||||
get_url:
|
||||
url: https://dl.gitea.com/act_runner/nightly/act_runner-nightly-linux-amd64
|
||||
dest: "{{ data_dir }}/gitea"
|
||||
mode: 0755
|
||||
when: not act_runner.stat.exists
|
||||
|
||||
- name: Check if Act Runner is a Systemd Service
|
||||
stat:
|
||||
path: "/etc/systemd/system/act_runner.service"
|
||||
register: act_runner_service
|
||||
|
||||
- name: Create Systemd Service
|
||||
become: yes
|
||||
template:
|
||||
src: act_runner.service.j2
|
||||
dest: "/etc/systemd/system/act_runner.service"
|
||||
when: not act_runner_service.stat.exists
|
||||
- name: Enable Systemd Service
|
||||
become: yes
|
||||
command: systemctl enable act_runner.service
|
||||
when: not act_runner_service.stat.exists
|
||||
- name: Start Systemd Service
|
||||
become: yes
|
||||
command: systemctl start act_runner.service
|
||||
when: not act_runner_service.stat.exists
|
16
roles/gitea-runner/templates/act_runner.service.j2
Normal file
16
roles/gitea-runner/templates/act_runner.service.j2
Normal file
@@ -0,0 +1,16 @@
|
||||
[Unit]
|
||||
Description=Gitea Actions runner
|
||||
Documentation=https://gitea.com/gitea/act_runner
|
||||
After=docker.service
|
||||
|
||||
[Service]
|
||||
ExecStart={{ data_dir }}/gitea/act_runner daemon --instance {{ GITEA_INSTANCE_URL }} --token {{ GITEA_RUNNER_REGISTRATION_TOKEN }} --name {{ GITEA_RUNNER_NAME }} --labels {{ GITEA_RUNNER_LABELS }}
|
||||
ExecReload=/bin/kill -s HUP $MAINPID
|
||||
WorkingDirectory={{ data_dir }}/gitea
|
||||
TimeoutSec=0
|
||||
RestartSec=10
|
||||
Restart=always
|
||||
User=act_runner
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
Reference in New Issue
Block a user