Custom CLI ags for `state.sls`

14 views
Skip to first unread message

Mircea Ulinic

unread,
Jan 15, 2017, 12:07:30 PM1/15/17
to Salt-users
Hello,

We all know very well the `test` CLI arg for states dry-run, e.g.:

$ sudo salt <target> state.sls <state> test=True

and the `test` CLI arg is available in the __opts__ object injected in the state module.

I will go straight to the question: is there a way to access other CLI args? For example:

$ sudo salt <target> state.sls <state> foo=True bar=True

and get their value from the __opts__ or elsewhere?

Thank you,
Mircea

Daniel Wallace

unread,
Jan 17, 2017, 10:51:59 AM1/17/17
to salt-...@googlegroups.com
If you want to do that, you could pass them in on the command line like pillars?

salt \* state.sls <state> pillar="{'foo': True, 'bar': True}"

Would that work?

--
You received this message because you are subscribed to the Google Groups "Salt-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to salt-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/salt-users/8c25bea0-fbe5-4d66-a420-13ab4f662f31%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages