Commit dd7b7a29 authored by Krish Moodbidri's avatar Krish Moodbidri
Browse files

added user_data commands

parent de66a074
......@@ -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
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment