New in version 2.0.
parameter | required | default | choices | comments |
---|---|---|---|---|
level | yes | no default |
| The level at which to set the environment variable. Use 'machine' to set for all users. Use 'user' to set for the current user that ansible is connected as. Use 'process' to set for the current process. Probably not that useful. |
name | yes | no default | The name of the environment variable | |
state | no | present |
| present to ensure environment variable is set, or absent to ensure it is removed |
value | no | no default | The value to store in the environment variable. Can be omitted for state=absent |
- name: Set an environment variable for all users win_environment: state: present name: TestVariable value: Test value level: machine - name: Remove an environment variable for the current user win_environment: state: absent name: TestVariable level: user
Common return values are documented here Return Values, the following are the fields unique to this module:
name | description | returned | type | sample |
---|---|---|---|---|
before_value | the value of the environment key before a change, this is null if it didn't exist | always | string | C:\Windows\System32 |
name | the name of the environment key the module checked | always | string | JAVA_HOME |
value | the value the environment key has been set to | always | string | C:\Program Files\jdk1.8 |
level | the level set when calling the module | always | string | machine |
Note
This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.
For help in developing on modules, should you be so inclined, please read Community Information & Contributing, Testing Ansible and Developing Modules.
© 2012–2017 Michael DeHaan
© 2017 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/win_environment_module.html