Skip to content

Instantly share code, notes, and snippets.

View jpboyce's full-sized avatar

Jesse Boyce jpboyce

View GitHub Profile
@jpboyce
jpboyce / pve-windows2022-base.pkr.hcl
Created August 5, 2024 10:12
Proxmox Windows 2022 Packer File
# Variable definitions
variable "proxmox_url" {
type = string # The URL of the Proxmox server in the format of https://<IP>:<PORT>/api2/json
}
variable "proxmox_username" {
type = string # The username to authenticate with the Proxmox server
}
variable "proxmox_password" {
type = string # The password to authenticate with the Proxmox server
}
configuration:
# Enable automatic expansion of bicep source files.
AZURE_BICEP_FILE_EXPANSION: true
# Enable automatic expansion of param files
AZURE_PARAMETER_FILE_EXPANSION: true
- task: ps-rule-assert@1
displayName: 'PSRules Test'
inputs:
inputType: inputPath
inputPath: 'main.bicep'
modules: 'PSRule.Rules.Azure'
outputFormat: NUnit3
outputPath: reports/ps-rule-results.xml
- task: AzureCLI@2
displayName: 'Linter Test'
inputs:
azureSubscription: $(azureServiceConnection)
scriptType: pscore
scriptLocation: inlineScript
inlineScript: |
az bicep build -f main.bicep
@jpboyce
jpboyce / Clear-ImpervaCache-Snippet.ps1
Created June 11, 2022 02:27
Clear-ImpervaCache-Snippet.ps1
# Define post parameters
$postParams=@{api_id=$apiId; api_key=$apiKey; site_id=$siteId}
Invoke-WebRequest -Uri https://my.imperva.com/api/prov/v1/sites/cache/purge -Method POST -Body $postParams
@jpboyce
jpboyce / Get-ImpervaSiteByName-Snippet.ps1
Created June 11, 2022 02:21
Get-ImpervaSiteByName-Snippet.ps1
# Define post parameters
$postParams=@{api_id=$apiId; api_key=$apiKey}
Invoke-WebRequest -Uri https://my.imperva.com/api/prov/v1/sites/list -Method POST -Body $postParams -UseBasicParsing
# Creating idrac module folder
New-Item -Path "C:\scripts" -Name "idrac" -ItemType "directory"
# Copy idrac files to folder
Copy-Item -Path "C:\scripts\idrac.*" -Destination "c:\scripts\idrac"
# Register the Repository
Register-PSRepository -Name psqol -SourceLocation "\\svr14\psrepo\" -PublishLocation "\\svr14\psrepo\" -InstallationPolicy Trusted
# Publish Module to Repo
variables:
- group: 'PowerShellCodeSigning'
- name: majorVer
value: 1
- name: minorVer
value: 0
stages:
- stage: Sign_Code
displayName: 'Sign Code'
name: 'Sign PowerShell Code'
trigger:
- main
variables:
- group: 'PowerShellCodeSigning'
pool:
vmImage: 'windows-latest'
name: 'Check PowerShell Code'
trigger:
none
jobs:
- job: 'CheckCode'
displayName: 'Check Code'
pool:
vmImage: 'ubuntu-latest'