Last active
October 31, 2016 02:30
-
-
Save mcharo/606b3c7c4f9ae448443fc979aec2f0a0 to your computer and use it in GitHub Desktop.
Get salt minion keys via saltapi
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
| # Disable SSL validation | |
| [System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true} | |
| # Get saltapi credentials | |
| $SaltApiCredential = Get-Credential | |
| $user = $SaltApiCredential.UserName | |
| $pass = $SaltApiCredential.GetNetworkCredential().Password | |
| # Log in to saltapi | |
| Invoke-RestMethod -Uri https://salt:7443/login -Method Post -Body @{username=$user;password=$pass;eauth='pam'} -SessionVariable session | |
| # Get list of keys | |
| $Body = @{client='wheel';tgt='*';fun='key.list_all'} | |
| Invoke-RestMethod -Uri https://salt:7443 -Method Post -Body $Body -WebSession $session |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment