|
@@ -0,0 +1,19 @@
|
|
|
|
+import salt.client
|
|
|
|
+
|
|
|
|
+salt = salt.client.Caller()
|
|
|
|
+
|
|
|
|
+print(type(salt.cmd('network.ping', '1.1.1.1')))
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+print(salt.cmd('archive.tar', 'czf', '/tmp/etc.tar.gz', '/etc/'))
|
|
|
|
+
|
|
|
|
+print(salt.cmd('file.readdir', '/tmp/'))
|
|
|
|
+
|
|
|
|
+req = salt.cmd('http.query', 'https://checkip.amazonaws.com', method='GET')
|
|
|
|
+
|
|
|
|
+ip = req.get('body', '0.0.0.0').strip()
|
|
|
|
+
|
|
|
|
+print(ip)
|
|
|
|
+print(req)
|
|
|
|
+
|
|
|
|
+salt.cmd('event.send', 'salt/hello', {'msg':'Hello world'})
|