diff --git a/ood-instance/main.tf b/ood-instance/main.tf index 7d0d599f65da8f93a8833a0e92bf5ef929c48585..6c039206d4b2f36d639ef4f1392417881bb819f3 100644 --- a/ood-instance/main.tf +++ b/ood-instance/main.tf @@ -28,6 +28,14 @@ resource "openstack_compute_instance_v2" "ood" { flavor_name = var.flavor key_pair = var.key_pair security_groups = ["default"] + user_data = <<-EOF + #cloud-config + runcmd: + - [ bash, -xc, 'ethernet=$(cat /sys/class/net/eth0/address); nodename=$(hostname -s); sed -e "s/MY_HWADDR/$ethernet/" -e "s/MY_NODENAME/$nodename/" -i /warewulf/config;' ] + - [ bash, -xc, "echo $(date) ': hello world!'; until WWGETFILES_INTERVAL=0 bash -x /warewulf/bin/wwgetfiles; do echo waiting ; rm -f /tmp/.wwgetfile.lock ; sleep 10; done;" ] + - [ bash, -xc, "systemctl restart munge" ] + EOF + # defines the networks of the instance network { @@ -53,7 +61,12 @@ resource "openstack_compute_floatingip_associate_v2" "ood" { } - +output "id" { + value = openstack_compute_instance_v2.ood.id +} output "ssh_host"{ value = format(var.host_prefix,element(split(".", var.floating_ip_ood),3,),) -} \ No newline at end of file +} +output "network" { + value = openstack_compute_instance_v2.ood.network +}