@@ -69,6 +69,22 @@ resource "openstack_networking_secgroup_rule_v2" "secgroup_slurm_login_rule_ingr
6969 security_group_id = "${openstack_networking_secgroup_v2.secgroup_slurm_login.id}"
7070}
7171
72+ #####
73+ ##### Volumes
74+ #####
75+ resource "openstack_blockstorage_volume_v3" "state" {
76+ name = "{{ cluster_name }}-state"
77+ description = "State for control node"
78+ size = "{{ state_volume_size }}"
79+ }
80+
81+ resource "openstack_blockstorage_volume_v3" "home" {
82+ name = "{{ cluster_name }}-home"
83+ description = "Home for control node"
84+ size = "{{ home_volme_size }}"
85+ }
86+
87+
7288#####
7389##### Cluster nodes
7490#####
@@ -111,12 +127,50 @@ resource "openstack_compute_instance_v2" "control" {
111127 name = " {{ cluster_network }}"
112128 }
113129 security_groups = [ " ${openstack_networking_secgroup_v2.secgroup_slurm_cluster.name}" ]
114- # Use cloud-init to inject the SSH keys
130+
131+ # root device:
132+ block_device {
133+ uuid = " {{ cluster_image }}"
134+ source_type = " image"
135+ destination_type = " local"
136+ boot_index = 0
137+ delete_on_termination = true
138+ }
139+
140+ # state volume:
141+ block_device {
142+ destination_type = " volume"
143+ source_type = " volume"
144+ boot_index = -1
145+ uuid = openstack_blockstorage_volume_v3.state.id
146+ }
147+
148+ # home volume:
149+ block_device {
150+ destination_type = " volume"
151+ source_type = " volume"
152+ boot_index = -1
153+ uuid = openstack_blockstorage_volume_v3.home.id
154+ }
155+
156+ # Use cloud-init to a) inject SSH keys b) configure volumes
115157 user_data = <<-EOF
116158 #cloud-config
117159 ssh_authorized_keys:
118160 - {{ cluster_deploy_ssh_public_key }}
119161 - {{ cluster_user_ssh_public_key }}
162+ fs_setup:
163+ - label: state
164+ filesystem: ext4
165+ device: /dev /vdb
166+ partition: auto
167+ - label: home
168+ filesystem: ext4
169+ device: /dev /vdc
170+ partition: auto
171+ mounts:
172+ - [LABEL =state, /var /lib /state]
173+ - [LABEL =home, /exports /home, auto, " x-systemd.required-by=nfs-server.service,x-systemd.before=nfs-server.service" ]
120174 EOF
121175}
122176
0 commit comments