diff --git a/playbooks/gitea/setup_database_gitea.yml b/playbooks/gitea/setup_database_gitea.yml index 1d268d0..5766a5f 100644 --- a/playbooks/gitea/setup_database_gitea.yml +++ b/playbooks/gitea/setup_database_gitea.yml @@ -4,6 +4,7 @@ become: true vars_files: - ../../vars/secrets.yml + - ../../vars/vars.yml vars: postgresql_user: gitea postgresql_db: giteadb @@ -159,8 +160,8 @@ src: /home/ubuntu/hifadhi_kuu/gitea/act_runner-0.2.11-linux-amd64 remote_src: true dest: /usr/local/bin/act_runner - owner: ansible - mode: '0744' + owner: git + mode: '0755' - name: configure the gitea action runner non-interactively ansible.builtin.shell: @@ -173,9 +174,13 @@ args: chdir: /home/ubuntu/hifadhi_kuu/gitea - - name: start the act_runner daemon - ansible.builtin.shell: - cmd: | - act_runner daemon - args: - chdir: /home/ubuntu/hifadhi_kuu/gitea + - name: install the act_runner systemd service + ansible.builtin.template: + src: ../../templates/act_runner.service.j2 + dest: /etc/systemd/system/act_runner.service + + - name: start the gitea action service + service: + name: act_runner + state: restarted + enabled: true diff --git a/templates/act_runner.service.j2 b/templates/act_runner.service.j2 new file mode 100644 index 0000000..6422b59 --- /dev/null +++ b/templates/act_runner.service.j2 @@ -0,0 +1,15 @@ +[Unit] +Description=Gitea Actions runner +Documentation=https://gitea.com/gitea/act_runner +After=docker.service + +[Service] +ExecStart=/usr/local/bin/act_runner daemon +ExecReload=/bin/kill -s HUP $MAINPID +WorkingDirectory={{gitea_action_dir}} +TimeoutSec=0 +RestartSec=10 +Restart=always + +[Install] +WantedBy=multi-user.target diff --git a/vars/vars.yml b/vars/vars.yml new file mode 100644 index 0000000..698a7e5 --- /dev/null +++ b/vars/vars.yml @@ -0,0 +1,2 @@ +--- +gitea_action_dir: /home/ubuntu/hifadhi_kuu/gitea/