RunOnce testing
This commit is contained in:
@@ -14,6 +14,17 @@ resource "random_id" "vm_suffix" {
|
|||||||
byte_length = 2
|
byte_length = 2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
resource "google_compute_disk" "data" {
|
||||||
|
provider = google-beta
|
||||||
|
name = "central-datadisk-${random_id.vm_suffix.hex}"
|
||||||
|
type = var.disk_type
|
||||||
|
zone = var.zone
|
||||||
|
# labels = {
|
||||||
|
# environment = "dev"
|
||||||
|
# }
|
||||||
|
size = 50
|
||||||
|
}
|
||||||
|
|
||||||
resource "google_compute_instance" "default" {
|
resource "google_compute_instance" "default" {
|
||||||
provider = google-beta
|
provider = google-beta
|
||||||
name = "central-${random_id.vm_suffix.hex}"
|
name = "central-${random_id.vm_suffix.hex}"
|
||||||
@@ -31,6 +42,14 @@ resource "google_compute_instance" "default" {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
attached_disk {
|
||||||
|
source = google_compute_disk.data.name
|
||||||
|
}
|
||||||
|
|
||||||
|
# lifecycle {
|
||||||
|
# ignore_changes = [attached_disk]
|
||||||
|
# }
|
||||||
|
|
||||||
network_interface {
|
network_interface {
|
||||||
network = "default"
|
network = "default"
|
||||||
|
|
||||||
@@ -40,23 +59,14 @@ resource "google_compute_instance" "default" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
metadata = {
|
metadata = {
|
||||||
windows-startup-script-url = "bar"
|
windows-startup-script-url = "gs://qliksense/scripts/bootstrap.ps1"
|
||||||
}
|
}
|
||||||
|
|
||||||
# metadata_startup_script = "echo hi > /test.txt"
|
# metadata_startup_script = "echo hi > /test.txt"
|
||||||
|
|
||||||
service_account {
|
service_account {
|
||||||
scopes = ["userinfo-email", "compute-ro", "storage-ro"]
|
email = "terraform@esoteric-parsec-243510.iam.gserviceaccount.com"
|
||||||
|
scopes = ["userinfo-email", "compute-rw", "storage-ro"]
|
||||||
}
|
}
|
||||||
|
|
||||||
provisioner "file" {
|
|
||||||
source = "../scripts/bootstrap.ps1"
|
|
||||||
destination = "C:/"
|
|
||||||
}
|
|
||||||
|
|
||||||
provisioner "remote-exec" {
|
|
||||||
inline = [
|
|
||||||
"powershell.exe -ExecutionPolicy Bypass -File C:/bootstrap.ps1"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,8 +5,8 @@
|
|||||||
"private_network": "projects/esoteric-parsec-243510/global/networks/default",
|
"private_network": "projects/esoteric-parsec-243510/global/networks/default",
|
||||||
"database_version": "POSTGRES_9_6",
|
"database_version": "POSTGRES_9_6",
|
||||||
"vm_type": "e2-highmem-4",
|
"vm_type": "e2-highmem-4",
|
||||||
"min_cpu": "AMD Rome",
|
"min_cpu": "Intel Skylake",
|
||||||
"image": "windows-server-2019-dc-v20200908",
|
"image": "family/windows-2019",
|
||||||
"disk_type": "pd-ssd",
|
"disk_type": "pd-ssd",
|
||||||
"availability_type": "REGIONAL",
|
"availability_type": "REGIONAL",
|
||||||
"user_name": "qlikadmin",
|
"user_name": "qlikadmin",
|
||||||
|
|||||||
@@ -51,14 +51,22 @@ if (-Not (Test-Path $deploy_path)) {
|
|||||||
# CLOUDCLI_UPDATE
|
# CLOUDCLI_UPDATE
|
||||||
# OBJCLI_COPY
|
# OBJCLI_COPY
|
||||||
|
|
||||||
gcloud components update -Force
|
# gcloud components update -Force
|
||||||
gsutil cp gs://qliksense/Qlik_Sense* $deploy_path\binaries\
|
gsutil cp gs://qliksense/Qlik_Sense* $deploy_path\binaries\
|
||||||
gsutil cp gs://qliksense/ps/ $deploy_path\
|
gsutil cp gs://qliksense/scripts/ $deploy_path\
|
||||||
|
gsutil cp gs://qliksense/modules/ps/* $Env:ProgramFiles\WindowsPowerShell\Modules\
|
||||||
|
|
||||||
# Push-Location $deploy_path\modules\ps
|
# Push-Location $deploy_path\modules\ps
|
||||||
Get-PackageProvider -Name NuGet -ForceBootstrap
|
Get-PackageProvider -Name NuGet -ForceBootstrap
|
||||||
# Below will also download and save the QlikResources requirements modules
|
# Below will also download and save the QlikResources requirements modules
|
||||||
Save-Module -Path $deploy_path/modules/ps/ -Name QlikResources -RequiredVersion 1.9.2
|
# Save-Module -Path $deploy_path/modules/ps/ -Name QlikResources -RequiredVersion 1.9.2
|
||||||
|
# Save-Module -Path $deploy_path/modules/ps/ -Name GoogleCloud
|
||||||
|
# HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce
|
||||||
|
# New-ItemProperty -Path 'HKLM:\Software\Microsoft\Windows\CurrentVersion\RunOnce' -Name 'Run' -Value '<insert_script_command_here>'
|
||||||
|
# $CurrentModPath = [Environment]::GetEnvironmentVariable("PSModulePath", "Machine")
|
||||||
|
# [Environment]::SetEnvironmentVariable("PSModulePath", $CurrentModPath + [System.IO.Path]::PathSeparator + "E:\deploy", "Machine")
|
||||||
|
E:\deploy\scripts\win-nfs_client-install.ps1
|
||||||
|
|
||||||
# Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
|
# Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
|
||||||
# choco install git --no-progress
|
# choco install git --no-progress
|
||||||
# Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
|
# Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
|
||||||
|
|||||||
Reference in New Issue
Block a user