| Server IP : 198.38.94.13 / Your IP : 216.73.217.33 Web Server : Apache System : Linux d4744.dxb1.stableserver.net 5.14.0-611.49.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Apr 21 16:39:08 EDT 2026 x86_64 User : revivere ( 1140) PHP Version : 8.2.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /opt/saltstack/salt/lib/python3.10/site-packages/salt/thorium/ |
Upload File : |
"""
Run remote execution commands via the local client
"""
import salt.client
def cmd(name, tgt, func, arg=(), tgt_type="glob", ret="", kwarg=None, **kwargs):
"""
Execute a remote execution command
USAGE:
.. code-block:: yaml
run_remote_ex:
local.cmd:
- tgt: '*'
- func: test.ping
run_remote_ex:
local.cmd:
- tgt: '*'
- func: test.sleep
- arg:
- 30
run_remote_ex:
local.cmd:
- tgt: '*'
- func: test.sleep
- kwarg:
length: 30
"""
ret = {"name": name, "changes": {}, "comment": "", "result": True}
with salt.client.get_local_client(mopts=__opts__) as client:
jid = client.cmd_async(
tgt, func, arg, tgt_type=tgt_type, ret=ret, kwarg=kwarg, **kwargs
)
ret["changes"]["jid"] = jid
return ret