New in version 2.0.
Parameter | Choices/Defaults | Comments |
---|---|---|
level required |
| 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 required | The name of the environment variable. | |
state |
| Set to present to ensure environment variable is set.Set to absent to ensure it is removed. |
value | The value to store in the environment variable. Must be set when state=present and cannot be an empty string.Can be omitted for state=absent . |
Note
- 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, the following are the fields unique to this module:
Key | Returned | Description |
---|---|---|
before_value string | always | the value of the environment key before a change, this is null if it didn't exist Sample: C:\Windows\System32 |
value string | always | the value the environment key has been set to, this is null if removed Sample: C:\Program Files\jdk1.8 |
This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.
This module is flagged as community which means that it is maintained by the Ansible Community. See Module Maintenance & Support for more info.
For a list of other modules that are also maintained by the Ansible Community, see here.
Hint
If you notice any issues in this documentation you can edit this document to improve it.
© 2012–2018 Michael DeHaan
© 2018 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.7/modules/win_environment_module.html