- Create a service account within the GCP project (terraform-svc).
- Create a new JSON key for the service account and save the file.
- Run the following command on the JSON file to format it correctly for TFC.
cat key.json | tr -s '\n' ' '
- Copy the output of step 3 into the GOOGLE_CREDENTIALS variable in the TFC workspace.
- Make sure to mark the variable as sensitive!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#---- Recycles all application pools on the given computer ----# | |
function RecyclePool { | |
[CmdletBinding()] | |
param ( | |
[string[]]$ComputerName, | |
[pscredential]$Credential | |
) | |
process { | |
foreach ($server in $ComputerName) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3' | |
services: | |
whoami: | |
image: stefanscherer/whoami | |
labels: | |
# Create a router called whoami listening on the websecure entrypoint | |
- "traefik.http.routers.whoami.entrypoints=websecure" | |
# Force TLS | |
- "traefik.http.routers.whoami.tls=true" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3' | |
services: | |
reverse-proxy: | |
# The official v2.0 Traefik docker image | |
image: traefik:v2.0 | |
command: | |
- --api.insecure=true | |
- --providers.docker | |
- --providers.file.directory=/etc/traefik/dynamic |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tls: | |
certificates: | |
- certFile: /etc/certs/examplecert.crt | |
keyFile: /etc/certs/examplecert.key |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#---- Create key on client ----# | |
ssh-keygen -b 2048 -t rsa | |
#---- Validate creation ----# | |
ls ~/.ssh | |
#---- SSH to Pi and create the SSH directory and file ----# | |
mkdir .ssh | |
cd .ssh | |
touch authorized_keys |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Invoke-Command -ComputerName $server -Credential $cred { | |
$npmem = Get-Counter -Counter "\Memory\Pool Nonpaged Bytes" -MaxSamples 1 -SampleInterval 1 | |
[PSCustomObject]@{ | |
Hostname = $env:COMPUTERNAME | |
"w3wp(MB)" = [math]::Round((Get-Process w3wp | Measure-Object WorkingSet -Sum).sum / 1MB,2) | |
"NonPaged(GB)" = [math]::Round($npmem.CounterSamples.cookedvalue / 1gb,2) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$vms = Get-VM "DQWBATMAN01SRV" | Get-View | |
foreach ($vm in $vms) { | |
if ($vm.Config.Tools.SyncTimeWithHost -eq $false) { | |
$vmConfig = New-Object VMware.Vim.VirtualMachineConfigSpec | |
$vmConfig.Tools = New-Object VMware.Vim.ToolsConfigInfo | |
$vmConfig.Tools.SyncTimeWithHost = $true | |
$vm.ReconfigVM($vmConfig) | |
} | |
[PSCustomObject]@{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$vms = Get-VM | |
foreach ($vm in $vms) { | |
if (($adapter = $vm | Get-NetworkAdapter).ConnectionState.StartConnected -ne "True") { | |
$adapter = $adapter | Set-NetworkAdapter -StartConnected:$true -Confirm:$false | |
} | |
[PSCustomObject]@{ | |
Name = $vm.Name | |
StartConnected = $adapter.ConnectionState.StartConnected | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#--- Create New Volume ---# | |
Get-Disk | Where partitionstyle -eq 'raw' | | |
Initialize-Disk -PartitionStyle MBR -PassThru | | |
New-Partition -AssignDriveLetter -UseMaximumSize | | |
Format-Volume -FileSystem NTFS -NewFileSystemLabel "disk2" -Confirm:$false | |
#--- Expand Disk ---# | |
$servers = "myserver1","myserver2" |
NewerOlder