Before configuring job inputs, you need to know what options are configurable for the module in question. See https://docs.saltproject.io/en/latest/py-modindex.html for the list of modules. Be sure to look at section "m" for modules, not "s" for states. We'll use the cmd.run module as an example.
- Navigate to Configurations -> Jobs
- Click "Create Job" near the top right corner
- Give the job a name
- Select "salt" radio button as the command
- Select a target to limit the scope of execution to this single target
- This is optional
- Select "cmd.run" as the "Function" option
- Leave "Arguments" box empty
- If you typed any spaces in this field, then clear all text
- Click "Add Job Input"
- Give the new input a name that indicate to users what the option is for
- Toggle the "Show at Job Run" option
- You will need to reference the documentation to find the specific "Keyword" option to be provided
- This configuration option directly translates to the option that will be passed in to the function and should match the parameter name from the documentation exactly (case sensitive)
- We'll use "cmd" for this option in this example
- Use "uptime" for the default value
- Users will be able to override this value at job execution, but this should be a valid command in case they just want to test things.
- The toggle the "Require input at job run" option
- Save this and you should now see your option has been added to the form.
- Save the job using the "Save" button below
You should now be able to test the job execution.
Some use cases for this feature:
- Limit the states that can be executed on a specific target to a selectable few
- Job input data is not usable within a state and the state needs to have all data provided by another means
- Allow users to run common commands on sensitive hosts such as "df -h", or a command that cleans caches
- Check networking connectivity from a minion host to another
- Have the minions return their running configuration
NOTE: Depending on the job configuration, the status may report incorrectly, however, it will execute.