Ansible support + sz-update alias

Este commit está contenido en:
lksz 2020-11-01 00:55:38 -04:00
padre 310103c2f7
commit b1980e5820
Se han modificado 4 ficheros con 26 adiciones y 0 borrados

1
Aliases/sz-update.ps1 Archivo normal
Ver fichero

@ -0,0 +1 @@
Update-OSz

19
Invoke-ViaAnsible.ps1 Archivo normal
Ver fichero

@ -0,0 +1,19 @@
[CmdletBinding()]param([string[]]$Command, [switch]$NotPowerShell, [string[]]$Remotes)
$script:ansible_cli=@('ansible')
if( (Test-Path './ansible.cfg') -or (Test-Path '/opt/ansible/hosts') -and (Test-Path '/opt/ansible/ssh_key_for_ansible') ) {
$ansible_cli += '-i', '/opt/ansible/hosts', '--private-key=/opt/ansible/ssh_key_for_ansible'
}
if( $Command ) {
$ansible_cli += '-a'
if( $NotPowerShell ) {
$ansible_cli += $(($Command -join '; ').Replace("'","\`$(printf '\x27')").Replace('"',"\`$(printf '\x22')"))
} else {
$ansible_cli += "pwsh -encodedcommand $(ConvertTo-Base64 $($Command -join '; '))"
}
}
$ansible_cli += $Remotes
$local:expr = $('& "'+$($ansible_cli -join '" "')+'"')
Write-Verbose $expr
Invoke-Expression $expr

3
Pull-ViaAnsible.ps1 Archivo normal
Ver fichero

@ -0,0 +1,3 @@
[CmdletBinding()]param([string[]]$Remotes = 'All')
Invoke-ViaAnsible -Command "git pull" -Remotes:$($Remotes.ToLower())

3
Update-ViaAnsible.ps1 Archivo normal
Ver fichero

@ -0,0 +1,3 @@
[CmdletBinding()]param([string[]]$Remotes = 'All')
Invoke-ViaAnsible -Command "Update-OSz -Mode Auto" -Remotes:$($Remotes.ToLower())