New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
win_environment : Maybe add an option to read variable content ? #605
Comments
I don't see a real benefit of doing this over a simple call to - hosts: windows
gather_facts: false
tasks:
- name: Gather all env vars
setup:
gather_subset: env
- name: Display env var through facts
debug:
var: ansible_env['SystemRoot']
- name: get env var through win_shell
win_shell: $env:SystemRoot
register: shell_res
changed_when: False
- name: Display env var through win_shell
debug:
var: shell_res.stdout | trim # Or shell_res.stdout_lines[0] The We try to avoid having modules that both set a state and get a state in favour of separate modules. While we do have some today that do that it's more of a historical thing that happened before we put those rules in place. |
Why is that ? |
It makes the module development a lot easier to handle as they stay dedicated to one task and one task only. For example
While yes this is a pretty simple thing to add support for I don't believe the benefits outweigh the extra complexity in the code, especially since the |
SUMMARY
win_environment only modify var. We could add an option to return the current value.
ISSUE TYPE
COMPONENT NAME
We could only return the value when no actual value is given
ADDITIONAL INFORMATION
Return value of TestVariable
The text was updated successfully, but these errors were encountered: