Skip to content
Snippets Groups Projects
Commit 617a4b83 authored by Ryan Randles Jones's avatar Ryan Randles Jones
Browse files

defined ssh connections before provisioners are run so they will all use that connection info

parent 0e29a081
No related branches found
No related tags found
1 merge request!18Variable update branch
......@@ -83,15 +83,16 @@ depends_on = ["openstack_networking_subnet_v2.dmzsubnet"]
resource "openstack_compute_floatingip_associate_v2" "ohpc" {
floating_ip = "${openstack_networking_floatingip_v2.ip_pool.address}"
instance_id = "${openstack_compute_instance_v2.ohpc.id}"
#defines ssh connection to ohpc and runs installs
provisioner "remote-exec" {
# defines ssh connection
connection {
host = "${format("164.111.161.%s", element(split(".", openstack_networking_floatingip_v2.ip_pool.address),3))}"
user = "centos"
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",
......@@ -102,24 +103,14 @@ resource "openstack_compute_floatingip_associate_v2" "ohpc" {
]
}
# moves CRI_XCBC file into repo to use in next step
# moves CRI_XCBC file into directory made above
provisioner "file" {
source = "CRI_XCBC/"
destination = "/CRI_XCBC/"
connection {
host = "${format("164.111.161.%s", element(split(".", openstack_networking_floatingip_v2.ip_pool.address),3))}"
user = "centos"
private_key = "${file(var.ssh_private_key)}"
}
}
# uses ssh connection to run ansible playbook
# runs ansible playbook
provisioner "remote-exec" {
connection {
host = "${format("164.111.161.%s", element(split(".", openstack_networking_floatingip_v2.ip_pool.address),3))}"
user = "centos"
private_key = "${file(var.ssh_private_key)}"
}
inline = [
"sudo ansible-playbook -c local -i /CRI_XCBC/hosts -l `hostname -s` /CRI_XCBC/site.yaml -b"
]
......
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