62 lines
1.6 KiB
YAML
62 lines
1.6 KiB
YAML
- name: Ensure act_runner user exists
|
|
ansible.builtin.user:
|
|
name: "{{ gitea_runner_user }}"
|
|
groups: "{{ gitea_runner_group }}"
|
|
append: true
|
|
shell: /bin/bash
|
|
|
|
- name: Create data directory
|
|
ansible.builtin.file:
|
|
path: "{{ gitea_runner_data_dir }}"
|
|
state: directory
|
|
owner: "{{ gitea_runner_user }}"
|
|
group: "{{ gitea_runner_group }}"
|
|
mode: "0755"
|
|
|
|
- name: Download act_runner binary
|
|
ansible.builtin.get_url:
|
|
url: "{{ gitea_runner_download_url }}"
|
|
dest: "{{ gitea_runner_install_path }}"
|
|
mode: "0755"
|
|
|
|
- name: Generate act_runner config
|
|
ansible.builtin.template:
|
|
src: config.yml.j2
|
|
dest: "{{ gitea_runner_config_path }}"
|
|
owner: "{{ gitea_runner_user }}"
|
|
group: "{{ gitea_runner_group }}"
|
|
mode: "0644"
|
|
|
|
- name: Register runner
|
|
become: true
|
|
ansible.builtin.shell: >
|
|
rm -f {{ gitea_runner_data_dir }}/.runner &&
|
|
sudo -u {{ gitea_runner_user }} {{ gitea_runner_install_path }} register
|
|
--no-interactive
|
|
--config {{ gitea_runner_config_path }}
|
|
--instance {{ gitea_instance_url }}
|
|
--token {{ gitea_runner_token }}
|
|
--name {{ gitea_runner_name }}
|
|
--labels {{ gitea_runner_labels | join(',') }}
|
|
args:
|
|
chdir: "{{ gitea_runner_data_dir }}"
|
|
executable: /bin/bash
|
|
|
|
- name: Install systemd service
|
|
ansible.builtin.template:
|
|
src: act_runner.service.j2
|
|
dest: /etc/systemd/system/act_runner.service
|
|
owner: root
|
|
group: root
|
|
mode: "0644"
|
|
|
|
- name: Reload systemd
|
|
ansible.builtin.systemd:
|
|
daemon_reload: true
|
|
|
|
- name: Enable and start act_runner
|
|
ansible.builtin.systemd:
|
|
name: act_runner
|
|
enabled: true
|
|
state: restarted
|