Commit 7045a640 authored by Ryan Randles Jones's avatar Ryan Randles Jones
Browse files

Merge branch 'compute' into 'master'

Compute-node and cleanup with ohpc and ood build

See merge request rrand11/terraform-openstack!20
parents 0687c03b 2a6d5306
......@@ -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,20 @@ 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 = "c${count.index}"
image_name = var.image_compute
flavor_name = var.flavor
key_pair = openstack_compute_keypair_v2.keypair.name
security_groups = ["default"]
count = 2
# 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
......@@ -41,6 +41,10 @@ variable "image_ood" {
default = "CentOS-7-x86_64-GenericCloud-1905"
}
variable "image_compute" {
default = "CentOS-7-x86_64-GenericCloud-1905"
}
variable "keypair-name" {
default = "os-gen-keypair"
}
......
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