Skip to content

Commit f7f0dca

Browse files
Merge pull request #171 from MonolithProjects/fix/github_enterprise_var
fix github_enterprise var conditionals and restart task
2 parents d6844c6 + c91b287 commit f7f0dca

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

tasks/assert.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
- github_account is defined
66
fail_msg: "github_account is not defined"
77
run_once: true
8-
when: not github_enterprise
8+
when: github_enterprise is not defined
99

1010
- name: Check access_token variable (RUN ONCE)
1111
ansible.builtin.assert:
@@ -21,7 +21,7 @@
2121
- runner_org | bool == True or runner_org == False
2222
fail_msg: "runner_org should be a boolean value"
2323
run_once: true
24-
when: not github_enterprise
24+
when: github_enterprise is not defined
2525

2626
- name: Check github_repo variable (RUN ONCE)
2727
ansible.builtin.assert:
@@ -30,4 +30,4 @@
3030
- github_repo | length > 0
3131
fail_msg: "github_repo was not found or is using an invalid format."
3232
run_once: true
33-
when: not runner_org and not github_enterprise
33+
when: not runner_org and github_enterprise is not defined

tasks/collect_info.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@
55
- name: Set complete API url for repo runner
66
ansible.builtin.set_fact:
77
github_full_api_url: "{{ github_api_url }}/repos/{{ github_owner | default(github_account) }}/{{ github_repo }}/actions/runners"
8-
when: not runner_org and not github_enterprise
8+
when: not runner_org and github_enterprise is not defined
99

1010
- name: Set complete API url for org runner
1111
ansible.builtin.set_fact:
1212
github_full_api_url: "{{ github_api_url }}/orgs/{{ github_owner | default(github_account) }}/actions/runners"
13-
when: runner_org | bool and not github_enterprise
13+
when: runner_org | bool and github_enterprise is not defined
1414

1515
- name: Set complete API url for enterprise runner
1616
ansible.builtin.set_fact:
1717
github_full_api_url: "{{ github_api_url }}/enterprises/{{ github_enterprise }}/actions/runners"
18-
when: github_enterprise
18+
when: github_enterprise is defined
1919

2020
- name: Get registration token (RUN ONCE)
2121
ansible.builtin.uri:

tasks/install_runner.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -51,17 +51,17 @@
5151
- name: Set complete GitHub url for repo runner
5252
ansible.builtin.set_fact:
5353
github_full_url: "{{ github_url }}/{{ github_owner | default(github_account) }}/{{ github_repo }}"
54-
when: not runner_org and not github_enterprise
54+
when: not runner_org and github_enterprise is not defined
5555

5656
- name: Set complete GitHub url for org runner
5757
ansible.builtin.set_fact:
5858
github_full_url: "{{ github_url }}/{{ github_owner | default(github_account) }}"
59-
when: runner_org | bool and not github_enterprise
59+
when: runner_org | bool and github_enterprise is not defined
6060

6161
- name: Set complete GitHub url for enterprise runner
6262
ansible.builtin.set_fact:
6363
github_full_url: "{{ github_url }}/enterprises/{{ github_enterprise }}"
64-
when: github_enterprise
64+
when: github_enterprise is defined
6565

6666
- name: Register runner
6767
environment:
@@ -150,7 +150,7 @@
150150
when: runner_state|lower == "stopped"
151151

152152
- name: Version changed - RESTART Github Actions Runner service
153-
ansible.builtin.command: "./svc.sh stop && sleep 5 && ./svc.sh start"
153+
ansible.builtin.shell: "./svc.sh stop && sleep 5 && ./svc.sh start"
154154
args:
155155
chdir: "{{ runner_dir }}"
156156
changed_when: true

0 commit comments

Comments
 (0)