Skip to content

Commit b902115

Browse files
authored
Remove the cluster_previous_image workaround (#355)
* Remove pulling the previous image * Simplify logic around cluster_previous_image
1 parent 402ca70 commit b902115

File tree

3 files changed

+7
-26
lines changed

3 files changed

+7
-26
lines changed

ansible/roles/cluster_infra/tasks/main.yml

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -38,25 +38,6 @@
3838
}
3939
dest: "{{ terraform_project_path }}/backend.tf"
4040

41-
# Patching in this appliance is implemented as a switch to a new base image
42-
# So unless explicitly patching, we want to use the same image as last time
43-
# To do this, we query the previous Terraform state before updating
44-
- block:
45-
- name: Get previous Terraform state
46-
stackhpc.terraform.terraform_output:
47-
binary_path: "{{ terraform_binary_path }}"
48-
project_path: "{{ terraform_project_path }}"
49-
backend_config: "{{ terraform_backend_config }}"
50-
register: cluster_infra_terraform_output
51-
52-
- name: Extract image from Terraform state
53-
set_fact:
54-
cluster_previous_image: "{{ cluster_infra_terraform_output.outputs.cluster_image.value }}"
55-
when: '"cluster_image" in cluster_infra_terraform_output.outputs'
56-
when:
57-
- terraform_state == "present"
58-
- cluster_upgrade_system_packages is not defined or not cluster_upgrade_system_packages
59-
6041
- name: Template Terraform files into project directory
6142
template:
6243
src: >-

ansible/roles/cluster_infra/templates/outputs.tf.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,5 @@ output "cluster_nodes" {
4949

5050
output "cluster_image" {
5151
description = "The id of the image used to build the cluster nodes"
52-
value = "{{ cluster_previous_image | default(cluster_image) }}"
52+
value = "{{ cluster_image }}"
5353
}

ansible/roles/cluster_infra/templates/resources.tf.j2

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ resource "openstack_compute_keypair_v2" "cluster_keypair" {
249249

250250
resource "openstack_compute_instance_v2" "login" {
251251
name = "{{ cluster_name }}-login-0"
252-
image_id = "{{ cluster_previous_image | default(cluster_image) }}"
252+
image_id = "{{ cluster_image }}"
253253
{% if login_flavor_name is defined %}
254254
flavor_name = "{{ login_flavor_name }}"
255255
{% else %}
@@ -262,7 +262,7 @@ resource "openstack_compute_instance_v2" "login" {
262262

263263
# root device:
264264
block_device {
265-
uuid = "{{ cluster_previous_image | default(cluster_image) }}"
265+
uuid = "{{ cluster_image }}"
266266
source_type = "image"
267267
{% if cluster_use_root_volumes is defined and cluster_use_root_volumes %}
268268
volume_size = {{ cluster_root_volume_size | default("20") }}
@@ -298,7 +298,7 @@ resource "openstack_compute_instance_v2" "login" {
298298

299299
resource "openstack_compute_instance_v2" "control" {
300300
name = "{{ cluster_name }}-control-0"
301-
image_id = "{{ cluster_previous_image | default(cluster_image) }}"
301+
image_id = "{{ cluster_image }}"
302302
{% if control_flavor_name is defined %}
303303
flavor_name = "{{ control_flavor_name }}"
304304
{% else %}
@@ -311,7 +311,7 @@ resource "openstack_compute_instance_v2" "control" {
311311

312312
# root device:
313313
block_device {
314-
uuid = "{{ cluster_previous_image | default(cluster_image) }}"
314+
uuid = "{{ cluster_image }}"
315315
source_type = "image"
316316
{% if cluster_use_root_volumes is defined and cluster_use_root_volumes %}
317317
volume_size = {{ cluster_root_volume_size | default("20") }}
@@ -373,7 +373,7 @@ resource "openstack_compute_instance_v2" "{{ partition.name }}" {
373373
count = {{ partition.count }}
374374

375375
name = "{{ cluster_name }}-compute-{{ partition.name }}-${count.index}"
376-
image_id = "{{ cluster_previous_image | default(cluster_image) }}"
376+
image_id = "{{ cluster_image }}"
377377
{% if 'flavor_name' in partition %}
378378
flavor_name = "{{ partition.flavor_name }}"
379379
{% else %}
@@ -386,7 +386,7 @@ resource "openstack_compute_instance_v2" "{{ partition.name }}" {
386386

387387
# root device:
388388
block_device {
389-
uuid = "{{ cluster_previous_image | default(cluster_image) }}"
389+
uuid = "{{ cluster_image }}"
390390
source_type = "image"
391391
{% if cluster_use_root_volumes is defined and cluster_use_root_volumes %}
392392
volume_size = {{ cluster_root_volume_size | default("20") }}

0 commit comments

Comments
 (0)