56 lines
1.7 KiB
YAML
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: 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://{{ forgejo_host }} --name "{{ inventory_hostname }}" --token "{{ lookup('ansible.builtin.ini', forgejo_org + ' section=' + forgejo_host + ' file=secrets/forgejo-runners.ini') }}" --no-interactive
|
|
args:
|
|
creates: /var/forgejo-runner/.runner
|
|
|
|
- name: enable services
|
|
service:
|
|
name: "{{ item }}"
|
|
enabled: true
|
|
with_items: [podman.socket, podman.service, forgejo-runner.service]
|