This file contains hidden or 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
#!/usr/bin/pwsh | |
#WANT_JSON | |
#sample module for using powershell core instead of python for module code | |
#biggest different is that the legacy windows powershell functions are not available | |
#example uses a 'main' function as the primary executing code, providing parameter validation and error handling in a powershell-y way | |
$ErrorActionPreference = "Stop" | |
$ProgressPreference = "SilentlyContinue" |
This file contains hidden or 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
- name: Influx DB | |
description: credential object for connecting to InfluxDB databases | |
inputs: | |
fields: | |
- id: influxdb_user | |
type: string | |
label: account username | |
- id: influxdb_pass | |
type: string | |
secret: true |
This file contains hidden or 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
--- | |
- name: pause nodes and install patches | |
hosts: all | |
any_errors_fatal: true | |
strategy: linear | |
serial: 1 | |
tasks: | |
- name: get {{inventory_hostname }} instance id | |
uri: | |
url: "https://{{tower_alias}}/api/v2/instances?hostname={{inventory_hostname}}" |
This file contains hidden or 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
jq --argfile a file1.json -n 'def post_recurse(f): def r: (f | select(. != null) | r), .; r; def post_recurse: post_recurse(.[]?); ($a | (post_recurse | arrays) |= sort)' > fmt_file1.json | |
jq --argfile a file2.json -n 'def post_recurse(f): def r: (f | select(. != null) | r), .; r; def post_recurse: post_recurse(.[]?); ($a | (post_recurse | arrays) |= sort)' > fmt_file2.json | |
diff -ZEB <(jq -S . fmt_file1.json) <(jq -S . fmt_file2.json)) |
This file contains hidden or 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
#!/usr/bin/env powershell | |
if ($args -contains '--list') { | |
$output = @{ | |
'all' = @('server1.domain.com', 'server2.domain.com') | |
'webservers' = @('server1.domain.com') | |
'_meta' = @{ | |
'hostvars' = @{ | |
'server1.domain.com' = @{ | |
myvar = 'metavariable' |
This file contains hidden or 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: localhost | |
connection: local | |
gather_facts: no | |
vars: | |
- ilo_username: Administrator | |
- ilo_password: somesecretvalue | |
- serial_number: 1A2B3C456 | |
- ilo_license: "12345-ABCDE-67890-FGHIJ-KLMNO" | |
tasks: |
This file contains hidden or 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
$DynamicBacklogListPage = New-UDPage -url "/backlog/:server/:folder" -EndPoint { | |
Param($server, $folder) | |
New-UDRow -endpoint { | |
$query = "Select [BacklogFiles] from [dbo].[dfsrlatestdata] Where Server = `'$server`' and ReplicatedFolder = `'$folder`'" | |
$BacklogFileList = @( | |
Foreach ($item in $(invoke-sqlcmd -MaxCharLength 25600 -connectionString $sqlconnectionstring -query $query | convertto-json | convertfrom-json).BacklogFiles.Split(',')) { | |
new-object psobject -Property @{ | |
Filename = $item | |
} | |
} |
This file contains hidden or 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
Function Get-ComputerInfo { | |
Param ( | |
[Parameter(Position=1, ValueFromPipelineByPropertyName=$True, ValueFromPipeline=$True)] | |
[alias('Computer','Host','Hostname','Server','ServerName')] | |
[String[]]$ComputerName = $env:computername, | |
[pscredential]$Credential = $Null | |
) | |
BEGIN{ | |
$ErrorActionPreference = 'Stop' |