|
1 | 1 | --- |
2 | | -- name: Set facts related to the reproducer |
3 | | - ansible.builtin.set_fact: |
4 | | - _ctl_reproducer_basedir: >- |
5 | | - {{ |
6 | | - ( |
7 | | - '/home/zuul', |
8 | | - 'ci-framework-data', |
9 | | - ) | path_join |
10 | | - }} |
11 | | -
|
12 | 2 | # The dynamic inventory sets the ansible_ssh_user to zuul once we get the proper |
13 | 3 | # ssh configuration accesses set. |
14 | 4 | - name: Configure controller-0 |
|
25 | 15 | cifmw_sushy_emulator_install_type: podman |
26 | 16 | cifmw_sushy_emulator_hypervisor_address: >- |
27 | 17 | {{ inventory_hostname }}.utility |
28 | | - cifmw_sushy_emulator_basedir: "{{ _ctl_reproducer_basedir }}" |
| 18 | + cifmw_sushy_emulator_basedir: "{{ cifmw_reproducer_controller_basedir }}" |
29 | 19 | cifmw_sushy_emulator_connection_name: "sushy.utility" |
30 | | - cifmw_sushy_emulator_sshkey_path: >- |
31 | | - {{ |
32 | | - [_ctl_reproducer_basedir, '../.ssh/sushy_emulator-key'] | |
33 | | - path_join |
34 | | - }} |
35 | | - cifmw_podman_user_linger: "zuul" |
| 20 | + cifmw_sushy_emulator_sshkey_path: "{{ cifmw_reproducer_controller_user_dir }}/.ssh/sushy_emulator-key" |
| 21 | + cifmw_podman_user_linger: "{{ cifmw_reproducer_controller_user }}" |
36 | 22 | cifmw_sushy_emulator_libvirt_user: >- |
37 | 23 | {{ |
38 | 24 | hostvars[cifmw_sushy_emulator_hypervisor_target].ansible_user_id | |
|
41 | 27 | block: |
42 | 28 | - name: Ensure directories exist |
43 | 29 | ansible.builtin.file: |
44 | | - path: "{{ _ctl_reproducer_basedir }}/{{ item }}" |
| 30 | + path: "{{ cifmw_reproducer_controller_basedir }}/{{ item }}" |
45 | 31 | state: directory |
46 | 32 | mode: "0755" |
47 | 33 | loop: |
|
118 | 104 | - bootstrap |
119 | 105 | ansible.builtin.shell: |
120 | 106 | cmd: >- |
121 | | - cat /home/zuul/reproducer-inventory/* > |
122 | | - {{ _ctl_reproducer_basedir }}/artifacts/zuul_inventory.yml |
| 107 | + cat {{ cifmw_reproducer_controller_user_dir }}/reproducer-inventory/* > |
| 108 | + {{ cifmw_reproducer_controller_basedir }}/artifacts/zuul_inventory.yml |
123 | 109 |
|
124 | 110 | # You want to use the "name" parameter of the ansible.builtin.include_vars |
125 | 111 | # call, such as: |
126 | 112 | # - name: Load mac mapping |
127 | 113 | # ansible.builtin.include_vars: |
128 | | - # file: "{{ _ctl_reproducer_basedir }}/parameters/interfaces-info.yml" |
| 114 | + # file: "{{ cifmw_reproducer_controller_basedir }}/parameters/interfaces-info.yml" |
129 | 115 | # name: my_fancy_name |
130 | 116 | # Then you'll be able to access the mapping content via `my_fancy_name`. |
131 | 117 | - name: Push the MAC mapping data |
|
135 | 121 | - cifmw_libvirt_manager_mac_map is defined |
136 | 122 | ansible.builtin.copy: |
137 | 123 | mode: "0644" |
138 | | - dest: "{{ _ctl_reproducer_basedir }}/parameters/interfaces-info.yml" |
| 124 | + dest: "{{ cifmw_reproducer_controller_basedir }}/parameters/interfaces-info.yml" |
139 | 125 | content: "{{ cifmw_libvirt_manager_mac_map | to_nice_yaml }}" |
140 | 126 |
|
141 | 127 | - name: Inject other Hypervisor SSH keys |
|
149 | 135 | default(hostvars[host]['inventory_hostname']) |
150 | 136 | }} |
151 | 137 | ansible.builtin.copy: |
152 | | - dest: "/home/zuul/.ssh/ssh_{{ _ssh_host }}" |
| 138 | + dest: "{{ cifmw_reproducer_controller_user_dir }}/.ssh/ssh_{{ _ssh_host }}" |
153 | 139 | content: "{{ _ssh_key }}" |
154 | 140 | mode: "0600" |
155 | 141 | loop: "{{ hostvars.keys() }}" |
|
175 | 161 | ansible.builtin.blockinfile: |
176 | 162 | create: true |
177 | 163 | mode: "0600" |
178 | | - path: "/home/zuul/.ssh/config" |
| 164 | + path: "{{ cifmw_reproducer_controller_user_dir }}/.ssh/config" |
179 | 165 | marker: "## {mark} {{ _ssh_host }}" |
180 | 166 | block: |- |
181 | 167 | Host {{ _ssh_host }} {{ hostvars[host]['inventory_hostname'] }} |
|
210 | 196 | ansible.builtin.blockinfile: |
211 | 197 | create: true |
212 | 198 | mode: "0600" |
213 | | - path: "/home/zuul/.ssh/config" |
| 199 | + path: "{{ cifmw_reproducer_controller_user_dir }}/.ssh/config" |
214 | 200 | marker: "## {mark} {{ host }}" |
215 | 201 | block: |- |
216 | 202 | Host {{ host }} {{ _hostname }} {{ _hostname }}.utility {{ hostvars[host].ansible_host }} |
|
232 | 218 |
|
233 | 219 | - name: Create kube directory |
234 | 220 | ansible.builtin.file: |
235 | | - path: "/home/zuul/.kube" |
| 221 | + path: "{{ cifmw_reproducer_controller_user_dir }}/.kube" |
236 | 222 | state: directory |
237 | | - owner: "{{ cifmw_reproducer_user }}" |
238 | | - group: "{{ cifmw_reproducer_user }}" |
| 223 | + owner: "{{ cifmw_reproducer_controller_user }}" |
| 224 | + group: "{{ cifmw_reproducer_controller_user }}" |
239 | 225 | mode: "0750" |
240 | 226 |
|
241 | 227 | - name: Inject kubeconfig content |
242 | 228 | when: |
243 | 229 | - _devscripts_kubeconfig.content is defined or |
244 | 230 | _crc_kubeconfig.content is defined |
245 | 231 | ansible.builtin.copy: |
246 | | - dest: "/home/zuul/.kube/config" |
| 232 | + dest: "{{ cifmw_reproducer_controller_user_dir }}/.kube/config" |
247 | 233 | content: >- |
248 | 234 | {{ |
249 | 235 | (_use_ocp | bool) | |
250 | 236 | ternary(_devscripts_kubeconfig.content, _crc_kubeconfig.content) | |
251 | 237 | b64decode |
252 | 238 | }} |
253 | | - owner: "{{ cifmw_reproducer_user }}" |
254 | | - group: "{{ cifmw_reproducer_user }}" |
| 239 | + owner: "{{ cifmw_reproducer_controller_user }}" |
| 240 | + group: "{{ cifmw_reproducer_controller_user }}" |
255 | 241 | mode: "0640" |
256 | 242 |
|
257 | 243 | - name: Inject kubeadmin-password if exists |
258 | 244 | when: |
259 | 245 | - _devscripts_kubeadm.content is defined or |
260 | 246 | _crc_kubeadm.content is defined |
261 | 247 | ansible.builtin.copy: |
262 | | - dest: "/home/zuul/.kube/kubeadmin-password" |
| 248 | + dest: "{{ cifmw_reproducer_controller_user_dir }}/.kube/kubeadmin-password" |
263 | 249 | content: >- |
264 | 250 | {{ |
265 | 251 | (_devscripts_kubeadm.content is defined) | |
266 | 252 | ternary(_devscripts_kubeadm.content, _crc_kubeadm.content) | |
267 | 253 | b64decode |
268 | 254 | }} |
269 | | - owner: "{{ cifmw_reproducer_user }}" |
270 | | - group: "{{ cifmw_reproducer_user }}" |
| 255 | + owner: "{{ cifmw_reproducer_controller_user }}" |
| 256 | + group: "{{ cifmw_reproducer_controller_user }}" |
271 | 257 | mode: "0600" |
272 | 258 |
|
273 | 259 | - name: Inject devscripts private key if set |
274 | 260 | when: |
275 | 261 | - _devscript_privkey.content is defined |
276 | 262 | ansible.builtin.copy: |
277 | | - dest: "{{ ansible_user_dir }}/.ssh/devscripts_key" |
| 263 | + dest: "{{ cifmw_reproducer_controller_user_dir }}/.ssh/devscripts_key" |
278 | 264 | content: "{{ _devscript_privkey.content | b64decode }}" |
279 | | - owner: "{{ cifmw_reproducer_user }}" |
280 | | - group: "{{ cifmw_reproducer_user }}" |
| 265 | + owner: "{{ cifmw_reproducer_controller_user }}" |
| 266 | + group: "{{ cifmw_reproducer_controller_user }}" |
281 | 267 | mode: "0400" |
282 | 268 |
|
283 | 269 | - name: Ensure /etc/ci/env is created |
|
289 | 275 |
|
290 | 276 | - name: Manage secrets on controller-0 |
291 | 277 | vars: |
292 | | - cifmw_manage_secrets_basedir: "/home/zuul/ci-framework-data" |
293 | | - cifmw_manage_secrets_owner: "{{ cifmw_reproducer_user }}" |
| 278 | + cifmw_manage_secrets_basedir: "{{ cifmw_reproducer_controller_basedir }}" |
| 279 | + cifmw_manage_secrets_owner: "{{ cifmw_reproducer_controller_user }}" |
294 | 280 | block: |
295 | 281 | - name: Initialize secret manager |
296 | 282 | ansible.builtin.import_role: |
|
362 | 348 | delegate_to: localhost |
363 | 349 | ansible.posix.synchronize: |
364 | 350 | src: "{{ cifmw_reproducer_src_dir }}/" |
365 | | - dest: "zuul@{{ item }}:{{ cifmw_reproducer_src_dir }}" |
| 351 | + dest: "{{ cifmw_reproducer_controller_user }}@{{ item }}:{{ cifmw_reproducer_controller_user_dir }}/src" |
366 | 352 | archive: true |
367 | 353 | recursive: true |
368 | 354 | loop: "{{ groups['controllers'] }}" |
|
417 | 403 | }} |
418 | 404 | ansible.builtin.copy: |
419 | 405 | mode: "0644" |
420 | | - dest: "/home/zuul/ci-framework-data/parameters/reproducer-variables.yml" |
| 406 | + dest: "{{ cifmw_reproducer_controller_basedir }}/parameters/reproducer-variables.yml" |
421 | 407 | content: "{{ _filtered_vars | to_nice_yaml }}" |
422 | 408 |
|
423 | 409 | - name: Create reproducer-variables.yml symlink to old location |
424 | 410 | ansible.builtin.file: |
425 | | - dest: "/home/zuul/reproducer-variables.yml" |
426 | | - src: "/home/zuul/ci-framework-data/parameters/reproducer-variables.yml" |
| 411 | + dest: "{{ cifmw_reproducer_controller_user_dir }}/reproducer-variables.yml" |
| 412 | + src: "{{ cifmw_reproducer_controller_basedir }}/parameters/reproducer-variables.yml" |
427 | 413 | state: link |
428 | 414 |
|
429 | 415 | - name: Inject local environment parameters |
430 | 416 | ansible.builtin.copy: |
431 | 417 | mode: "0644" |
432 | | - dest: "/home/zuul/ci-framework-data/parameters/openshift-environment.yml" |
| 418 | + dest: "{{ cifmw_reproducer_controller_basedir }}/parameters/openshift-environment.yml" |
433 | 419 | content: |- |
434 | 420 | {% raw %} |
435 | 421 | --- |
|
450 | 436 |
|
451 | 437 | - name: Create openshift-environment.yml symlink to old location |
452 | 438 | ansible.builtin.file: |
453 | | - dest: "/home/zuul/openshift-environment.yml" |
454 | | - src: "/home/zuul/ci-framework-data/parameters/openshift-environment.yml" |
| 439 | + dest: "{{ cifmw_reproducer_controller_user_dir }}/openshift-environment.yml" |
| 440 | + src: "{{ cifmw_reproducer_controller_basedir }}/parameters/openshift-environment.yml" |
455 | 441 | state: link |
456 | 442 |
|
457 | 443 | - name: Get interfaces-info content |
458 | 444 | register: _nic_info |
459 | 445 | ansible.builtin.slurp: |
460 | | - src: "{{ _ctl_reproducer_basedir }}/parameters/interfaces-info.yml" |
| 446 | + src: "{{ cifmw_reproducer_controller_basedir }}/parameters/interfaces-info.yml" |
461 | 447 |
|
462 | 448 | # We detected OCP cluster may have some downtime even after it's supposed |
463 | 449 | # to be started. |
|
484 | 470 | {{ _nic_info.content | b64decode | from_yaml }} |
485 | 471 | cifmw_networking_mapper_network_name: >- |
486 | 472 | {{ _cifmw_libvirt_manager_layout.vms.controller.nets.1 }} |
487 | | - cifmw_networking_mapper_basedir: "/home/zuul/ci-framework-data" |
| 473 | + cifmw_networking_mapper_basedir: "{{ cifmw_reproducer_controller_basedir }}" |
488 | 474 | ansible.builtin.import_role: |
489 | 475 | name: networking_mapper |
490 | 476 |
|
|
494 | 480 | block: |
495 | 481 | - name: Inject CRC ssh key |
496 | 482 | ansible.builtin.copy: |
497 | | - dest: "/home/zuul/.ssh/crc_key" |
| 483 | + dest: "{{ cifmw_reproducer_controller_user_dir }}/.ssh/crc_key" |
498 | 484 | content: "{{ crc_priv_key['content'] | b64decode }}" |
499 | 485 | mode: "0400" |
500 | | - owner: "{{ cifmw_reproducer_user }}" |
501 | | - group: "{{ cifmw_reproducer_user }}" |
| 486 | + owner: "{{ cifmw_reproducer_controller_user }}" |
| 487 | + group: "{{ cifmw_reproducer_controller_user }}" |
502 | 488 |
|
503 | 489 | - name: Ensure we have all dependencies installed |
504 | 490 | ansible.builtin.async_status: |
|
0 commit comments