salt.states.environ

Support for getting and setting the environment variables of the current salt process.

salt.states.environ.setenv(name, value, false_unsets=False, clear_all=False, update_minion=False)

Set the salt process environment variables.

name
The environment key to set. Must be a string.
value
Either a string or dict. When string, it will be the value set for the environment key of 'name' above. When a dict, each key/value pair represents an environment variable to set.
false_unsets
If a key's value is False and false_unsets is True, then the key will be removed from the salt processes environment dict entirely. If a key's value is False and false_unsets is not True, then the key's value will be set to an empty string. Default: False
clear_all
USE WITH CAUTION! This option can unset environment variables needed for salt to function properly. If clear_all is True, then any environment variables not defined in the environ dict will be deleted. Default: False
update_minion
If True, apply these environ changes to the main salt-minion process. If False, the environ changes will only affect the current salt subprocess. Default: False

CLI Example:

a_string_env:
   environ.set:
     - name: foo
     - value: bar
     - update_minion: True

a_dict_env:
   environ.set:
     - name: does_not_matter
     - value:
         foo: bar
         baz: quux