Skip to content

Commit 7b2fb5d

Browse files
Merge pull request #40 from zakaprov/runner-name
Add runner_name variable
2 parents 61c25d7 + b7da270 commit 7b2fb5d

File tree

4 files changed

+20
-8
lines changed

4 files changed

+20
-8
lines changed

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,15 @@ access_token: "{{ lookup('env', 'PERSONAL_ACCESS_TOKEN') }}"
6464
# Is it the runner for organization or not
6565
runner_org: no
6666

67-
# GitHub Repository user or Organization owner used for Runner registration
67+
# Name to assign to this runner in GitHub
68+
runner_name: "{{ lookup('pipe', 'hostname') }}"
69+
70+
# Account used for Runner registration (GitHub Repository user with admin rights or Organization owner)
6871
# github_account: "youruser"
6972

73+
# GitHub repository owner name (if other than github_account)
74+
# github_owner: "yourorg"
75+
7076
# Github repository name
7177
# github_repo: "yourrepo"
7278
```

defaults/main.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,14 @@ access_token: "{{ lookup('env', 'PERSONAL_ACCESS_TOKEN') }}"
2626
# Is it the runner for organization or not
2727
runner_org: no
2828

29+
# Name to assign to this runner in GitHub
30+
runner_name: "{{ lookup('pipe', 'hostname') }}"
31+
2932
# GitHub Repository user or Organization owner used for Runner registration
3033
# github_account: "youruser"
3134

35+
# GitHub repository owner name (if other than github_account)
36+
# github_owner: "yourorg"
37+
3238
# Github repository name
33-
# github_repo: "yourrepo"
39+
# github_repo: "yourrepo"

tasks/install_runner.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979

8080
- name: Register runner (if new installation) for repo
8181
command: "{{ runner_dir }}/./config.sh --url {{ github_server }}/{{ github_owner | default(github_account) }}/{{ github_repo }} \
82-
--token {{ registration.json.token }} --unattended"
82+
--token {{ registration.json.token }} --name {{ runner_name }} --unattended"
8383
args:
8484
chdir: "{{ runner_dir }}"
8585
become: yes
@@ -91,7 +91,7 @@
9191

9292
- name: Register runner (if new installation) for organization
9393
command: "{{ runner_dir }}/./config.sh --url {{ github_server }}/{{ github_owner | default(github_account) }} \
94-
--token {{ registration.json.token }} --unattended"
94+
--token {{ registration.json.token }} --name {{ runner_name }} --unattended"
9595
args:
9696
chdir: "{{ runner_dir }}"
9797
become: yes
@@ -103,7 +103,7 @@
103103

104104
- name: Replace registered runner for repo
105105
command: "{{ runner_dir }}/config.sh --url {{ github_server }}/{{ github_owner | default(github_account) }}/{{ github_repo }} \
106-
--token {{ registration.json.token }} --unattended --replace"
106+
--token {{ registration.json.token }} --name {{ runner_name }} --unattended --replace"
107107
args:
108108
chdir: "{{ runner_dir }}"
109109
become: yes
@@ -115,7 +115,7 @@
115115

116116
- name: Replace registered runner for organization
117117
command: "{{ runner_dir }}/config.sh --url {{ github_server }}/{{ github_owner | default(github_account) }} \
118-
--token {{ registration.json.token }} --unattended --replace"
118+
--token {{ registration.json.token }} --name {{ runner_name }} --unattended --replace"
119119
args:
120120
chdir: "{{ runner_dir }}"
121121
become: yes

tasks/uninstall_runner.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
- uninstall
3838

3939
- name: Unregister runner from the GitHub
40-
command: "./config.sh remove --token {{ registration.json.token }} --unattended"
40+
command: "./config.sh remove --token {{ registration.json.token }} --name {{ runner_name }} --unattended"
4141
args:
4242
chdir: "{{ runner_dir }}"
4343
become: yes
@@ -52,4 +52,4 @@
5252
path: "{{ runner_dir }}"
5353
state: absent
5454
tags:
55-
- uninstall
55+
- uninstall

0 commit comments

Comments
 (0)