Skip to content

Commit 1f99e4a

Browse files
committed
make caas provisioning less confusing
1 parent 5e5b389 commit 1f99e4a

File tree

2 files changed

+19
-19
lines changed

2 files changed

+19
-19
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@ output "cluster_nodes" {
3232
}
3333
}
3434
],
35-
{% for partition in openhpc_partitions %}
35+
{% for nodegroup in openhpc_nodegroups %}
3636
[
37-
for compute in openstack_compute_instance_v2.{{ partition.name }}: {
37+
for compute in openstack_compute_instance_v2.{{ nodegroup.name }}: {
3838
name = compute.name
3939
ip = compute.network[0].fixed_ip_v4
40-
groups = ["compute", "{{ cluster_name }}_compute", "{{ cluster_name }}_{{ partition.name }}"],
40+
groups = ["compute", "{{ cluster_name }}_compute", "{{ cluster_name }}_{{ nodegroup.name }}"],
4141
facts = {
4242
openstack_project_id = data.openstack_identity_auth_scope_v3.scope.project_id
4343
}

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

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -282,11 +282,11 @@ resource "openstack_networking_port_v2" "control_storage" {
282282
###
283283
# Workers
284284
###
285-
{% for partition in openhpc_partitions %}
285+
{% for nodegroup in openhpc_nodegroup %}
286286
# Primary network
287-
resource "openstack_networking_port_v2" "{{ partition.name }}" {
288-
count = {{ partition.count }}
289-
name = "{{ cluster_name }}-compute-{{ partition.name }}-${count.index}"
287+
resource "openstack_networking_port_v2" "{{ nodegroup.name }}" {
288+
count = {{ nodegroup.count }}
289+
name = "{{ cluster_name }}-compute-{{ nodegroup.name }}-${count.index}"
290290
network_id = "${data.openstack_networking_network_v2.cluster_network.id}"
291291
admin_state_up = "true"
292292

@@ -305,9 +305,9 @@ resource "openstack_networking_port_v2" "{{ partition.name }}" {
305305

306306
# Storage network
307307
{% if cluster_storage_network is defined %}
308-
resource "openstack_networking_port_v2" "{{ partition.name }}_storage" {
309-
count = {{ partition.count }}
310-
name = "{{ cluster_name }}-compute-{{ partition.name }}-storage-${count.index}"
308+
resource "openstack_networking_port_v2" "{{ nodegroup.name }}_storage" {
309+
count = {{ nodegroup.count }}
310+
name = "{{ cluster_name }}-compute-{{ nodegroup.name }}-storage-${count.index}"
311311
network_id = data.openstack_networking_network_v2.cluster_storage.id
312312
admin_state_up = "true"
313313

@@ -499,25 +499,25 @@ resource "openstack_compute_instance_v2" "control" {
499499
}
500500
}
501501

502-
{% for partition in openhpc_partitions %}
503-
resource "openstack_compute_instance_v2" "{{ partition.name }}" {
504-
count = {{ partition.count }}
502+
{% for nodegroup in openhpc_nodegroup %}
503+
resource "openstack_compute_instance_v2" "{{ nodegroup.name }}" {
504+
count = {{ nodegroup.count }}
505505

506-
name = "{{ cluster_name }}-compute-{{ partition.name }}-${count.index}"
506+
name = "{{ cluster_name }}-compute-{{ nodegroup.name }}-${count.index}"
507507
image_id = "{{ cluster_image }}"
508-
{% if 'flavor_name' in partition %}
509-
flavor_name = "{{ partition.flavor_name }}"
508+
{% if 'flavor_name' in nodegroup %}
509+
flavor_name = "{{ nodegroup.flavor_name }}"
510510
{% else %}
511-
flavor_id = "{{ partition.flavor }}"
511+
flavor_id = "{{ nodegroup.flavor }}"
512512
{% endif %}
513513

514514
network {
515-
port = openstack_networking_port_v2.{{ partition.name }}[count.index].id
515+
port = openstack_networking_port_v2.{{ nodegroup.name }}[count.index].id
516516
}
517517

518518
{% if cluster_storage_network is defined %}
519519
network {
520-
port = openstack_networking_port_v2.{{ partition.name }}_storage[count.index].id
520+
port = openstack_networking_port_v2.{{ nodegroup.name }}_storage[count.index].id
521521
}
522522
{% endif %}
523523

0 commit comments

Comments
 (0)