From a38bda55ee28032196c0bdf978b6b346212eefed Mon Sep 17 00:00:00 2001 From: L3D Date: Thu, 21 Mar 2024 19:00:41 +0100 Subject: [PATCH] improve forgejo runner configuration and instalaltion --- tasks/configure_runner.yml | 13 +++++++++++++ tasks/install_runner.yml | 4 ++-- vars/main.yml | 2 +- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/tasks/configure_runner.yml b/tasks/configure_runner.yml index a4e4da4..734509a 100644 --- a/tasks/configure_runner.yml +++ b/tasks/configure_runner.yml @@ -9,9 +9,22 @@ msg: "Please set forgejo_runner__token" when: forgejo_runner__token == '' +- name: Check if website is reachable + ansible.builtin.uri: + url: "{{ forgejo_runner__instance_address }}" + method: GET + - name: Register Forgejo runner + become: true ansible.builtin.command: chdir: "{{ forgejo_runner__user_home }}" cmd: "{{ forgejo_runner__full_executable_path }} register --no-interactive --token '{{ forgejo_runner__token }}' --instance '{{ forgejo_runner__instance_address }}' --name '{{ inventory_hostname }}@ansible'" creates: "{{ forgejo_runner__user_home }}/.runner" + +- name: Change Owner of config become: true + ansible.builtin.file: + path: "{{ forgejo_runner__user_home }}/.runner" + owner: "{{ forgejo_runner__user }}" + group: "{{ forgejo_runner__group }}" + mode: '0644' diff --git a/tasks/install_runner.yml b/tasks/install_runner.yml index 57c68da..2597f74 100644 --- a/tasks/install_runner.yml +++ b/tasks/install_runner.yml @@ -58,8 +58,8 @@ src: "{{ _runner_tmp.path }}/{{ forgejo_runner__filename }}" dest: "{{ forgejo_runner__full_executable_path }}" mode: "0755" - owner: "{{ forgejo_runner__user }}" - group: "{{ forgejo_runner__group }}" + owner: "root" + group: "root" remote_src: true when: not _runner_signature.failed diff --git a/vars/main.yml b/vars/main.yml index 53f968f..4a530f7 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -12,5 +12,5 @@ forgejo_runner__arch: "{{ forgejo_runner__go_arch_map[ansible_architecture] | de forgejo_runner__git_repo: 'https://code.forgejo.org/forgejo/runner' # versionscheck -playbook_version_number: 04 # should be a integer +playbook_version_number: 5 # should be a integer playbook_version_path: 'role-l3d.git-forgejo_runner.version'