Commit e039eca2 authored by Ishan Patel's avatar Ishan Patel
Browse files

added-compute-node

parent 0687c03b
......@@ -90,30 +90,6 @@ resource "openstack_compute_floatingip_associate_v2" "ohpc" {
user = var.ohpc-user
private_key = file(var.ssh-private-key)
}
# installs programs
provisioner "remote-exec" {
inline = [
"sudo mkdir -p /CRI_XCBC && sudo chown centos: /CRI_XCBC",
"sudo yum install -y epel-release",
"sudo yum install -y ansible git vim bash-completion",
"sudo yum install -y NetworkManager",
"sudo systemctl restart NetworkManager",
"sudo nmcli con mod 'Wired connection 1' connection.id 'eth1'"
]
}
# moves CRI_XCBC file into directory made above
provisioner "file" {
source = "CRI_XCBC/"
destination = "/CRI_XCBC/"
}
# runs ansible playbook
provisioner "remote-exec" {
inline = [
"sudo ansible-playbook -c local -i /CRI_XCBC/hosts -l `hostname -s` /CRI_XCBC/site.yaml -b"
]
}
}
# creates details for the OOD instance using variables defined in vars.tf
......@@ -151,29 +127,19 @@ resource "openstack_compute_floatingip_associate_v2" "ood" {
user = var.ood-user
private_key = file(var.ssh-private-key)
}
# installs programs
provisioner "remote-exec" {
inline = [
"sudo mkdir -p /CRI_XCBC && sudo chown centos: /CRI_XCBC",
"sudo yum install -y epel-release",
"sudo yum install -y ansible git vim bash-completion",
"sudo yum install -y NetworkManager",
"sudo systemctl restart NetworkManager",
"sudo nmcli con mod 'Wired connection 1' connection.id 'eth1'"
]
}
}
# moves CRI_XCBC file into directory made above
provisioner "file" {
source = "CRI_XCBC/"
destination = "/CRI_XCBC/"
}
# creates compute node
resource "openstack_compute_instance_v2" "c0" {
depends_on = [openstack_networking_subnet_v2.internal_subnet]
name = "c0"
image_name = var.image_ood
flavor_name = var.flavor
key_pair = openstack_compute_keypair_v2.keypair.name
security_groups = ["default"]
# runs ansible playbook
provisioner "remote-exec" {
inline = [
"sudo ansible-playbook -c local -i /CRI_XCBC/hosts -l `hostname -s` /CRI_XCBC/site.yaml -b"
]
# defines the networks of the instance
network {
name = var.internal-net
}
}
}
\ No newline at end of file
Markdown is supported
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