🎨: improve registering for other servers
All checks were successful
ansible-lint / lint-everything (push) Successful in 4s

This commit is contained in:
VC
2025-03-07 16:13:10 +01:00
parent 194b1e3b61
commit 4ef3cd267e
2 changed files with 17 additions and 1 deletions

View File

@@ -31,10 +31,22 @@
notify:
- Restart Act_Runner
- debug:
msg: "{{ act_runner_gitea_ref_url }}"
- debug:
msg: "{{ act_runner_gitea_token }}"
- name: Register act_runner
become: true
become_user: "{{ act_runner_user }}"
ansible.builtin.command:
cmd: "{{ act_runner_bin }} register --no-interactive --instance https://giteu.be --token {{ _gitea_runner_token.stdout }}"
cmd: "{{ act_runner_bin }} register --no-interactive --instance https://{{ act_runner_gitea_ref_url }} --token {{ act_runner_gitea_token }}"
chdir: "{{ act_runner_home }}"
creates: "{{ act_runner_home }}/.runner"
- name: Ensure act_runner is running
ansible.builtin.systemd:
name: act_runner
enabled: true
state: started
daemon_reload: true

View File

@@ -5,3 +5,7 @@ act_runner_url: "https://gitea.com/gitea/act_runner/releases/download/v{{ act_ru
act_runner_home: "/var/lib/act_runner"
act_runner_bin: "/usr/local/bin/act_runner"
act_runner_user: "act_runner"
# Only one gitea ref URL name is possible
act_runner_gitea_ref_url: "{{ hostvars[groups['giteaservers'][0]].web_hostname | selectattr('type', 'defined') | selectattr('type', '==', 'gitea') | map(attribute='host') | first }}"
act_runner_gitea_token: "{{ hostvars[groups['giteaservers'][0]]._gitea_runner_token.stdout }}"