Skip to content

Commit

Permalink
Remove the cluster_previous_image workaround (#4)
Browse files Browse the repository at this point in the history
The caas operator always sends the correct image via
extra_vars, so we can remove the cluster_previous_image
workaround.
  • Loading branch information
JohnGarbutt authored Jan 30, 2024
1 parent 5f345bb commit 776651a
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 21 deletions.
19 changes: 0 additions & 19 deletions roles/cluster_infra/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,6 @@
}
dest: "{{ terraform_project_path }}/backend.tf"

# Patching in this appliance is implemented as a switch to a new base image
# So unless explicitly patching, we want to use the same image as last time
# To do this, we query the previous Terraform state before updating
- block:
- name: Get previous Terraform state
stackhpc.terraform.terraform_output:
binary_path: "{{ terraform_binary_path }}"
project_path: "{{ terraform_project_path }}"
backend_config: "{{ terraform_backend_config }}"
register: cluster_infra_terraform_output

- name: Extract image from Terraform state
set_fact:
cluster_previous_image: "{{ cluster_infra_terraform_output.outputs.cluster_image.value }}"
when: '"cluster_image" in cluster_infra_terraform_output.outputs'
when:
- terraform_state == "present"
- cluster_upgrade_system_packages is not defined or not cluster_upgrade_system_packages

- name: Template Terraform files into project directory
template:
src: "{{ item }}.j2"
Expand Down
2 changes: 1 addition & 1 deletion roles/cluster_infra/templates/outputs.tf.j2
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This is used to determine the image to use unless explicitly patching
output "cluster_image" {
description = "The id of the image used to build the cluster nodes"
value = "{{ cluster_previous_image | default(cluster_image) }}"
value = "{{ cluster_image }}"
}
2 changes: 1 addition & 1 deletion roles/cluster_infra/templates/resources.tf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ resource "openstack_blockstorage_volume_v3" "data_volume" {

resource "openstack_compute_instance_v2" "cluster_server" {
name = "{{ cluster_name }}-{{ cluster_type }}"
image_id = "{{ cluster_previous_image | default(cluster_image) }}"
image_id = "{{ cluster_image }}"
flavor_id = "{{ cluster_flavor }}"

network {
Expand Down

0 comments on commit 776651a

Please sign in to comment.