Open
Description
Summary
When the role is executed with a 'runner_name' already present in the organization , it fails due to a missing svc.sh file. That gives the impression something is wrong with the role. This will happen if you incidentally use the same runner name twice or try to install it on a different machine without deregistering the original. It would be helpful if the role warns that the 'runner_name' is already in use and aborts.
Issue Type
Bug Report
Ansible Version
ansible [core 2.13.3rc1]
config file = /etc/ansible/ansible.cfg
configured module search path = ['/home/vagrant/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3/dist-packages/ansible
ansible collection location = /home/vagrant/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/bin/ansible
python version = 3.10.4 (main, Jun 29 2022, 12:14:53) [GCC 11.2.0]
jinja version = 3.0.3
libyaml = True
Steps to Reproduce
- Run the playbook below
- Delete /opt/action_runner/ or move to a different machine
- Run the playbook again
- name: Install GitHub Actions Runner
hosts: localhost
become: yes
roles:
- role: monolithprojects.github_actions_runner
vars:
- github_account: xxx
- runner_org: yes
- runner_on_ghes: yes
- runner_labels:
- my_runner
Expected Results
I would expect a warning or error that the runner_name is already in use instead of an error due to the missing svc.sh file (which is expected to be missing given that register_runner is skipped)
Actual Results
TASK [monolithprojects.github_actions_runner : Register runner] ********************************************************
skipping: [localhost]
TASK [monolithprojects.github_actions_runner : Replace registered runner] **********************************************
skipping: [localhost]
TASK [monolithprojects.github_actions_runner : Install service] ********************************************************
fatal: [localhost]: FAILED! => {"changed": false, "cmd": "./svc.sh install vagrant", "msg": "[Errno 2] No such file or directory: b'./svc.sh'", "rc": 2, "stderr": "", "stderr_lines": [], "stdout": "", "stdout_lines": []}