How to specify hosts target of an action in rule


New to stackstorm. I have been following example to get myself up to speed. There is one thing that i am not too sure about. I have an action which is remote-shell-script type and able to run individually cmd against remote host using ‘st2 run action hosts=ABC’. However, when i tried the same action with a rule, it seems falling apart, and the rule wont get executed according to the rule-enforcement list. I realized that I did not specify the target host to run against. So I am wondering to where in rule definition i could specify the hosts=ABC ???


The Action subsection of the Rules section of our docs might answer your question.

hmmm… checked that subsection, no where i can see a mention about. I dont think puting hosts:ABC under the action parameters in the rule section would work. it will be treated like another argument to the script.

The hosts parameter should be read by the remote shell script action runner, and not passed to or interpreted by the script itself.

So you should be able to specify hosts: ABC in the action parameters in the rule.

Just tried it, it seems working. Thanks alot for the prompt response. :+1: