1
0
Fork 0
mirror of https://github.com/roles-ansible/ansible_role_forgeo_runner.git synced 2024-08-16 10:29:50 +02:00
ansible_role_forgeo_runner/tasks/configure_runner.yml

30 lines
1 KiB
YAML

---
- 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 == ''
- name: Check if website is reachable
ansible.builtin.uri:
url: "{{ forgejo_runner__instance_address }}"
method: GET
- name: Register Forgejo runner
become: true
ansible.builtin.command:
chdir: "{{ forgejo_runner__user_home }}"
cmd: "{{ forgejo_runner__full_executable_path }} register --no-interactive --token '{{ forgejo_runner__token }}' --instance '{{ forgejo_runner__instance_address }}' --name '{{ inventory_hostname }}@ansible'"
creates: "{{ forgejo_runner__user_home }}/.runner"
- name: Change Owner of config
become: true
ansible.builtin.file:
path: "{{ forgejo_runner__user_home }}/.runner"
owner: "{{ forgejo_runner__user }}"
group: "{{ forgejo_runner__group }}"
mode: '0644'