Ansible-ForgejoRunner/roles/forgejoRunner/tasks/main.yml
2024-11-25 19:02:35 -07:00

49 lines
1.4 KiB
YAML

---
# file: roles/forgejoRunner/tasks/main.yml
- name: Getting the latest versuib
uri:
url: "https://code.forgejo.org/api/v1/repos/forgejo/runner/releases/latest"
method: GET
register: results
when: (forgejoRunner_version | lower) == 'latest'
- name: Update the download url with latest version
set_fact:
forgejoRunner_url: "https://code.forgejo.org/forgejo/runner/releases/download/{{ results.json.name }}/forgejo-runner-{{ results.json.name | replace('v','') }}-linux-amd64"
when: (forgejoRunner_version | lower) == 'latest'
- name: Download forgejo-runner
get_url:
url: "{{ forgejoRunner_url }}"
dest: /usr/bin/forgejo-runner
group: root
owner: root
mode: '0755'
- name: Create runner user
user:
name: "{{ forgejoRunner_user }}"
create_home: yes
groups: docker
append: true
comment: Forgejo Runner User
- name: Deploy forgejo runner config
template:
src: config.yml.j2
dest: "/home/{{ forgejoRunner_user }}/config.yml"
owner: "{{ forgejoRunner_user }}"
mode: '0644'
- name: Deploy forgejo runner service
template:
src: forgejo-runner.service.j2
dest: /etc/systemd/system/forgejo-runner.service
notify: Daemon Reload
- name: Enable forgejo runner service
service:
name: forgejo-runner.service
state: started
enabled: yes