diff --git a/nodes/main.tf b/nodes/main.tf index 2c0b00dafb4d500c23c38a927da6dfedb92f3281..cd92682b4ef8aaa53e638261531255a0c4e35d93 100644 --- a/nodes/main.tf +++ b/nodes/main.tf @@ -19,6 +19,14 @@ resource "openstack_compute_instance_v2" "compute" { key_pair = var.key_pair security_groups = ["default"] count = var.compute_node_count + 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" ] + - [ bash, -xc, "systemctl restart slurmd" ] + EOF # defines the networks of the instance network {