Fix Amphora register playbook failing when using TLS#2162
Fix Amphora register playbook failing when using TLS#2162seunghun1ee wants to merge 1 commit intostackhpc/2025.1from
Conversation
CA certificate was not injected correctly for this playbook. Plus, using openstack.cloud.image Ansible module for renaming the existing old Amphora image.
|
It would be nice to backport this to Caracal too. |
There was a problem hiding this comment.
Code Review
The pull request correctly addresses the TLS issue by introducing the openstack_cacert variable and applying it to the OpenStack modules. It also transitions the image renaming task to use the openstack.cloud.image module. However, the implementation of the rename task contains a logic error: by including the filename parameter, the module will attempt to upload the new image data to the old image ID because their checksums differ. This results in an unnecessary and incorrect data upload during what should be a simple rename operation. I have provided a suggestion to simplify this task.
| openstack.cloud.image: | ||
| auth_type: password | ||
| auth: "{{ openstack_auth }}" | ||
| ca_cert: "{{ openstack_cacert }}" | ||
| interface: "{{ openstack_interface }}" | ||
| id: "{{ image_info.images[0].id }}" | ||
| name: "amphora-x64-haproxy-{{ ansible_facts.date_time.iso8601_basic_short }}" # Change the name | ||
| tags: ["amphora"] | ||
| container_format: bare | ||
| disk_format: qcow2 | ||
| is_public: false | ||
| filename: "{{ image_path }}" | ||
| properties: | ||
| hw_architecture: x86_64 | ||
| hw_rng_model: virtio |
There was a problem hiding this comment.
The "rename" task should not include the filename parameter. When filename is provided along with an id, the openstack.cloud.image module compares the local file's checksum with the existing image in Glance. Since the when condition (line 110) ensures the checksums are different, the module will attempt to upload the file at image_path (the new image) to the image identified by id (the old image). This results in the old image being overwritten with the new data before it is renamed, which is redundant and incorrect for an archival/rename step. Additionally, parameters like container_format, disk_format, is_public, and properties are unnecessary for a simple rename and should be removed to avoid accidental metadata updates.
openstack.cloud.image:
auth_type: password
auth: "{{ openstack_auth }}"
ca_cert: "{{ openstack_cacert }}"
interface: "{{ openstack_interface }}"
id: "{{ image_info.images[0].id }}"
name: "amphora-x64-haproxy-{{ ansible_facts.date_time.iso8601_basic_short }}"
tags: ["amphora"]
CA certificate was not injected correctly for this playbook.
Plus, using openstack.cloud.image Ansible module for renaming the existing old Amphora image.