|
52 | 52 | validate_certs: false
|
53 | 53 | register: bastion_foreman_data
|
54 | 54 |
|
| 55 | +- name: Determine machine type for automatic interface configuration |
| 56 | + set_fact: |
| 57 | + machine_type: "{{ (ocpinventory.json.nodes[0].pm_addr.split('.')[0]).split('-')[-1] }}" |
| 58 | + |
55 | 59 | - name: Public VLAN autoconfiguration
|
56 | 60 | when: public_vlan
|
57 | 61 | block:
|
58 | 62 | - name: Public VLAN - Set controlplane_network_interface_idx to -1 for the last interface
|
59 | 63 | set_fact:
|
60 | 64 | controlplane_network_interface_idx: "-1"
|
61 | 65 |
|
| 66 | + - name: Public VLAN - Update bastion_controlplane_interface to use last interface |
| 67 | + set_fact: |
| 68 | + bastion_controlplane_interface: "{{ hw_nic_name[lab][machine_type][-1] }}" |
| 69 | + when: |
| 70 | + - bastion_controlplane_interface is not defined |
| 71 | + - lab in hw_nic_name |
| 72 | + - machine_type in hw_nic_name[lab] |
| 73 | + |
62 | 74 | - name: Public VLAN - Get assignment from quads
|
63 | 75 | uri:
|
64 | 76 | url: "https://{{ labs[lab]['quads'] }}/api/v3/assignments/active/{{ lab_cloud }}"
|
|
79 | 91 | cluster_name: "vlan{{ quads_assignment.json.vlan.vlan_id }}"
|
80 | 92 | when: cluster_name == "mno"
|
81 | 93 |
|
| 94 | +- name: Auto-configure bastion lab interface (only when not explicitly set) |
| 95 | + set_fact: |
| 96 | + bastion_lab_interface: "{{ hw_nic_name[lab][machine_type][0] }}" |
| 97 | + when: |
| 98 | + - bastion_lab_interface is not defined |
| 99 | + - lab in hw_nic_name |
| 100 | + - machine_type in hw_nic_name[lab] |
| 101 | + |
| 102 | +- name: Auto-configure bastion controlplane interface (only when not explicitly set) |
| 103 | + set_fact: |
| 104 | + bastion_controlplane_interface: "{{ hw_nic_name[lab][machine_type][controlplane_network_interface_idx|int+1] }}" |
| 105 | + when: |
| 106 | + - bastion_controlplane_interface is not defined |
| 107 | + - lab in hw_nic_name |
| 108 | + - machine_type in hw_nic_name[lab] |
| 109 | + - not public_vlan |
| 110 | + |
| 111 | +- name: Auto-configure controlplane lab interface (only when not explicitly set) |
| 112 | + set_fact: |
| 113 | + controlplane_lab_interface: "{{ hw_nic_name[lab][machine_type][0] }}" |
| 114 | + when: |
| 115 | + - controlplane_lab_interface is not defined |
| 116 | + - lab in hw_nic_name |
| 117 | + - machine_type in hw_nic_name[lab] |
| 118 | + |
82 | 119 | - name: Multi node cluster type tasks
|
83 | 120 | when: cluster_type == "mno"
|
84 | 121 | block:
|
|
294 | 331 | loop_control:
|
295 | 332 | index_var: idx
|
296 | 333 |
|
| 334 | +- name: Validate network interface variables are properly configured |
| 335 | + block: |
| 336 | + - name: Validate bastion_lab_interface is defined |
| 337 | + assert: |
| 338 | + that: |
| 339 | + - bastion_lab_interface is defined |
| 340 | + - bastion_lab_interface != "" |
| 341 | + fail_msg: "bastion_lab_interface is not properly configured. Check your all.yml configuration or verify lab/machine_type support in lab.yml" |
| 342 | + success_msg: "bastion_lab_interface is configured: {{ bastion_lab_interface }}" |
| 343 | + |
| 344 | + - name: Validate bastion_controlplane_interface is defined |
| 345 | + assert: |
| 346 | + that: |
| 347 | + - bastion_controlplane_interface is defined |
| 348 | + - bastion_controlplane_interface != "" |
| 349 | + fail_msg: "bastion_controlplane_interface is not properly configured. Check your all.yml configuration or verify lab/machine_type support in lab.yml" |
| 350 | + success_msg: "bastion_controlplane_interface is configured: {{ bastion_controlplane_interface }}" |
| 351 | + |
| 352 | + - name: Validate controlplane_lab_interface is defined |
| 353 | + assert: |
| 354 | + that: |
| 355 | + - controlplane_lab_interface is defined |
| 356 | + - controlplane_lab_interface != "" |
| 357 | + fail_msg: "controlplane_lab_interface is not properly configured. Check your all.yml configuration or verify lab/machine_type support in lab.yml" |
| 358 | + success_msg: "controlplane_lab_interface is configured: {{ controlplane_lab_interface }}" |
| 359 | + |
297 | 360 | - name: Place inventory file named {{ lab_cloud }}.local into inventory directory
|
298 | 361 | template:
|
299 | 362 | src: "inventory-{{ cluster_type }}.j2"
|
|
0 commit comments