Newer
Older
# is created in internal-network module and called in root module
variable "ood_instance_name" {}
variable "flavor" {}
# is created in key-pair module and called in root module
# is created in floating-ip module and called in root module
variable "host_prefix" {}
variable "ood_user" {}
variable "ssh_private_key" {}
terraform {
required_version = ">= 0.14.0"
required_providers {
openstack = {
source = "terraform-provider-openstack/openstack"
version = "~> 1.42.0"
}
}
}
provider "openstack" {
use_octavia = true
endpoint_overrides = {
"network" = "https://neutron-api.cloud.rc.uab.edu:9696/v2.0/"
}
}
user_data = <<-EOF
#cloud-config
runcmd:
- [ bash, -xc, 'ethernet=$(cat /sys/class/net/eth1/address); nodename=$(hostname -s); sed -e "s/MY_HWADDR/$ethernet/" -e "s/MY_NODENAME/$nodename/" -i /warewulf/config;' ]
- [ bash, -xc, "until WWGETFILES_INTERVAL=0 bash -x /warewulf/bin/wwgetfiles; do echo waiting ; rm -f /tmp/.wwgetfile.lock ; sleep 10; done;" ]
- [ bash, -xc, "cd /CRI_XCBC; ansible-playbook -c local -i /CRI_XCBC/hosts -l `hostname -s` /CRI_XCBC/ood-ops.yaml -b -v" ]
instance_id = openstack_compute_instance_v2.ood.id
}
output "id" {
value = openstack_compute_instance_v2.ood.id
}
value = format(var.host_prefix,element(split(".", var.floating_ip_ood),3,),)
}
output "network" {
value = openstack_compute_instance_v2.ood.network
}