infra/roles/forgejo-runner/tasks/main.yml

56 lines
1.7 KiB
YAML

- name: Install podman
apt:
name: [podman]
- name: make some directories
file:
path: "{{ item }}"
state: directory
with_items:
- /etc/forgejo-runner
- /opt/shared-with-host
- /var/forgejo-runner
- /etc/systemd/system/podman.service.d
- /etc/systemd/system/podman.socket.d
- name: configure podman service
template:
src: podman.service-override.conf
dest: /etc/systemd/system/podman.service.d/override.conf
notify:
- systemctl daemon-reload
- restart podman.service
- name: configure podman socket
template:
src: podman.socket-override.conf
dest: /etc/systemd/system/podman.socket.d/override.conf
notify:
- systemctl daemon-reload
- restart podman.socket
- name: enable podman
service:
name: "{{ item }}"
enabled: true
with_items: [podman.socket, podman.service]
- name: configure forgejo-runner
template:
src: forgejo-runner.yaml
dest: /etc/forgejo-runner/config.yaml
notify:
- restart forgejo-runner
- name: install forgejo-runner.service
template:
src: forgejo-runner.service
dest: /etc/systemd/system/forgejo-runner.service
notify:
- systemctl daemon-reload
- restart forgejo-runner
- name: register the runner
command: podman run --rm --user root -tiv /etc/forgejo-runner:/etc/forgejo-runner:ro -v /var/forgejo-runner:/data code.forgejo.org/forgejo/runner:3.3.0 forgejo-runner register --instance https://git.janky.solutions --name "{{ inventory_hostname }}" --token "{{ lookup('ansible.builtin.ini', 'registration_token section=forgejo_runner file=secrets/git.janky.solutions.ini') }}" --no-interactive
args:
creates: /var/forgejo-runner/.runner