|
2 | 2 | - name: Info collections
|
3 | 3 | check_mode: false
|
4 | 4 | block:
|
5 |
| - - name: Set complete API url for repo runner |
6 |
| - ansible.builtin.set_fact: |
7 |
| - 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 |
| 5 | + - name: Set complete API url for repo runner |
| 6 | + ansible.builtin.set_fact: |
| 7 | + 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 |
9 | 9 |
|
10 |
| - - name: Set complete API url for org runner |
11 |
| - ansible.builtin.set_fact: |
12 |
| - github_full_api_url: "{{ github_api_url }}/orgs/{{ github_owner | default(github_account) }}/actions/runners" |
13 |
| - when: runner_org | bool and not github_enterprise |
| 10 | + - name: Set complete API url for org runner |
| 11 | + ansible.builtin.set_fact: |
| 12 | + github_full_api_url: "{{ github_api_url }}/orgs/{{ github_owner | default(github_account) }}/actions/runners" |
| 13 | + when: runner_org | bool and not github_enterprise |
14 | 14 |
|
15 |
| - - name: Set complete API url for enterprise runner |
16 |
| - ansible.builtin.set_fact: |
17 |
| - github_full_api_url: "{{ github_api_url }}/enterprises/{{ github_enterprise }}/actions/runners" |
18 |
| - when: github_enterprise |
| 15 | + - name: Set complete API url for enterprise runner |
| 16 | + ansible.builtin.set_fact: |
| 17 | + github_full_api_url: "{{ github_api_url }}/enterprises/{{ github_enterprise }}/actions/runners" |
| 18 | + when: github_enterprise |
19 | 19 |
|
20 |
| - - name: Get registration token (RUN ONCE) |
21 |
| - ansible.builtin.uri: |
22 |
| - url: "{{ github_full_api_url }}/registration-token" |
23 |
| - headers: |
24 |
| - Authorization: "token {{ access_token }}" |
25 |
| - Accept: "application/vnd.github.v3+json" |
26 |
| - method: POST |
27 |
| - status_code: 201 |
28 |
| - force_basic_auth: yes |
29 |
| - register: registration |
30 |
| - run_once: true |
| 20 | + - name: Get registration token (RUN ONCE) |
| 21 | + ansible.builtin.uri: |
| 22 | + url: "{{ github_full_api_url }}/registration-token" |
| 23 | + headers: |
| 24 | + Authorization: "token {{ access_token }}" |
| 25 | + Accept: "application/vnd.github.v3+json" |
| 26 | + method: POST |
| 27 | + status_code: 201 |
| 28 | + force_basic_auth: true |
| 29 | + register: registration |
| 30 | + run_once: true |
31 | 31 |
|
32 |
| - - name: Check currently registered runners (RUN ONCE) |
33 |
| - ansible.builtin.uri: |
34 |
| - url: "{{ github_full_api_url }}" |
35 |
| - headers: |
36 |
| - Authorization: "token {{ access_token }}" |
37 |
| - Accept: "application/vnd.github.v3+json" |
38 |
| - method: GET |
39 |
| - status_code: 200 |
40 |
| - force_basic_auth: yes |
41 |
| - register: registered_runners |
42 |
| - run_once: true |
| 32 | + - name: Check currently registered runners (RUN ONCE) |
| 33 | + ansible.builtin.uri: |
| 34 | + url: "{{ github_full_api_url }}" |
| 35 | + headers: |
| 36 | + Authorization: "token {{ access_token }}" |
| 37 | + Accept: "application/vnd.github.v3+json" |
| 38 | + method: GET |
| 39 | + status_code: 200 |
| 40 | + force_basic_auth: true |
| 41 | + register: registered_runners |
| 42 | + run_once: true |
43 | 43 |
|
44 |
| - - name: Get Runner User IDs |
45 |
| - ansible.builtin.command: id -u "{{ runner_user }}" |
46 |
| - changed_when: false |
47 |
| - register: runner_user_id |
| 44 | + - name: Get Runner User IDs |
| 45 | + ansible.builtin.command: id -u "{{ runner_user }}" |
| 46 | + changed_when: false |
| 47 | + register: runner_user_id |
48 | 48 |
|
49 |
| - - name: Get Runner Group IDs |
50 |
| - ansible.builtin.command: id -g "{{ runner_user }}" |
51 |
| - changed_when: false |
52 |
| - register: runner_user_group_id |
| 49 | + - name: Get Runner Group IDs |
| 50 | + ansible.builtin.command: id -g "{{ runner_user }}" |
| 51 | + changed_when: false |
| 52 | + register: runner_user_group_id |
53 | 53 |
|
54 |
| - - name: Set runner_system variable |
55 |
| - ansible.builtin.set_fact: |
56 |
| - runner_system: "{{ 'osx' if ansible_system == 'Darwin' else 'linux' }}" |
| 54 | + - name: Set runner_system variable |
| 55 | + ansible.builtin.set_fact: |
| 56 | + runner_system: "{{ 'osx' if ansible_system == 'Darwin' else 'linux' }}" |
57 | 57 |
|
58 |
| - - name: Find the latest runner version (RUN ONCE) |
59 |
| - ansible.builtin.uri: |
60 |
| - url: "https://api.github.com/repos/{{ runner_download_repository }}/releases/latest" |
61 |
| - headers: |
62 |
| - Content-Type: "application/json" |
63 |
| - method: GET |
64 |
| - return_content: yes |
65 |
| - status_code: 200 |
66 |
| - body_format: json |
67 |
| - check_mode: false |
68 |
| - register: api_response |
69 |
| - run_once: true |
70 |
| - become: false |
71 |
| - delegate_to: localhost |
72 |
| - when: runner_version == "latest" |
| 58 | + - name: Find the latest runner version (RUN ONCE) |
| 59 | + ansible.builtin.uri: |
| 60 | + url: "https://api.github.com/repos/{{ runner_download_repository }}/releases/latest" |
| 61 | + headers: |
| 62 | + Content-Type: "application/json" |
| 63 | + method: GET |
| 64 | + return_content: true |
| 65 | + status_code: 200 |
| 66 | + body_format: json |
| 67 | + check_mode: false |
| 68 | + register: api_response |
| 69 | + run_once: true |
| 70 | + become: false |
| 71 | + delegate_to: localhost |
| 72 | + when: runner_version == "latest" |
73 | 73 |
|
74 |
| - - name: Get systemd service facts |
75 |
| - ansible.builtin.service_facts: |
76 |
| - register: service_facts |
77 |
| - when: ansible_system == "Linux" |
| 74 | + - name: Get systemd service facts |
| 75 | + ansible.builtin.service_facts: |
| 76 | + register: service_facts |
| 77 | + when: ansible_system == "Linux" |
0 commit comments