I have a PowerCLI script that pulls all vCenter TAGs associated with a VM and I want to add those TAGs as a grain to the VM in SaltStack Config. I have a job in SaltStack Config that does this but I want to execute from a remote PowerShell script.
Has anyone in this group used Invoke-RestMethod with a SaltStack Config Server. I am trying to find the correct syntax and google has been unsuccessful and there isn't anything in https://docs.saltproject.io/.
I am also open to a different way to do this process if anyone has any suggestions. I do have some code to edit the grains file on each VM direct but I would like to use a SaltStack Config Job.
The fact you don't find a lot should tell you that using the REST API is largely unexplored and undocumented territory 😁
There is the very sparse documentation in Using the Salt REST API, but that only gives some minimal curl examples.
Translating curl to an Invoke-RestMethod call isn't that difficult, but I'm afraid that is the least of your worries.
In any case, good luck.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I am going to look at sending an custom event to the salt master. Since Salt is event driven I could then have a reactor that runs the job with the information in the event. I think this might work for my use case. That for the reply LucD.