LocalCalllerexample.py 486 B

12345678910111213141516
  1. import salt.client
  2. salt = salt.client.LocalClient()
  3. print(salt.cmd('*', 'test.ping'))
  4. for minion, ips in salt.cmd('*', 'network.ipaddrs').items():
  5. print(minion, ips)
  6. for minion, res in salt.cmd('*', 'pkg.version', arg=('git')):
  7. if not res:
  8. salt.cmd('*', 'pkg.install', arg=['git'])
  9. for minion, res in salt.cmd('*', 'git.clone', arg=['/tmp/'], kwarg={'url':'https://n1chome.uk/nee2c/salttest.git', 'name':'stest'}, full_return=True).items():
  10. print(minion, res)