|
8 | 8 | tasks_from: admin_setup.yml |
9 | 9 | tags: |
10 | 10 | - admin-setup |
11 | | - |
12 | 11 | - name: Run Test |
13 | 12 | ansible.builtin.import_role: |
14 | 13 | name: cifmw_setup |
|
26 | 25 | tags: |
27 | 26 | - compliance |
28 | 27 |
|
| 28 | + # FDP Update - OpenStack package updates across all layers |
| 29 | + - name: FDP Update - Validate required variables |
| 30 | + when: cifmw_fdp_update_enabled | default(false) | bool |
| 31 | + block: |
| 32 | + - name: Validate required variables are set |
| 33 | + ansible.builtin.assert: |
| 34 | + that: |
| 35 | + - cifmw_fdp_update_target_package is defined |
| 36 | + - cifmw_fdp_update_target_package | length > 0 |
| 37 | + - cifmw_fdp_update_repo_baseurl is defined |
| 38 | + - cifmw_fdp_update_repo_baseurl | length > 0 |
| 39 | + fail_msg: | |
| 40 | + Required variables are missing! |
| 41 | +
|
| 42 | + You must set: |
| 43 | + - cifmw_fdp_update_target_package: Name of the RPM package to update |
| 44 | + - cifmw_fdp_update_repo_baseurl: Repository base URL containing the updated package |
| 45 | + success_msg: "Required variables validated successfully" |
| 46 | + |
| 47 | + - name: Display update configuration |
| 48 | + ansible.builtin.debug: |
| 49 | + msg: |
| 50 | + - "==============================================" |
| 51 | + - "OpenStack Package Update Configuration" |
| 52 | + - "==============================================" |
| 53 | + - "Target Package: {{ cifmw_fdp_update_target_package }}" |
| 54 | + - "Repository: {{ cifmw_fdp_update_repo_baseurl }}" |
| 55 | + - "" |
| 56 | + - "Update Control Flags:" |
| 57 | + - " Control Plane Images: {{ cifmw_fdp_update_container_images_enabled | default(true) }}" |
| 58 | + - " EDPM Update: {{ cifmw_fdp_update_edpm_enabled | default(true) }}" |
| 59 | + - " - Container Images: {{ cifmw_fdp_update_edpm_containers_enabled | default(true) }}" |
| 60 | + - " - Host Packages: {{ cifmw_fdp_update_edpm_packages_enabled | default(true) }}" |
| 61 | + - "==============================================" |
| 62 | + |
| 63 | + - name: Setup hypervisor firewall for registry access |
| 64 | + become: true |
| 65 | + when: cifmw_fdp_update_setup_hypervisor_firewall | default(true) | bool |
| 66 | + block: |
| 67 | + - name: Allow traffic from osp_trunk to ocpbm (compute -> registry) |
| 68 | + ansible.builtin.iptables: |
| 69 | + chain: FORWARD |
| 70 | + in_interface: osp_trunk |
| 71 | + out_interface: ocpbm |
| 72 | + jump: ACCEPT |
| 73 | + action: insert |
| 74 | + rule_num: '1' |
| 75 | + |
| 76 | + - name: Allow return traffic from ocpbm to osp_trunk (registry -> compute) |
| 77 | + ansible.builtin.iptables: |
| 78 | + chain: FORWARD |
| 79 | + in_interface: ocpbm |
| 80 | + out_interface: osp_trunk |
| 81 | + ctstate: RELATED,ESTABLISHED |
| 82 | + jump: ACCEPT |
| 83 | + action: insert |
| 84 | + rule_num: '1' |
| 85 | + |
| 86 | + - name: Enable NAT for compute nodes to access registry |
| 87 | + ansible.builtin.iptables: |
| 88 | + table: nat |
| 89 | + chain: POSTROUTING |
| 90 | + source: 192.168.122.0/24 |
| 91 | + destination: 192.168.201.0/24 |
| 92 | + out_interface: ocpbm |
| 93 | + jump: MASQUERADE |
| 94 | + |
| 95 | + - name: Persist firewall rules |
| 96 | + community.general.iptables_state: |
| 97 | + state: saved |
| 98 | + path: /etc/sysconfig/iptables |
| 99 | + |
| 100 | + - name: Update control plane container images |
| 101 | + ansible.builtin.import_role: |
| 102 | + name: fdp_update_container_images |
| 103 | + vars: |
| 104 | + cifmw_fdp_update_container_images_target_package: "{{ cifmw_fdp_update_target_package }}" |
| 105 | + cifmw_fdp_update_container_images_repo_baseurl: "{{ cifmw_fdp_update_repo_baseurl }}" |
| 106 | + cifmw_fdp_update_container_images_namespace: "{{ cifmw_fdp_update_namespace | default('openstack') }}" |
| 107 | + when: cifmw_fdp_update_container_images_enabled | default(true) | bool |
| 108 | + |
| 109 | + - name: Update EDPM (containers and host packages) |
| 110 | + ansible.builtin.import_role: |
| 111 | + name: fdp_update_edpm |
| 112 | + vars: |
| 113 | + cifmw_fdp_update_edpm_repo_baseurl: "{{ cifmw_fdp_update_repo_baseurl }}" |
| 114 | + when: cifmw_fdp_update_edpm_enabled | default(true) | bool |
| 115 | + |
| 116 | + - name: Build FDP status messages |
| 117 | + ansible.builtin.set_fact: |
| 118 | + _cifmw_fdp_update_cp_status: "{{ 'Updated' if (cifmw_fdp_update_container_images_enabled | default(true) | bool) else 'Skipped' }}" |
| 119 | + _cifmw_fdp_update_edpm_status: "{{ 'Updated' if (cifmw_fdp_update_edpm_enabled | default(true) | bool) else 'Skipped' }}" |
| 120 | + _cifmw_fdp_update_edpm_images_status: "{{ 'Updated' if (cifmw_fdp_update_edpm_containers_enabled | default(true) | bool) else 'Skipped' }}" |
| 121 | + _cifmw_fdp_update_edpm_packages_status: "{{ 'Service created' if (cifmw_fdp_update_edpm_packages_enabled | default(true) | bool) else 'Skipped' }}" |
| 122 | + |
| 123 | + - name: Display FDP completion summary |
| 124 | + ansible.builtin.debug: |
| 125 | + msg: |
| 126 | + - "==============================================" |
| 127 | + - "OpenStack Package Update Completed" |
| 128 | + - "==============================================" |
| 129 | + - "" |
| 130 | + - "Control plane containers: {{ _cifmw_fdp_update_cp_status }}" |
| 131 | + - "EDPM update: {{ _cifmw_fdp_update_edpm_status }}" |
| 132 | + - " - Container images: {{ _cifmw_fdp_update_edpm_images_status }}" |
| 133 | + - " - Host packages: {{ _cifmw_fdp_update_edpm_packages_status }}" |
| 134 | + - "" |
| 135 | + - "Package: {{ cifmw_fdp_update_target_package }}" |
| 136 | + - "Repository: {{ cifmw_fdp_update_repo_baseurl }}" |
| 137 | + - "==============================================" |
| 138 | + tags: |
| 139 | + - fdp-update |
| 140 | + |
29 | 141 | - name: Run compliance scan for computes |
30 | 142 | hosts: "{{ groups['computes'] | default ([]) }}" |
31 | 143 | gather_facts: true |
|
0 commit comments