Skip to content
Snippets Groups Projects
Commit d2a09faa authored by Krish Moodbidri's avatar Krish Moodbidri Committed by John-Paul Robinson
Browse files

added user_data commands

parent 899f30ea
No related branches found
No related tags found
No related merge requests found
......@@ -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
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment