Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Gael gaelcolas

🏠
Working from home
View GitHub Profile
@gaelcolas
gaelcolas / kitchen.yml
Created Jun 8, 2022
example kitchen yaml for testing GC packages
View kitchen.yml
---
# Check this doc: https://github.com/test-kitchen/kitchen-azurerm
# you may set the following environment variables:
# AZURE_CLIENT_ID="your-azure-client-id-here"
# AZURE_CLIENT_SECRET="your-client-secret-here"
# AZURE_TENANT_ID="your-azure-tenant-id-here"
# (check doc https://github.com/test-kitchen/kitchen-azurerm for more details)
driver:
name: azurerm
@gaelcolas
gaelcolas / Invoke-SamplerGit.ps1
Last active May 30, 2022
Testing a task file for git public/private repo release structure
View Invoke-SamplerGit.ps1
<#
.SYNOPSIS
Executes git with the provided arguments.
.DESCRIPTION
This command executes git with the provided arguments and throws an error
if the call failed.
.PARAMETER Argument
View Get-DscSplattedResource.ps1
function Get-DscSplattedResource {
[CmdletBinding()]
Param(
[String]
$ResourceName,
[String]
$ExecutionName,
[hashtable]
@gaelcolas
gaelcolas / dummy jinja composite.ps1
Created Apr 22, 2021
basic jinja composite with explicit parameters
View dummy jinja composite.ps1
Configuration MyComposite {
Params (
$TemplateFilePath = 'MyJinja2Template.tpl',
$parameter1,
$parameter2
)
$tempParamFile = [io.Path]::GetTempFileName()
@gaelcolas
gaelcolas / DynamicParam.draft.ps1
Last active Aug 1, 2019
PowerShell Generating dynamic parameters and parameter sets to wrap around a Class for easy instantiation such as new-Type -ctorArg1 $val -property $val2
View DynamicParam.draft.ps1
#region Get-TypeDynamicParam
function Get-DynamicParamFromTypeName {
Param(
[string]
$TypeName
)
function New-ParamAttribute {
Param(
[Parameter(Mandatory=$true,ValueFromPipeLine=$false,ValueFromPipelineByPropertyName=$true, position=0)]
[string]
View MyDscConfig.ps1
Configuration MyDscConfig {
# Import the module that has the 'ServerType' configuration
Import-DscResource -ModuleName Platform
# Import the module that has the 'Application' Configuration
Import-DscResource -ModuleName Product
$ConfigurationData.AllNodes.Nodename {
$ConfigurationData.Roles.($Node.Role).configurations.Foreach{
$ConfigurationName = $_
$ConfigurationParameters = $ConfigurationData.Roles.($Node.Role).($ConfigurationName)
@gaelcolas
gaelcolas / Invoke-TestHandlerAction.ps1
Created Nov 7, 2018
Example of a Datum handler that can reference another datum based on its path (rough and dirty)
View Invoke-TestHandlerAction.ps1
function Invoke-TestHandlerAction {
Param(
$Password,
$test,
$Datum,
$Node,
@gaelcolas
gaelcolas / new_unattend_iso.ps1
Created Jul 9, 2016
create ISO with my Unattend.xml file
View new_unattend_iso.ps1
. '.\TestKitchen\script\IsoFile.ps1'
#create ISO with my Unattend.xml file
New-IsoFile -Source .\TestKitchen\Unattend.xml -Path .\TestKitchen\Unattendxml.iso -Force -Title MyISO
View ConfigData.ps1
$ConfigurationData = @{
AllNodes = @(
@{
Nodename = 'SRV01'
Role = 'ServerType1_Application'
},
@{
Nodename = 'SRV02'
Role = 'ServerType2_Application'
}
View Get-DscSplattedResource.ps1
function Global:Get-DscSplattedResource {
[CmdletBinding()]
Param(
[String]
$ResourceName,
[String]
$ExecutionName,
[hashtable]