The following works fine if I hard-code my scripts' four command-line arguments as args below: The four things my script needs, gets passed in, and it runs on the minion fine.
current sample
run_my_setup_script.sls:
run_my_setup_script:
file.managed:
- name: /usr/local/bin/myscript.sh
- source: salt://managed-scripts/myscript.sh
- user: root
- group: root
- mode: 700
- backup: minion
cmd.script:
- source: salt://managed-scripts/myscript.sh
- args: "mythingsname mythings_file.tar.gz /root/mythings_filedir /opt/mything"
- user: root
- group: root
- shell: /bin/bash
But, that is not what I want to do. I want to be able to pass in those args from the command line when I run the salt command, because they can be different from one system to another.
current sample using the above that works
command-line:
salt
myhost.site.location.mydomain.net state.sls run_my_setup_script
what I want to do instead is something like:
salt
myhost.mydom.myplace.net state.sls run_my_setup_script
-args "$1" "$2" "$3" "$4"I don't know if there is some method in salt to do the equivalent of what I want to do here. The above is just a simple example for illustration, it could be almost anything as long as I get to pass my own arguments into the run of the state.sls and further pass them on into my cmd.script execution.
The only thing I don't want to do is to simply define something in a pillar which then simply moves my hard-coding of the choices from the state.sls to a pillar file. (pillar usage is the only thing I've found that others refer to for similar questions, but from what I've seen it doesn't actually answer my question, I'm not trying to use a pillar at all, simply instruct the behavior of the script my state.sls is going to run.
I want the freedom to pass in anything on the salt state.sls command line that I want to pass into my scripts.
Is this possible? If so, how?
Thanks,
Rob