From 42ccb3da487b7ceacaf073e46f29fb2d96815582 Mon Sep 17 00:00:00 2001 From: Mira Kuntz Date: Wed, 11 Dec 2024 15:53:50 +0100 Subject: [PATCH 1/2] add bronze worker to cloud until we get IP addresses for KVM --- instance_core_jenkins-worker-bronze.tf | 97 +++++++++++++------------- 1 file changed, 48 insertions(+), 49 deletions(-) diff --git a/instance_core_jenkins-worker-bronze.tf b/instance_core_jenkins-worker-bronze.tf index 04eaf316..6a47e54d 100644 --- a/instance_core_jenkins-worker-bronze.tf +++ b/instance_core_jenkins-worker-bronze.tf @@ -1,56 +1,55 @@ -# 26.04.2024: Disabled as not needed anymore -# variable "workers-bronze" { -# default = 1 -# } +variable "workers-bronze" { + default = 1 +} -# variable "workers-bronze-volume-size" { -# default = 200 -# } +variable "workers-bronze-volume-size" { + default = 200 +} -# resource "openstack_compute_instance_v2" "jenkins-workers-bronze" { -# name = "worker-${count.index}.bronze.build.galaxyproject.eu" -# image_name = var.jenkins_image -# flavor_name = "m1.xlarge" -# key_pair = "jenkins2" -# security_groups = ["default"] -# count = var.workers-bronze +resource "openstack_compute_instance_v2" "jenkins-workers-bronze" { + name = "worker-${count.index}.bronze.build.galaxyproject.eu" + image_name = var.jenkins_image + flavor_name = "m1.xlarge" + key_pair = "jenkins2" + security_groups = ["default"] + count = var.workers-bronze -# network { -# name = "bioinf" -# } + network { + name = "bioinf" + } -# user_data = <<-EOF -# #cloud-config -# bootcmd: -# - test -z "$(blkid /dev/vdb)" && mkfs -t ext4 -L jenkins /dev/vdb -# - mkdir -p /scratch -# mounts: -# - ["/dev/vdb", "/scratch", auto, "defaults,nofail", "0", "2"] -# runcmd: -# - [ chown, "centos.centos", -R, /scratch ] -# EOF -# } + user_data = <<-EOF + #cloud-config + bootcmd: + - test -z "$(blkid /dev/vdb)" && mkfs -t ext4 -L jenkins /dev/vdb + - mkdir -p /scratch + mounts: + - ["/dev/vdb", "/scratch", auto, "defaults,nofail", "0", "2"] + runcmd: + - [ chown, "centos.centos", -R, /scratch ] + EOF +} -# resource "openstack_blockstorage_volume_v2" "jenkins-workers-bronze-volume" { -# name = "jenkins-workers-bronze-volume" -# description = "Data volume for Jenkins worker-${count.index}.bronze.build.galaxyproject.eu" -# volume_type = "default" -# size = var.workers-bronze-volume-size -# count = var.workers-bronze -# } +resource "openstack_blockstorage_volume_v2" "jenkins-workers-bronze-volume" { + name = "jenkins-workers-bronze-volume" + description = "Data volume for Jenkins worker-${count.index}.bronze.build.galaxyproject.eu" + volume_type = "default" + size = var.workers-bronze-volume-size + count = var.workers-bronze +} -# resource "openstack_compute_volume_attach_v2" "jenkins-workers-bronze-va" { -# instance_id = element(openstack_compute_instance_v2.jenkins-workers-bronze.*.id, count.index) -# volume_id = element(openstack_blockstorage_volume_v2.jenkins-workers-bronze-volume.*.id, count.index) -# count = var.workers-bronze -# } +resource "openstack_compute_volume_attach_v2" "jenkins-workers-bronze-va" { + instance_id = element(openstack_compute_instance_v2.jenkins-workers-bronze.*.id, count.index) + volume_id = element(openstack_blockstorage_volume_v2.jenkins-workers-bronze-volume.*.id, count.index) + count = var.workers-bronze +} -# resource "aws_route53_record" "jenkins-workers-bronze" { -# allow_overwrite = true -# zone_id = var.zone_galaxyproject_eu -# name = "worker-${count.index}.bronze.build.galaxyproject.eu" -# type = "A" -# ttl = "7200" -# records = ["${element(openstack_compute_instance_v2.jenkins-workers-bronze.*.access_ip_v4, count.index)}"] -# count = var.workers-bronze -# } +resource "aws_route53_record" "jenkins-workers-bronze" { + allow_overwrite = true + zone_id = var.zone_galaxyproject_eu + name = "worker-${count.index}.bronze.build.galaxyproject.eu" + type = "A" + ttl = "7200" + records = ["${element(openstack_compute_instance_v2.jenkins-workers-bronze.*.access_ip_v4, count.index)}"] + count = var.workers-bronze +} From f51921972def420cd7bbdc029518d2698ad6ff27 Mon Sep 17 00:00:00 2001 From: Mira Kuntz Date: Wed, 11 Dec 2024 17:41:55 +0100 Subject: [PATCH 2/2] add comment --- instance_core_jenkins-worker-bronze.tf | 1 + 1 file changed, 1 insertion(+) diff --git a/instance_core_jenkins-worker-bronze.tf b/instance_core_jenkins-worker-bronze.tf index 6a47e54d..13e3461b 100644 --- a/instance_core_jenkins-worker-bronze.tf +++ b/instance_core_jenkins-worker-bronze.tf @@ -1,3 +1,4 @@ +# keep until we migrate this to KVM variable "workers-bronze" { default = 1 }