Skip to content

Commit 403c5f3

Browse files
Merge pull request #83 from MonolithProjects/develop
Fix failing Ansible check mode
2 parents ea1db13 + 40b3441 commit 403c5f3

File tree

3 files changed

+103
-94
lines changed

3 files changed

+103
-94
lines changed

tasks/collect_info_org.yml

+50-47
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,55 @@
11
---
2-
- name: Get registration token (RUN ONCE)
3-
uri:
4-
url: "{{ github_api_url }}/orgs/{{ github_owner | default(github_account) }}/actions/runners/registration-token"
5-
headers:
6-
Authorization: "token {{ access_token }}"
7-
Accept: "application/vnd.github.v3+json"
8-
method: POST
9-
status_code: 201
10-
force_basic_auth: yes
11-
register: registration
12-
run_once: yes
13-
tags:
14-
- install
15-
- uninstall
2+
- block:
3+
- name: Get registration token (RUN ONCE)
4+
uri:
5+
url: "{{ github_api_url }}/orgs/{{ github_owner | default(github_account) }}/actions/runners/registration-token"
6+
headers:
7+
Authorization: "token {{ access_token }}"
8+
Accept: "application/vnd.github.v3+json"
9+
method: POST
10+
status_code: 201
11+
force_basic_auth: yes
12+
register: registration
13+
run_once: yes
14+
tags:
15+
- install
16+
- uninstall
1617

17-
- name: Check currently registered runners (RUN ONCE)
18-
uri:
19-
url: "{{ github_api_url }}/orgs/{{ github_owner | default(github_account) }}/actions/runners"
20-
headers:
21-
Authorization: "token {{ access_token }}"
22-
Accept: "application/vnd.github.v3+json"
23-
method: GET
24-
status_code: 200
25-
force_basic_auth: yes
26-
register: registered_runners
27-
run_once: yes
28-
tags:
29-
- install
30-
- uninstall
18+
- name: Check currently registered runners (RUN ONCE)
19+
uri:
20+
url: "{{ github_api_url }}/orgs/{{ github_owner | default(github_account) }}/actions/runners"
21+
headers:
22+
Authorization: "token {{ access_token }}"
23+
Accept: "application/vnd.github.v3+json"
24+
method: GET
25+
status_code: 200
26+
force_basic_auth: yes
27+
check_mode: false
28+
register: registered_runners
29+
run_once: yes
30+
tags:
31+
- install
32+
- uninstall
3133

32-
- name: Check service facts
33-
service_facts:
34-
tags:
35-
- install
36-
- uninstall
34+
- name: Check service facts
35+
service_facts:
36+
tags:
37+
- install
38+
- uninstall
3739

38-
- name: Build service name
39-
set_fact:
40-
runner_service: "actions.runner.{{ ([( github_owner | default(github_account))[:45], runner_name] | join('.'))[:57] }}.service"
41-
when: service_name is not defined
42-
tags:
43-
- install
44-
- uninstall
40+
- name: Build service name
41+
set_fact:
42+
runner_service: "actions.runner.{{ ([( github_owner | default(github_account))[:45], runner_name] | join('.'))[:57] }}.service"
43+
when: service_name is not defined
44+
tags:
45+
- install
46+
- uninstall
4547

46-
- name: Build service name
47-
set_fact:
48-
runner_service: "{{ service_name }}"
49-
when: service_name is defined
50-
tags:
51-
- install
52-
- uninstall
48+
- name: Build service name
49+
set_fact:
50+
runner_service: "{{ service_name }}"
51+
when: service_name is defined
52+
tags:
53+
- install
54+
- uninstall
55+
check_mode: false

tasks/collect_info_repo.yml

