diff options
author | Jordan Borean <jborean93@gmail.com> | 2018-06-26 14:40:49 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-26 14:40:49 +1000 |
commit | 2af36412f9a5bb5ad0085cbfe34b71626b197555 (patch) | |
tree | 9ba1997a7100a97d22291b7af0b165a42b1e2c14 /test/integration/targets/win_become | |
parent | 57ea4cafff476197f53583345df4b63bd1a17a73 (diff) | |
download | ansible-2af36412f9a5bb5ad0085cbfe34b71626b197555.tar.gz |
runas + async - get working on older hosts (#41772)
* runas + async - get working on older hosts
* fixed up sanity issues
* Moved first task to end of test for CI race issues
* Minor change to async test to be more stable, change to runas become to not touch the disk
* moved async test back to normal spot
Diffstat (limited to 'test/integration/targets/win_become')
-rw-r--r-- | test/integration/targets/win_become/tasks/main.yml | 40 |
1 files changed, 16 insertions, 24 deletions
diff --git a/test/integration/targets/win_become/tasks/main.yml b/test/integration/targets/win_become/tasks/main.yml index e860ff78e4..1f2f241884 100644 --- a/test/integration/targets/win_become/tasks/main.yml +++ b/test/integration/targets/win_become/tasks/main.yml @@ -189,37 +189,16 @@ - whoami_out.label.sid == 'S-1-16-16384' - whoami_out.logon_type == 'Service' - # Test out Async on Windows Server 2012+ - - name: get OS version - win_shell: | - $version = [System.Environment]::OSVersion.Version - if ($version -ge [Version]"6.2") { - "async" - } elseif ($version -lt [Version]"6.1") { - "old-gramps" - } else { - "" - } - register: os_version - - - name: test become + async on older hosts + - name: test become + async vars: *become_vars win_command: whoami async: 10 register: whoami_out - ignore_errors: yes - - name: verify older hosts failed with become + async - assert: - that: - - whoami_out is failed - when: os_version.stdout_lines[0] != "async" - - - name: verify newer hosts worked with become + async + - name: verify become + async worked assert: that: - whoami_out is successful - when: os_version.stdout_lines[0] == "async" - name: test failure with string become invalid key vars: *become_vars @@ -244,12 +223,24 @@ failed_when: "failed_flags_invalid_flag.msg != \"Failed to parse become_flags 'logon_flags=with_profile,invalid': become_flags logon_flags value 'invalid' is not valid, valid values are: with_profile, netcredentials_only\"" # Server 2008 doesn't work with network and network_cleartext, there isn't really a reason why you would want this anyway + - name: check if we are running on a dinosaur, neanderthal or an OS of the modern age + win_shell: | + $version = [System.Environment]::OSVersion.Version + if ($version -lt [Version]"6.1") { + "dinosaur" + } elseif ($version -lt [Version]"6.2") { + "neanderthal" + } else { + "False" + } + register: os_version + - name: become different types vars: *become_vars win_whoami: become_flags: logon_type={{item.type}} register: become_logon_type - when: not ((item.type == 'network' or item.type == 'network_cleartext') and os_version.stdout_lines[0] == "old-gramps") + when: not ((item.type == 'network' or item.type == 'network_cleartext') and os_version.stdout_lines[0] == "dinosaur") failed_when: become_logon_type.logon_type != item.actual and become_logon_type.sid != user_limited_result.sid with_items: - type: interactive @@ -298,6 +289,7 @@ become_flags: logon_flags={{item.flags}} register: become_logon_flags failed_when: become_logon_flags.stdout_lines[0]|bool != item.actual + when: os_version.stdout_lines[0] not in ["dinosaur", "neanderthal"] # usual suspect 2008 doesn't support the no profile flags with_items: - flags: actual: False |