Unable to use job inputs to dynamically alter states
search cancel

Unable to use job inputs to dynamically alter states

book

Article ID: 389008

calendar_today

Updated On:

Products

VMware Aria Suite

Issue/Introduction

Job inputs are a feature in the Aria Config job creation tool that can be used to modify the options provided to a remote execution module. This is handy for tasks such as querying 

 

salt myminion network.ping <HOSTNAME>

The HOSTNAME is a parameter to the network.ping function and could be configured in a job by the admin to be a selectable choice by the user. 

 

Environment

Aria Config - all versions

Resolution

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.

  1. Navigate to Configurations -> Jobs
  2. Click "Create Job" near the top right corner
  3. Give the job a name
  4. Select "salt" radio button as the command
  5. Select a target to limit the scope of execution to this single target
    1. This is optional
  6. Select "cmd.run" as the "Function" option
  7. Leave "Arguments" box empty
    1. If you typed any spaces in this field, then clear all text
  8. Click "Add Job Input"
  9. Give the new input a name that indicate to users what the option is for
  10. Toggle the "Show at Job Run" option
  11. You will need to reference the documentation to find the specific "Keyword" option to be provided
    1. 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) 
    2. We'll use "cmd" for this option in this example
  12. Use "uptime" for the default value
    1. 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.
  13. The toggle the "Require input at job run" option
  14. Save this and you should now see your option has been added to the form.
  15. 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. 

Additional Information

https://blogs.vmware.com/management/2022/03/introducing-vrealize-automation-saltstack-config-job-updates.html