From aa565bdfcedf8c8bc5041ba1ac94e1de50c162ba Mon Sep 17 00:00:00 2001 From: Patrick Toal Date: Mon, 18 Dec 2023 18:07:35 -0500 Subject: [PATCH] Installation of act_runner for automatically building on gitea workflow --- configure_act_runner.yml | 43 ++++++++++++++++++++++++++++++++++++ install_nginx.yml | 2 +- templates/act_runner.service | 12 ++++++++++ 3 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 configure_act_runner.yml create mode 100644 templates/act_runner.service diff --git a/configure_act_runner.yml b/configure_act_runner.yml new file mode 100644 index 0000000..393ec5a --- /dev/null +++ b/configure_act_runner.yml @@ -0,0 +1,43 @@ +--- +- name: Configure act_runner for gitea + hosts: bab1.mgmt.toal.ca + vars: + runner_user: ptoal + tasks: + + - name: Act Runner is downloaded + ansible.builtin.get_url: + url: + https://dl.gitea.com/act_runner/0.2.6/act_runner-0.2.6-linux-amd64 + dest: /home/{{ runner_user }}/act_runner + mode: '0755' + force: true + + - name: Ensure act_runner.service file in config directory + ansible.builtin.template: + dest: /home/{{ runner_user }}/.config/systemd/user/act_runner.service + src: act_runner.service + mode: '0644' + notify: daemon-reload + + - name: Enable lingering for user + ansible.builtin.command: + argv: + - /usr/bin/loginctl + - enable-linger + - "{{ runner_user }}" + creates: /var/lib/systemd/linger/{{ runner_user }} + + - name: Enable act_runner.service user unit to start on boot + ansible.builtin.systemd: + name: act_runner.service + scope: user + enabled: true + state: started + + handlers: + - name: Execute daemon-reload when service file changed + ansible.builtin.systemd: + daemon_reload: true + scope: user + listen: "daemon-reload" diff --git a/install_nginx.yml b/install_nginx.yml index 7bbf1bf..bf1df80 100644 --- a/install_nginx.yml +++ b/install_nginx.yml @@ -12,7 +12,7 @@ ansible.builtin.include_role: name: nginxinc.nginx_core.nginx_config - - name: Ensure python firewall library is installed + - name: Ensure python firewall library is installed ansible.builtin.package: name: python3-firewall state: present diff --git a/templates/act_runner.service b/templates/act_runner.service new file mode 100644 index 0000000..7d6509b --- /dev/null +++ b/templates/act_runner.service @@ -0,0 +1,12 @@ +[Unit] +Description=Act Runner for automatic builds from Gitea. + +[Service] +Environment="DOCKER_HOST=unix://{{ lookup('ansible.builtin.env','XDG_RUNTIME_DIR') }}/podman/podman.sock" +Type=simple +ExecStart=/home/ptoal/act_runner daemon +Restart=on-failure +StandardOutput=file:%h/log_file + +[Install] +WantedBy=default.target