Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:
Building clouds

Mark Brookfield virtualhobbit

:octocat:
Building clouds
View GitHub Profile
View build.yml
deploy_windows-10:
stage: build
tags:
- windows
script:
- Write-Host "Deploying Windows 10"
- Set-Location windows-10
- ../packer.exe build -force windows-10-pilot.json
View retrieve.yml
retrieve_vault_password:
stage: retrieve
tags:
- windows
artifacts:
paths:
- windows-10/setup/Autounattend.xml
script:
- Write-Host "Retrieving Administrator password from Vault"
- $result = Invoke-RestMethod -Headers @{"X-Vault-Token" = ${env:VAULT_TOKEN}} -Method Get -Body $json -Uri ${env:VAULT_ADDR}/v1/creds/users/misc/administrator
View get.yml
get_packer:
stage: get
tags:
- windows
artifacts:
paths:
- packer.exe
script:
- Write-Host "Fetching packer"
- $packerFile = "packer_" + $packerVersion + "_windows_amd64.zip"
View stages.yml
stages:
- get
- retrieve
- build
- install
- recompose
before_script:
- git config --global http.sslVerify false
View Autounattend.xml
<UserAccounts>
<AdministratorPassword>
<Value>{{password}}</Value>
<PlainText>true</PlainText>
</AdministratorPassword>
</UserAccounts>
<AutoLogon>
<Enabled>true</Enabled>
<Username>Administrator</Username>
View builder.json
"builders": [
{
"type": "vsphere-iso",
"vcenter_server": "{{user `vcenter`}}",
"username": "{{user `vcenterUser`}}",
"password": "{{user `vcenterPass`}}",
"insecure_connection": true,
"vm_name": "{{user `vmName`}}",
View variiables.json
{
"variables": {
"vcenter": "{{env `packer_vcenter`}}",
"vcenterUser": "{{env `packer_vcenterUser`}}",
"vcenterPass": "{{env `packer_vcenterPass`}}",
"vmName": "{{env `packer_vmName`}}",
"cluster": "{{env `packer_cluster`}}",
"datastore": "{{env `packer_datastore`}}",
"datastore_iso": "{{env `packer_datastoreISO`}}",
"network": "{{env `packer_network`}}",
View submitRequest.js
//Compute the full URL
var requestUrlString = "/2013-04-01/hostedzone/" + attHostedZone + "/rrset";
var request = attRestHost.createRequest("POST", requestUrlString, attBody);
//Set the authentication header
request.setHeader("Authorization", attAuthString);
request.setHeader("X-Amz-Content-Sha256", attHashedPayload);
request.setHeader("X-Amz-Date", attAmzDate);
//Execute the request and get the response
View task4.js
// Define the authentication header string
attAuthString = 'AWS4-HMAC-SHA256 Credential=' + attAccessKey + '/' + attAmzAuthDate + '/' + attRegion + '/' + attService + '/aws4_request, SignedHeaders=' + attSignedHeaders + ', Signature=' + attSignature;
System.log("Auth string is: " + attAuthString);
View task3.js
// Define the signing key in base64
var kSigningB64 = CryptoEncoding.hexToBase64(attSigningKey);
System.log("The signing key in base64 is: " + kSigningB64);
// Define the string to sign in base 64
var stringToSignB64 = CryptoEncoding.base64Encode(attStringToSign);
System.log("The string to sign in base64 is: " + stringToSignB64);
// Calculate the signature
var signature = CryptoDigest.hmacSha256(kSigningB64, stringToSignB64);
You can’t perform that action at this time.