-
Notifications
You must be signed in to change notification settings - Fork 3
/
remote.tf
29 lines (27 loc) · 1.34 KB
/
remote.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
resource "null_resource" "FoggyKitchenWebserverHTTPD" {
count = var.NumberOfNodes
depends_on = [oci_core_instance.FoggyKitchenWebserver]
provisioner "remote-exec" {
connection {
type = "ssh"
user = "opc"
host = data.oci_core_vnic.FoggyKitchenWebserver_VNIC1[count.index].private_ip_address
private_key = tls_private_key.public_private_key_pair.private_key_pem
script_path = "/home/opc/myssh.sh"
agent = false
timeout = "10m"
bastion_host = "host.bastion.${var.region}.oci.oraclecloud.com"
bastion_port = "22"
bastion_user = oci_bastion_session.FoggyKitchenSSHViaBastionService[count.index].id
bastion_private_key = tls_private_key.public_private_key_pair.private_key_pem
}
inline = ["echo '== 1. Installing HTTPD package with yum'",
"sudo -u root yum -y -q install httpd",
"echo '== 2. Creating /var/www/html/index.html'",
"sudo -u root touch /var/www/html/index.html",
"sudo /bin/su -c \"echo 'Welcome to FoggyKitchen.com! This is WEBSERVER${count.index + 1}...' > /var/www/html/index.html\"",
"echo '== 3. Disabling firewall and starting HTTPD service'",
"sudo -u root service firewalld stop",
"sudo -u root service httpd start"]
}
}