Add lb nodes.
This commit is contained in:
parent
aec4e02a57
commit
13a4c21cce
19
lb-user.tpl
Normal file
19
lb-user.tpl
Normal file
|
@ -0,0 +1,19 @@
|
|||
#cloud-config
|
||||
|
||||
packages:
|
||||
- chrony
|
||||
- git
|
||||
- lvm2
|
||||
- xfsprogs
|
||||
write_files:
|
||||
- path: /etc/chrony/chrony.conf
|
||||
permissions: "0644"
|
||||
content: |
|
||||
%{ for line in split("\n",file("chrony.conf")) ~}
|
||||
${line}
|
||||
%{ endfor ~}
|
||||
owner: root:root
|
||||
|
||||
runcmd:
|
||||
- [ systemctl, enable, chronyd ]
|
||||
- systemctl restart chronyd
|
31
lb.tf
31
lb.tf
|
@ -24,5 +24,36 @@ resource "openstack_networking_port_v2" "lbvip" {
|
|||
admin_state_up = "false"
|
||||
}
|
||||
|
||||
resource "openstack_blockstorage_volume_v3" "lbvolumeboot" {
|
||||
count = var.lbsize # size of cluster
|
||||
name = "lb${count.index + 1}-matrix-test-sunet-se-vol"
|
||||
description = "OS volume for lb node ${count.index + 1}"
|
||||
size = 50
|
||||
image_id = data.openstack_images_image_v2.debian12image.id
|
||||
enable_online_resize = true # Allow us to resize volume while attached.
|
||||
}
|
||||
|
||||
# Create instances of lb nodes
|
||||
resource "openstack_compute_instance_v2" "lb" {
|
||||
name = "lb${count.index + 1}.matrix.test.sunet.se"
|
||||
count = var.lbsize
|
||||
flavor_id = data.openstack_compute_flavor_v2.b2c4r16.id
|
||||
key_pair = data.openstack_compute_keypair_v2.manderssonpub.id
|
||||
security_groups = [
|
||||
data.openstack_networking_secgroup_v2.sshfromjumphosts.name,
|
||||
data.openstack_networking_secgroup_v2.allegress.name,
|
||||
resource.openstack_networking_secgroup_v2.lbnode.name
|
||||
]
|
||||
user_data = templatefile("lb-user.tpl",{})
|
||||
|
||||
network {
|
||||
port = resource.openstack_networking_port_v2.lbport[count.index].id
|
||||
}
|
||||
|
||||
block_device {
|
||||
uuid = resource.openstack_blockstorage_volume_v3.lbvolumeboot[count.index].id
|
||||
source_type = "volume"
|
||||
destination_type = "volume"
|
||||
boot_index = 0
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue