Compare commits
7 Commits
dev2
...
qdcfromsna
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4ffde50de5 | ||
|
|
c7ba210353 | ||
|
|
94a86a7c90 | ||
|
|
774c830b54 | ||
|
|
49c9a074d7 | ||
|
|
90e6b51b07 | ||
|
|
bf49b1f77a |
@@ -129,12 +129,6 @@ resource "null_resource" "post-vm-fromsnapshot-linux" {
|
|||||||
destination = "~"
|
destination = "~"
|
||||||
}
|
}
|
||||||
|
|
||||||
provisioner "local-exec" {
|
|
||||||
|
|
||||||
command = "echo 'User/Pass: ${local.admin_username} / ${var.initial_password}'"
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
provisioner "remote-exec" {
|
provisioner "remote-exec" {
|
||||||
connection {
|
connection {
|
||||||
type = "ssh"
|
type = "ssh"
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ locals {
|
|||||||
admin_username = var.admin_username
|
admin_username = var.admin_username
|
||||||
admin_password = random_password.password.result
|
admin_password = random_password.password.result
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
module "qmi-nic" {
|
module "qmi-nic" {
|
||||||
source = "git::https://gitlab.com/qmi/qmi-cloud-tf-modules.git//qmi-nic"
|
source = "git::https://gitlab.com/qmi/qmi-cloud-tf-modules.git//qmi-nic"
|
||||||
|
|
||||||
@@ -40,9 +40,32 @@ module "qmi-nic" {
|
|||||||
user_id = var.user_id
|
user_id = var.user_id
|
||||||
|
|
||||||
isExternal = var.isExternal
|
isExternal = var.isExternal
|
||||||
|
}*/
|
||||||
|
|
||||||
|
module "vm-qdc-fromsnapshot" {
|
||||||
|
|
||||||
|
source = "git::https://gitlab.com/qmi/qmi-cloud-tf-modules.git//vm-fromsnapshot-linux"
|
||||||
|
|
||||||
|
subnet_id = var.subnet_id
|
||||||
|
location = var.location
|
||||||
|
resource_group_name = var.resource_group_name
|
||||||
|
snapshot_id = "/subscriptions/62ebff8f-c40b-41be-9239-252d6c0c8ad9/resourceGroups/QMI-Machines/providers/Microsoft.Compute/snapshots/QDC-Install-VM-Feb2022"
|
||||||
|
#snapshot_uri = "https://${local.source_container}.blob.core.windows.net/${var.image_reference}"
|
||||||
|
vm_type = var.vm_type
|
||||||
|
disk_size_gb = var.disk_size_gb
|
||||||
|
provId = var.provId
|
||||||
|
is_24x7 = var.is_24x7
|
||||||
|
startupTime = var.startupTime
|
||||||
|
shutdownTime = var.shutdownTime
|
||||||
|
prefix = var.prefix
|
||||||
|
|
||||||
|
admin_username = "qmi"
|
||||||
|
initial_password = "pcZr_UoJYg05D!Vz"
|
||||||
|
|
||||||
|
user_id = var.user_id
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "azurerm_linux_virtual_machine" "vm" {
|
/*resource "azurerm_linux_virtual_machine" "vm" {
|
||||||
name = local.virtual_machine_name
|
name = local.virtual_machine_name
|
||||||
resource_group_name = var.resource_group_name
|
resource_group_name = var.resource_group_name
|
||||||
location = var.location
|
location = var.location
|
||||||
@@ -72,13 +95,38 @@ resource "azurerm_linux_virtual_machine" "vm" {
|
|||||||
"ShutdownTime": var.is_24x7 == false? var.shutdownTime : null
|
"ShutdownTime": var.is_24x7 == false? var.shutdownTime : null
|
||||||
"StartupTime": var.is_24x7 == false? var.startupTime : null
|
"StartupTime": var.is_24x7 == false? var.startupTime : null
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
module "linux-common" {
|
||||||
|
|
||||||
|
source = "git::https://gitlab.com/qmi/qmi-cloud-tf-modules.git//linux-common"
|
||||||
|
|
||||||
|
depends_on = [
|
||||||
|
module.vm-qdc-fromsnapshot
|
||||||
|
]
|
||||||
|
|
||||||
|
os_type = "centos"
|
||||||
|
private_ip_address = module.vm-qdc-fromsnapshot.nic_private_ip_address
|
||||||
|
admin_username = module.vm-qdc-fromsnapshot.admin_username
|
||||||
|
admin_password = module.vm-qdc-fromsnapshot.admin_password
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
resource "null_resource" "post-qdc-fromsnapshot" {
|
||||||
|
|
||||||
|
depends_on = [
|
||||||
|
module.vm-qdc-fromsnapshot,
|
||||||
|
module.linux-common
|
||||||
|
]
|
||||||
|
|
||||||
provisioner "remote-exec" {
|
provisioner "remote-exec" {
|
||||||
connection {
|
connection {
|
||||||
type = "ssh"
|
type = "ssh"
|
||||||
host = module.qmi-nic.private_ip_address
|
host = module.vm-qdc-fromsnapshot.nic_private_ip_address
|
||||||
user = local.admin_username
|
user = module.vm-qdc-fromsnapshot.admin_username
|
||||||
password = local.admin_password
|
password = module.vm-qdc-fromsnapshot.admin_password
|
||||||
timeout = "3m"
|
timeout = "3m"
|
||||||
#private_key = "${file("~/.ssh/id_rsa")}"
|
#private_key = "${file("~/.ssh/id_rsa")}"
|
||||||
}
|
}
|
||||||
@@ -91,9 +139,9 @@ resource "azurerm_linux_virtual_machine" "vm" {
|
|||||||
provisioner "file" {
|
provisioner "file" {
|
||||||
connection {
|
connection {
|
||||||
type = "ssh"
|
type = "ssh"
|
||||||
host = module.qmi-nic.private_ip_address
|
host = module.vm-qdc-fromsnapshot.nic_private_ip_address
|
||||||
user = local.admin_username
|
user = module.vm-qdc-fromsnapshot.admin_username
|
||||||
password = local.admin_password
|
password = module.vm-qdc-fromsnapshot.admin_password
|
||||||
timeout = "10m"
|
timeout = "10m"
|
||||||
#private_key = "${file("~/.ssh/id_rsa")}"
|
#private_key = "${file("~/.ssh/id_rsa")}"
|
||||||
}
|
}
|
||||||
@@ -104,34 +152,22 @@ resource "azurerm_linux_virtual_machine" "vm" {
|
|||||||
provisioner "remote-exec" {
|
provisioner "remote-exec" {
|
||||||
connection {
|
connection {
|
||||||
type = "ssh"
|
type = "ssh"
|
||||||
host = module.qmi-nic.private_ip_address
|
host = module.vm-qdc-fromsnapshot.nic_private_ip_address
|
||||||
user = local.admin_username
|
user = module.vm-qdc-fromsnapshot.admin_username
|
||||||
password = local.admin_password
|
password = module.vm-qdc-fromsnapshot.admin_password
|
||||||
timeout = "3m"
|
timeout = "3m"
|
||||||
#private_key = "${file("~/.ssh/id_rsa")}"
|
#private_key = "${file("~/.ssh/id_rsa")}"
|
||||||
}
|
}
|
||||||
|
|
||||||
inline = [
|
inline = [
|
||||||
"echo ${local.admin_password} | sudo -S chmod a+x /home/${local.admin_username}/scripts/feb2021/*.sh",
|
"echo ${module.vm-qdc-fromsnapshot.admin_password} | sudo -S chmod a+x /home/${module.vm-qdc-fromsnapshot.admin_username}/scripts/feb2021/*.sh",
|
||||||
"sudo /home/${local.admin_username}/scripts/feb2021/qdc-nextgen-xml.sh '${module.qmi-nic.private_ip_address}' ${var.image_reference}",
|
"echo ${module.vm-qdc-fromsnapshot.admin_password} | sudo -S chmod a+x /home/${module.vm-qdc-fromsnapshot.admin_username}/scripts/feb2022/*.sh",
|
||||||
"sudo /home/${local.admin_username}/scripts/feb2021/core_env_setup.sh",
|
"sudo /home/${module.vm-qdc-fromsnapshot.admin_username}/scripts/feb2022/qdc-prereqs.sh /home/${module.vm-qdc-fromsnapshot.admin_username}/scripts/feb2022/qdc-scenario-config.sh",
|
||||||
"sudo /home/${local.admin_username}/scripts/feb2021/set-license.sh '${data.azurerm_key_vault_secret.license-sept20.value}'"
|
"sudo /home/${module.vm-qdc-fromsnapshot.admin_username}/scripts/feb2021/qdc-nextgen-xml.sh '${module.vm-qdc-fromsnapshot.nic_private_ip_address}' ${var.image_reference}",
|
||||||
|
"sudo /home/${module.vm-qdc-fromsnapshot.admin_username}/scripts/feb2021/core_env_setup.sh",
|
||||||
|
"sudo /home/${module.vm-qdc-fromsnapshot.admin_username}/scripts/feb2021/set-license.sh '${data.azurerm_key_vault_secret.license-sept20.value}'"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module "linux-common" {
|
|
||||||
|
|
||||||
source = "git::https://gitlab.com/qmi/qmi-cloud-tf-modules.git//linux-common"
|
|
||||||
|
|
||||||
depends_on = [
|
|
||||||
azurerm_linux_virtual_machine.vm
|
|
||||||
]
|
|
||||||
|
|
||||||
os_type = "centos"
|
|
||||||
private_ip_address = module.qmi-nic.private_ip_address
|
|
||||||
admin_username = local.admin_username
|
|
||||||
admin_password = local.admin_password
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,29 +1,29 @@
|
|||||||
output "virtual_machine_id" {
|
output "virtual_machine_id" {
|
||||||
value = azurerm_linux_virtual_machine.vm.id
|
value = module.vm-qdc-fromsnapshot.virtual_machine_id
|
||||||
}
|
}
|
||||||
|
|
||||||
output "virtual_machine_name" {
|
output "virtual_machine_name" {
|
||||||
value = "${var.prefix}-${random_id.randomMachineId.hex}"
|
value = module.vm-qdc-fromsnapshot.virtual_machine_name
|
||||||
}
|
}
|
||||||
|
|
||||||
output "admin_username" {
|
output "admin_username" {
|
||||||
value = var.admin_username
|
value = module.vm-qdc-fromsnapshot.admin_username
|
||||||
}
|
}
|
||||||
|
|
||||||
output "admin_password" {
|
output "admin_password" {
|
||||||
value = random_password.password.result
|
value = module.vm-qdc-fromsnapshot.admin_password
|
||||||
}
|
}
|
||||||
|
|
||||||
output "nic_id" {
|
output "nic_id" {
|
||||||
value = module.qmi-nic.id
|
value = module.vm-qdc-fromsnapshot.nic_id
|
||||||
}
|
}
|
||||||
|
|
||||||
output "nic_private_ip_address" {
|
output "nic_private_ip_address" {
|
||||||
value = module.qmi-nic.private_ip_address
|
value = module.vm-qdc-fromsnapshot.nic_private_ip_address
|
||||||
}
|
}
|
||||||
|
|
||||||
output "nic_ip_configuration_name" {
|
output "nic_ip_configuration_name" {
|
||||||
value = module.qmi-nic.ip_configuration_name
|
value = module.vm-qdc-fromsnapshot.nic_ip_configuration_name
|
||||||
}
|
}
|
||||||
|
|
||||||
output "mysql_root_password" {
|
output "mysql_root_password" {
|
||||||
@@ -38,12 +38,12 @@ output "mysql_demo_password" {
|
|||||||
value = "Qlik1234!"
|
value = "Qlik1234!"
|
||||||
}
|
}
|
||||||
|
|
||||||
output "nic_fqdn" {
|
/*output "nic_fqdn" {
|
||||||
value = var.isExternal? module.qmi-nic.fqdn : null
|
value = var.isExternal? module.qmi-nic.fqdn : null
|
||||||
}
|
}
|
||||||
|
|
||||||
output "nic_public_ip_address" {
|
output "nic_public_ip_address" {
|
||||||
value = var.isExternal? module.qmi-nic.public_ip_address : null
|
value = var.isExternal? module.qmi-nic.public_ip_address : null
|
||||||
}
|
}*/
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user