Skip to content

Commit 6bba649

Browse files
committed
discover volume path from volume descriptions; remove *_device_path TF vars
1 parent 44608ac commit 6bba649

File tree

5 files changed

+5
-32
lines changed

5 files changed

+5
-32
lines changed

environments/.stackhpc/terraform/ARCUS.tfvars

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,3 @@ cluster_subnet = "portal-internal"
33
vnic_type = "normal"
44
control_node_flavor = "vm.ska.cpu.general.quarter"
55
other_node_flavor = "vm.ska.cpu.general.small"
6-
state_volume_device_path = "/dev/sdb"
7-
home_volume_device_path = "/dev/sdc"

environments/.stackhpc/terraform/SMS.tfvars

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,3 @@ cluster_subnet = "stackhpc-ipv4-geneve-subnet"
33
vnic_type = "normal"
44
control_node_flavor = "general.v1.medium"
55
other_node_flavor = "general.v1.tiny"
6-
state_volume_device_path = "/dev/vdb"
7-
home_volume_device_path = "/dev/vdc"

environments/.stackhpc/terraform/main.tf

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,6 @@ variable "volume_backed_instances" {
3131
default = false
3232
}
3333

34-
variable "state_volume_device_path" {}
35-
36-
variable "home_volume_device_path" {}
37-
3834
module "cluster" {
3935
source = "../../skeleton/{{cookiecutter.environment}}/terraform/"
4036

@@ -76,6 +72,4 @@ module "cluster" {
7672
state_volume_size = 10
7773
home_volume_size = 20
7874

79-
state_volume_device_path = var.state_volume_device_path
80-
home_volume_device_path = var.home_volume_device_path
8175
}

environments/skeleton/{{cookiecutter.environment}}/terraform/nodes.tf

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -126,19 +126,14 @@ resource "openstack_compute_instance_v2" "control" {
126126
#cloud-config
127127
fqdn: ${var.cluster_name}-${each.key}.${var.cluster_name}.${var.cluster_domain_suffix}
128128
129-
fs_setup:
130-
- label: state
131-
filesystem: ext4
132-
device: ${var.state_volume_device_path}
133-
partition: auto
134-
- label: home
135-
filesystem: ext4
136-
device: ${var.home_volume_device_path}
137-
partition: auto
129+
bootcmd:
130+
%{for volume in [openstack_blockstorage_volume_v3.state, openstack_blockstorage_volume_v3.home]}
131+
- BLKDEV=$(readlink -f $(ls /dev/disk/by-id/*${substr(volume.id, 0, 20)}* | head -n1 )); blkid -o value -s TYPE $BLKDEV || mke2fs -t ext4 -L ${lower(split(" ", volume.description)[0])} $BLKDEV
132+
%{endfor}
138133
139134
mounts:
140135
- [LABEL=state, ${var.state_dir}]
141-
- [LABEL=home, /exports/home, auto, "x-systemd.required-by=nfs-server.service,x-systemd.before=nfs-server.service"]
136+
- [LABEL=home, /exports/home]
142137
EOF
143138

144139
}

environments/skeleton/{{cookiecutter.environment}}/terraform/variables.tf

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -55,18 +55,6 @@ variable "environment_root" {
5555
description = "Path to environment root, automatically set by activate script"
5656
}
5757

58-
variable "state_volume_device_path" {
59-
type = string
60-
description = "Path to block device for state"
61-
default = "/dev/sdb"
62-
}
63-
64-
variable "home_volume_device_path" {
65-
type = string
66-
description = "Path to block device name for home directories"
67-
default = "/dev/sdc"
68-
}
69-
7058
variable "state_dir" {
7159
type = string
7260
description = "Path to state directory on control node"

0 commit comments

Comments
 (0)