When testing, it can be curl-k, but the real integration, but it is not possible.
You must not let the token fly.
Now it's time to go to this stage. Write a sample first:
ImportSaltImportSalt.authImportSalt.logImportsaltapiopts=salt.client.LocalClient (). Optsauth=Salt.auth.LoadAuth (opts) lowstate= {'username':'XXX','Password':'XXX','Eauth':'Pam'}token=Auth.mk_token (lowstate) API=Saltapi. Apiclient (opts) lowstate= {'Client':'Local', ' Fun':'Cmd.run', 'Arg':['ls','/',], 'TGT':'192.168.11.69', 'token': token['token']}res=Api.run (lowstate) for(K,V)inchRes.items ():PrintKv
Output:
[[Email protected]]# python salt-api.py
192.168.11.69 bin
Boot
Dev
etc
Home
Lib
Lib64
Media
Mnt
Opt
Proc
Root
Run
Sbin
Srv
Sys
Tmp
Usr
Var
~~~~~~~~~~~~~~
Others don't care too much, but the fun in lowstate is the salt function (Test.ping,disk.usage,cmd.run ...). These While Arg is a possible parameter, note that if the command is executed remotely, the parameter is provided in the form of a list.
Simple example of using SALT-API to enter integrated development