|
72 | 72 | owner: "{{ runner_user }}" |
73 | 73 | mode: 0755 |
74 | 74 | when: runner_version not in runner_installed.stdout |
| 75 | + notify: |
| 76 | + - Restart runner service |
75 | 77 | tags: |
76 | 78 | - install |
77 | 79 |
|
78 | | -- name: Register runner (if new installation) |
| 80 | +- name: Register runner (if new installation) for repo |
79 | 81 | command: "{{ runner_dir }}/./config.sh --url {{ github_server }}/{{ github_owner | default(github_account) }}/{{ github_repo }} \ |
80 | 82 | --token {{ registration.json.token }} --unattended" |
81 | 83 | args: |
82 | 84 | chdir: "{{ runner_dir }}" |
83 | 85 | become: yes |
84 | 86 | become_user: "{{ runner_user }}" |
85 | 87 | no_log: "{{ hide_sensitive_logs | bool }}" |
86 | | - when: ansible_hostname not in registered_runners.json.runners|map(attribute='name')|list |
| 88 | + when: ansible_hostname not in registered_runners.json.runners|map(attribute='name')|list and not runner_org |
87 | 89 | tags: |
88 | 90 | - install |
89 | 91 |
|
90 | | -- name: Replace registered runner |
| 92 | +- name: Register runner (if new installation) for organization |
| 93 | + command: "{{ runner_dir }}/./config.sh --url {{ github_server }}/{{ github_owner | default(github_account) }} \ |
| 94 | + --token {{ registration.json.token }} --unattended" |
| 95 | + args: |
| 96 | + chdir: "{{ runner_dir }}" |
| 97 | + become: yes |
| 98 | + become_user: "{{ runner_user }}" |
| 99 | + no_log: "{{ hide_sensitive_logs | bool }}" |
| 100 | + when: ansible_hostname not in registered_runners.json.runners|map(attribute='name')|list and runner_org |
| 101 | + tags: |
| 102 | + - install |
| 103 | + |
| 104 | +- name: Replace registered runner for repo |
91 | 105 | command: "{{ runner_dir }}/config.sh --url {{ github_server }}/{{ github_owner | default(github_account) }}/{{ github_repo }} \ |
92 | 106 | --token {{ registration.json.token }} --unattended --replace" |
93 | 107 | args: |
94 | 108 | chdir: "{{ runner_dir }}" |
95 | 109 | become: yes |
96 | 110 | become_user: "{{ runner_user }}" |
97 | 111 | no_log: "{{ hide_sensitive_logs | bool }}" |
98 | | - when: replace_runner and ansible_hostname in registered_runners.json.runners|map(attribute='name')|list |
| 112 | + when: replace_runner and ansible_hostname in registered_runners.json.runners|map(attribute='name')|list and not github_org |
| 113 | + tags: |
| 114 | + - install |
| 115 | + |
| 116 | +- name: Replace registered runner for organization |
| 117 | + command: "{{ runner_dir }}/config.sh --url {{ github_server }}/{{ github_owner | default(github_account) }} \ |
| 118 | + --token {{ registration.json.token }} --unattended --replace" |
| 119 | + args: |
| 120 | + chdir: "{{ runner_dir }}" |
| 121 | + become: yes |
| 122 | + become_user: "{{ runner_user }}" |
| 123 | + no_log: "{{ hide_sensitive_logs | bool }}" |
| 124 | + when: replace_runner and ansible_hostname in registered_runners.json.runners|map(attribute='name')|list and github_org |
99 | 125 | tags: |
100 | 126 | - install |
101 | 127 |
|
|
0 commit comments