2024-03-21 15:23:41 +01:00
|
|
|
---
|
|
|
|
- name: Make Sure Forgejo runner instace address is set
|
|
|
|
ansible.builtin.fail:
|
|
|
|
msg: "Please set forgejo_runner__instance_address"
|
|
|
|
when: forgejo_runner__instance_address == ''
|
|
|
|
|
|
|
|
- name: Make Sure Forgejo runner token is set
|
|
|
|
ansible.builtin.fail:
|
|
|
|
msg: "Please set forgejo_runner__token"
|
|
|
|
when: forgejo_runner__token == ''
|
|
|
|
|
2024-03-21 19:00:41 +01:00
|
|
|
- name: Check if website is reachable
|
|
|
|
ansible.builtin.uri:
|
|
|
|
url: "{{ forgejo_runner__instance_address }}"
|
|
|
|
method: GET
|
|
|
|
|
2024-03-21 15:23:41 +01:00
|
|
|
- name: Register Forgejo runner
|
2024-03-21 19:00:41 +01:00
|
|
|
become: true
|
2024-03-21 15:23:41 +01:00
|
|
|
ansible.builtin.command:
|
|
|
|
chdir: "{{ forgejo_runner__user_home }}"
|
2024-03-21 17:30:37 +01:00
|
|
|
cmd: "{{ forgejo_runner__full_executable_path }} register --no-interactive --token '{{ forgejo_runner__token }}' --instance '{{ forgejo_runner__instance_address }}' --name '{{ inventory_hostname }}@ansible'"
|
2024-03-21 15:23:41 +01:00
|
|
|
creates: "{{ forgejo_runner__user_home }}/.runner"
|
2024-03-21 19:00:41 +01:00
|
|
|
|
|
|
|
- name: Change Owner of config
|
2024-03-21 15:23:41 +01:00
|
|
|
become: true
|
2024-03-21 19:00:41 +01:00
|
|
|
ansible.builtin.file:
|
|
|
|
path: "{{ forgejo_runner__user_home }}/.runner"
|
|
|
|
owner: "{{ forgejo_runner__user }}"
|
|
|
|
group: "{{ forgejo_runner__group }}"
|
|
|
|
mode: '0644'
|