|
41 | 41 | failed_when: "'0.16.2-gitlab.25' not in machine_version.stdout" |
42 | 42 |
|
43 | 43 | - name: "Identify installed fleeting plugins" |
| 44 | + become: true |
44 | 45 | ansible.builtin.command: "gitlab-runner fleeting list" |
45 | 46 | register: "fleeting_cmd" |
46 | 47 | changed_when: false |
|
64 | 65 | - "gitlab_runner_version is defined" |
65 | 66 |
|
66 | 67 | - name: "Assert that ignition.json file was created" |
| 68 | + become: true |
67 | 69 | ansible.builtin.stat: |
68 | 70 | path: "/etc/gitlab-runner/ignition.json" |
69 | 71 | register: "ignition" |
|
73 | 75 | when: "gitlab_runner_ssh_public_key | default('') | length == 0 or gitlab_runner_ssh_public_key | default('') | length == 0" |
74 | 76 | block: |
75 | 77 | - name: "Assert that SSH key pair was created" |
| 78 | + become: true |
76 | 79 | ansible.builtin.stat: |
77 | 80 | path: "/etc/gitlab-runner/gitlab_runner_key" |
78 | 81 | register: "ssh_key" |
79 | 82 | failed_when: "not ssh_key.stat.isreg or ssh_key.stat.mode != '0600'" |
80 | 83 |
|
81 | 84 | - name: "Read generated SSH public key" |
| 85 | + become: true |
82 | 86 | ansible.builtin.command: "cat /etc/gitlab-runner/gitlab_runner_key.pub" |
83 | 87 | register: "generated_pub_key" |
84 | 88 | changed_when: false |
|
95 | 99 | - "gitlab_runner_ssh_private_key | default('') | length > 0" |
96 | 100 |
|
97 | 101 | - name: "Read flatcar linux config" |
| 102 | + become: true |
98 | 103 | ansible.builtin.command: "cat /etc/gitlab-runner/ignition.json" |
99 | 104 | register: "flatcar_linux_config" |
100 | 105 | changed_when: false |
|
109 | 114 | gitlab_runner_authentication_token: "{{ lookup('env', 'AUTHENTICATION_TOKEN') }}" |
110 | 115 |
|
111 | 116 | - name: "Assert that the runner was registered successfully" |
| 117 | + become: true |
112 | 118 | ansible.builtin.command: "gitlab-runner list" |
113 | 119 | changed_when: false |
114 | 120 | register: "runners" |
|
117 | 123 | when: "gitlab_runner_authentication_token | length > 0" |
118 | 124 |
|
119 | 125 | - name: "Assert that the verify command is successful" |
| 126 | + become: true |
120 | 127 | ansible.builtin.command: "gitlab-runner verify" |
121 | 128 | changed_when: false |
122 | 129 | register: "runners_verify" |
|
131 | 138 | failed_when: '"# TYPE gitlab_runner_version_info" not in metrics.content' |
132 | 139 |
|
133 | 140 | - name: "Unregister GitLab-Runner" |
| 141 | + become: true |
134 | 142 | ansible.builtin.command: "gitlab-runner unregister --all-runners" |
135 | 143 | changed_when: false |
136 | 144 | # Do not verify runner registration in forks |
|
0 commit comments