|
| 1 | +# Deploy nodes with different discovered OS images |
| 2 | + |
| 3 | +This page documents the reproducer workflow for nodes with different discovered |
| 4 | +OS images than other nodes. |
| 5 | + |
| 6 | +With the `discover_latest_image` role, it is possible to find the latest qcow2 |
| 7 | +OS images from multiple different URLs. With those discovered images, we can |
| 8 | +then modify the Libvirt configuration to run different OS versions on different |
| 9 | +nodes. |
| 10 | + |
| 11 | +In the below example, we will modify a reproducer to run CentOS 10 on the |
| 12 | +compute nodes, and CentOS 9 on a controller and a networker node. |
| 13 | + |
| 14 | +## Request the discovery of multiple different images |
| 15 | + |
| 16 | +Provide a `cifmw_discover_latest_image_requests` dict with the required fields |
| 17 | +for multiple different image URLs to discover multiple different images. For |
| 18 | +example: |
| 19 | + |
| 20 | +```yaml |
| 21 | +cifmw_discover_latest_image_requests: |
| 22 | + centos10: |
| 23 | + base_url: "https://cloud.centos.org/centos/10-stream/x86_64/images/" |
| 24 | + qcow_prefix: "CentOS-Stream-GenericCloud-x86_64-" |
| 25 | + images_file: CHECKSUM |
| 26 | + centos9: |
| 27 | + base_url: "https://cloud.centos.org/centos/9-stream/x86_64/images/" |
| 28 | + qcow_prefix: "CentOS-Stream-GenericCloud-x86_64-" |
| 29 | + images_file: CHECKSUM |
| 30 | +``` |
| 31 | +
|
| 32 | +## Update VM Image Sources In the Libvirt Config |
| 33 | +
|
| 34 | +Use one of the following patterns depending on how |
| 35 | +`cifmw_libvirt_manager_configuration` is defined in your scenario. |
| 36 | + |
| 37 | +### Direct configuration |
| 38 | + |
| 39 | +If you wish to modify a `cifmw_libvirt_manager_configuration` directly, edit |
| 40 | +the `image_url`, `sha256_image_name`, and `disk_file_name` fields in your |
| 41 | +desired entries. For example: |
| 42 | + |
| 43 | +```yaml |
| 44 | +cifmw_libvirt_manager_configuration: |
| 45 | + vms: |
| 46 | + compute: |
| 47 | + image_url: "{{ cifmw_discovered_images_dict.centos10.image_url }}" |
| 48 | + sha256_image_name: "{{ cifmw_discovered_images_dict.centos10.hash }}" |
| 49 | + disk_file_name: "base-os-centos10.qcow2" |
| 50 | + controller: |
| 51 | + image_url: "{{ cifmw_discovered_images_dict.centos9.image_url }}" |
| 52 | + sha256_image_name: "{{ cifmw_discovered_images_dict.centos9.hash }}" |
| 53 | + disk_file_name: "base-os-centos9.qcow2" |
| 54 | + networker: |
| 55 | + image_url: "{{ cifmw_discovered_images_dict.centos9.image_url }}" |
| 56 | + sha256_image_name: "{{ cifmw_discovered_images_dict.centos9.hash }}" |
| 57 | + disk_file_name: "base-os-centos9.qcow2" |
| 58 | +``` |
| 59 | +~~~{tip} |
| 60 | +Be careful to supply different filenames to the `disk_file_name` field for |
| 61 | +different VM types when you don't want them to use the same OS image. Failing |
| 62 | +to do so will cause the different VM types to be created using the same OS |
| 63 | +image. |
| 64 | + |
| 65 | +When two different VM types are using the same base VM image, then they can |
| 66 | +use the same `disk_file_name` to avoid downloading the same image multiple |
| 67 | +times. |
| 68 | +~~~ |
| 69 | + |
| 70 | +### Configuration sourced from external file |
| 71 | + |
| 72 | +If the `cifmw_libvirt_manager_configuration` is sourced from an external file |
| 73 | +and you wish to modify it to use separate images for separate VM types, use |
| 74 | +`cifmw_libvirt_manager_configuration_patch_*` variables instead: |
| 75 | + |
| 76 | +```yaml |
| 77 | +cifmw_libvirt_manager_configuration_patch_01_compute_image: |
| 78 | + vms: |
| 79 | + compute: |
| 80 | + image_url: "{{ cifmw_discovered_images_dict.centos10.image_url }}" |
| 81 | + sha256_image_name: "{{ cifmw_discovered_images_dict.centos10.hash }}" |
| 82 | + disk_file_name: "base-os-centos10.qcow2" |
| 83 | +
|
| 84 | +cifmw_libvirt_manager_configuration_patch_02_controller_image: |
| 85 | + vms: |
| 86 | + controller: |
| 87 | + image_url: "{{ cifmw_discovered_images_dict.centos9.image_url }}" |
| 88 | + sha256_image_name: "{{ cifmw_discovered_images_dict.centos9.hash }}" |
| 89 | + disk_file_name: "base-os-centos9.qcow2" |
| 90 | +
|
| 91 | +cifmw_libvirt_manager_configuration_patch_03_networker_image: |
| 92 | + vms: |
| 93 | + networker: |
| 94 | + image_url: "{{ cifmw_discovered_images_dict.centos9.image_url }}" |
| 95 | + sha256_image_name: "{{ cifmw_discovered_images_dict.centos9.hash }}" |
| 96 | + disk_file_name: "base-os-centos9.qcow2" |
| 97 | +``` |
| 98 | + |
| 99 | +The `libvirt_manager` role collects all |
| 100 | +`cifmw_libvirt_manager_configuration_patch_*` variables, sorts them by variable |
| 101 | +name, then merges them recursively on top of the base configuration. |
| 102 | + |
| 103 | +## Run the reproducer |
| 104 | + |
| 105 | +Run the reproducer, and once the virtual machines are up, validate that they |
| 106 | +are running the appropriate operating systems. For example, run commands like: |
| 107 | + |
| 108 | +```bash |
| 109 | +ssh controller-0 "cat /etc/redhat-release" |
| 110 | +ssh compute-0 "cat /etc/redhat-release" |
| 111 | +ssh networker-0 "cat /etc/redhat-release" |
| 112 | +``` |
0 commit comments