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, permanent=False)¶Set the salt process environment variables.
The environment key to set. Must be a string.
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.
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
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
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
On Windows minions this will set the environment variable in the registry so that it is always added as a environment variable when applications open. If you want to set the variable to HKLM instead of HKCU just pass in "HKLM" for this parameter. On all other minion types this will be ignored. Note: This will only take affect on applications opened after this has been set.
Example:
a_string_env:
environ.setenv:
- name: foo
- value: bar
- update_minion: True
a_dict_env:
environ.setenv:
- name: does_not_matter
- value:
foo: bar
baz: quux