-
-
Notifications
You must be signed in to change notification settings - Fork 80
/
Copy pathcollect_info.yml
83 lines (75 loc) · 2.9 KB
/
collect_info.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
---
- name: Info collections
check_mode: false
block:
- name: Set complete API url for repo runner
ansible.builtin.set_fact:
github_full_api_url: "{{ github_api_url }}/repos/{{ github_owner | default(github_account) }}/{{ github_repo }}/actions/runners"
when: not runner_org and github_enterprise is not defined
- name: Set complete API url for org runner
ansible.builtin.set_fact:
github_full_api_url: "{{ github_api_url }}/orgs/{{ github_owner | default(github_account) }}/actions/runners"
when: runner_org | bool and github_enterprise is not defined
- name: Set complete API url for enterprise runner
ansible.builtin.set_fact:
github_full_api_url: "{{ github_api_url }}/enterprises/{{ github_enterprise }}/actions/runners"
when: github_enterprise is defined
- name: Get registration token (RUN ONCE)
ansible.builtin.uri:
url: "{{ github_full_api_url }}/registration-token"
headers:
Authorization: "token {{ access_token }}"
Accept: "application/vnd.github.v3+json"
method: POST
status_code: 201
force_basic_auth: true
register: registration
delegate_to: localhost
become: false
run_once: true
- name: "Check currently registered runners for repo {{ '(RUN ONCE)' if all_runners_in_same_repo else '' }}"
ansible.builtin.uri:
url: "{{ github_full_api_url }}"
headers:
Authorization: "token {{ access_token }}"
Accept: "application/vnd.github.v3+json"
method: GET
body_format: form-urlencoded
body:
per_page: "{{ github_api_runners_per_page }}"
status_code: 200
force_basic_auth: true
register: registered_runners
delegate_to: localhost
become: false
run_once: "{{ all_runners_in_same_repo }}"
- name: Get Runner User IDs
ansible.builtin.command: id -u "{{ runner_user }}"
changed_when: false
register: runner_user_id
when: github_actions_system != "win"
- name: Get Runner Group IDs
ansible.builtin.command: id -g "{{ runner_user }}"
changed_when: false
register: runner_user_group_id
when: github_actions_system != "win"
- name: Find the latest runner version (RUN ONCE)
ansible.builtin.uri:
url: "https://api.github.com/repos/{{ runner_download_repository }}/releases/latest"
headers:
Authorization: "token {{ access_token }}"
Content-Type: "application/json"
method: GET
return_content: true
status_code: 200
body_format: json
check_mode: false
register: api_response
run_once: true
become: false
delegate_to: localhost
when: runner_version == "latest"
- name: Get systemd service facts
ansible.builtin.service_facts:
register: service_facts
when: github_actions_system == "linux"