Updated Ansible scripts

Cleaner output, with focus on last lines of output by default
This commit is contained in:
lksz 2021-05-08 17:46:33 -04:00
parent 7cb9f09c8c
commit a64d3c83af
2 changed files with 7 additions and 3 deletions

View File

@ -38,7 +38,7 @@ Invoke-Expression $expr | ForEach-Object {
Machine = $res[0].Trim();
Status = @($res[1].Trim(), "$($res[2])".Trim())
RunTime = $sw.Elapsed
Output = "$($res[3])".Trim();
Output = "$($res[3])".Trim() -split '\\n';
})
if( $res.Status -match '^\w+!:' ) {
[Console]::ForegroundColor = [ConsoleColor]::Red

View File

@ -1,6 +1,10 @@
[CmdletBinding()]param(
[string[]]$Remotes = 'All',
[switch]$RawOutput
[switch]$RawOutput,
[switch]$PassThruOnly
)
Invoke-ViaAnsible -Command "Update-OSz -Mode Auto" -Remotes:$($Remotes.ToLower()) -RawOutput:$RawOutput
Invoke-ViaAnsible -Command "Update-OSz -Mode Auto" -Remotes:$($Remotes.ToLower()) -RawOutput:$RawOutput | ForEach-Object {
if( $PassThru ) { return $_ }
$_ | Select-Object Machine, RunTime, @{L='Output';E={$_.Output | Select-Object -last 4}}
}