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
--- | |
- hosts: Linux | |
gather_facts: true | |
tasks: | |
- name: Upgrade all yum packages | |
yum: | |
name: "*" | |
state: latest | |
become: yes |
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
--- | |
ansible_become_password: "{{ lookup('hashi_vault', 'secret=credentials/computers/production/{{ inventory_hostname }}:Password')}}" | |
ansible_become_method: su |
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
env: | |
VAULT_ADDR: '{{ vault_server }}' | |
VAULT_AUTH_METHOD: approle | |
VAULT_ROLE_ID: '{{ vault_role_id }}' | |
VAULT_SECRET_ID: '{{ vault_secret_id }}' |
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
fields: | |
- id: vault_server | |
type: string | |
label: URL for Vault Server | |
- id: vault_role_id | |
type: string | |
label: Vault AppRole ID | |
- id: vault_secret_id | |
type: string | |
label: Vault Secret ID |
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
recompose_pool: | |
stage: recompose | |
tags: | |
- windows | |
script: | |
- Write-Host "Connecting to Horizon" | |
- Connect-HVServer -Server $cs -User $csUser -Password $csPass -Domain $csDomain | |
- Write-Host "Refreshing Horizon Pool" | |
- Start-HVPool -Pool $poolName -Recompose -LogoffSetting FORCE_LOGOFF -ParentVM "$packer_vmName" -SnapshotVM "Created by Packer" -StopOnFirstError $true | |
- Write-Host "Disconnecting to Horizon" |
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
install_powercli: | |
stage: install | |
tags: | |
- windows | |
script: | |
- Write-Host "Installing NuGet" | |
- Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force | |
- Write-Host "Set the repo installation policy" | |
- Set-PSRepository PSGallery -InstallationPolicy Trusted | |
- Write-Host "Installing PowerCLI" |
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
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 |
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
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 |
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
get_packer: | |
stage: get | |
tags: | |
- windows | |
artifacts: | |
paths: | |
- packer.exe | |
script: | |
- Write-Host "Fetching packer" | |
- $packerFile = "packer_" + $packerVersion + "_windows_amd64.zip" |
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
stages: | |
- get | |
- retrieve | |
- build | |
- install | |
- recompose | |
before_script: | |
- git config --global http.sslVerify false |