+49-47
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,54 @@
11
---
2-
- name: Get registration token (RUN ONCE)
3-
uri:
4-
url: "{{ github_api_url }}/repos/{{ github_owner | default(github_account) }}/{{ github_repo }}/actions/runners/registration-token"
5-
headers:
6-
Authorization: "token {{ access_token }}"
7-
Accept: "application/vnd.github.v3+json"
8-
method: POST
9-
status_code: 201
10-
force_basic_auth: yes
11-
register: registration
12-
run_once: yes
13-
tags:
14-
- install
15-
- uninstall
2+
- block:
3+
- name: Get registration token (RUN ONCE)
4+
uri:
5+
url: "{{ github_api_url }}/repos/{{ github_owner | default(github_account) }}/{{ github_repo }}/actions/runners/registration-token"
6+
headers:
7+
Authorization: "token {{ access_token }}"
8+
Accept: "application/vnd.github.v3+json"
9+
method: POST
10+
status_code: 201
11+
force_basic_auth: yes
12+
register: registration
13+
run_once: yes
14+
tags:
15+
- install
16+
- uninstall
1617

17-
- name: Check currently registered runners (RUN ONCE)
18-
uri:
19-
url: "{{ github_api_url }}/repos/{{ github_owner | default(github_account) }}/{{ github_repo }}/actions/runners"
20-
headers:
21-
Authorization: "token {{ access_token }}"
22-
Accept: "application/vnd.github.v3+json"
23-
method: GET
24-
status_code: 200
25-
force_basic_auth: yes
26-
register: registered_runners
27-
run_once: yes
28-
tags:
29-
- install
30-
- uninstall
18+
- name: Check currently registered runners (RUN ONCE)
19+
uri:
20+
url: "{{ github_api_url }}/repos/{{ github_owner | default(github_account) }}/{{ github_repo }}/actions/runners"
21+
headers:
22+
Authorization: "token {{ access_token }}"
23+
Accept: "application/vnd.github.v3+json"
24+
method: GET
25+
status_code: 200
26+
force_basic_auth: yes
27+
register: registered_runners
28+
run_once: yes
29+
tags:
30+
- install
31+
- uninstall
3132

32-
- name: Check service facts
33-
service_facts:
34-
tags:
35-
- install
36-
- uninstall
33+
- name: Check service facts
34+
service_facts:
35+
tags:
36+
- install
37+
- uninstall
3738

38-
- name: Build service name
39-
set_fact:
40-
runner_service: "actions.runner.{{ ([([(github_owner | default(github_account)), github_repo ] | join('-'))[:45], runner_name] | join('.'))[:57] }}.service"
41-
when: service_name is not defined
42-
tags:
43-
- install
44-
- uninstall
39+
- name: Build service name
40+
set_fact:
41+
runner_service: "actions.runner.{{ ([([(github_owner | default(github_account)), github_repo ] | join('-'))[:45], runner_name] | join('.'))[:57] }}.service"
42+
when: service_name is not defined
43+
tags:
44+
- install
45+
- uninstall
4546

46-
- name: Build service name
47-
set_fact:
48-
runner_service: "{{ service_name }}"
49-
when: service_name is defined
50-
tags:
51-
- install
52-
- uninstall
47+
- name: Build service name
48+
set_fact:
49+
runner_service: "{{ service_name }}"
50+
when: service_name is defined
51+
tags:
52+
- install
53+
- uninstall
54+
check_mode: false

tasks/install_runner.yml

+4
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
return_content: yes
1919
status_code: 200
2020
body_format: json
21+
check_mode: false
2122
register: api_response
2223
run_once: yes
2324
become: false
@@ -34,6 +35,7 @@
3435
- name: Check if desired version already installed
3536
command: "grep -i {{ runner_version }} {{ runner_dir }}/bin/Runner.Listener.deps.json"
3637
register: runner_installed
38+
check_mode: false
3739
changed_when: False
3840
ignore_errors: yes
3941
tags:
@@ -137,6 +139,7 @@
137139
name: "{{ runner_service }}"
138140
state: started
139141
enabled: yes
142+
ignore_errors: "{{ ansible_check_mode }}"
140143
when: runner_state|lower == "started"
141144
tags:
142145
- install
@@ -146,6 +149,7 @@
146149
name: "{{ runner_service }}"
147150
state: stopped
148151
enabled: no
152+
ignore_errors: "{{ ansible_check_mode }}"
149153
when: runner_state|lower == "stopped"
150154
tags:
151155
- install

0 commit comments

Comments
 (0)