fix and streamline command run

This commit is contained in:
2025-01-26 20:21:18 +01:00
parent 105aa330b2
commit 246d5caf45

View File

@@ -2,7 +2,6 @@
# https://docs.ansible.com/ansible/latest/collections/ansible/builtin/user_module.html
# https://docs.ansible.com/ansible/latest/collections/ansible/builtin/copy_module.html
# https://docs.ansible.com/ansible/latest/collections/ansible/builtin/template_module.html
# https://docs.ansible.com/ansible/latest/collections/ansible/builtin/stat_module.html
# https://docs.ansible.com/ansible/latest/collections/ansible/builtin/command_module.html
# https://docs.ansible.com/ansible/latest/collections/ansible/builtin/service_module.html
---
@@ -53,15 +52,12 @@
- name: flush handlers
meta: flush_handlers
- name: check if runner registerd
stat:
path: "{{ RUNNER_DIR }}/.runner"
register: stat_result
- name: register runner
command: "{{ RUNNER_DIR }}/{{ RUNNER_NAME }} register --no-interactive --instance {{ RUNNER_INSTANCE }} --token {{ RUNNER_TOKEN }}"
ansible.builtin.command:
cmd: "{{ RUNNER_DIR }}/{{ RUNNER_NAME }} register --no-interactive --instance {{ RUNNER_INSTANCE }} --token {{ RUNNER_TOKEN }}"
chdir: "{{ RUNNER_DIR }}"
creates: "{{ RUNNER_DIR }}/.runner"
when:
- not stat_result.stat.exists
- RUNNER_TOKEN != None
- name: enable runner