Under the ``GROUP INFORMATION`` section, the ``Mandatory Label`` entry
@ -453,7 +453,11 @@ or with this Ansible task:
Become Flags
------------
Ansible 2.5 adds the ``become_flags`` parameter to the ``runas`` become method. This parameter can be set using the ``become_flags`` task directive or set in Ansible's configuration using ``ansible_become_flags``. The two valid values that are initially supported for this parameter are ``logon_type`` and ``logon_flags``.
Ansible 2.5 adds the ``become_flags`` parameter to the ``runas`` become method.
This parameter can be set using the ``become_flags`` task directive or set in
Ansible's configuration using ``ansible_become_flags``. The two valid values
that are initially supported for this parameter are ``logon_type`` and
``logon_flags``.
..Note:: These flags should only be set when becoming a normal user account, not a local service account like LocalSystem.
- name:test with module that will return non-zero exit code (https://github.com/ansible/ansible/issues/30468)
vars:*become_vars
setup:
- name:test become with invalid password
win_whoami:
vars:
ansible_become_pass:'{{ gen_pw }}abc'
become:yes
become_method:runas
become_user:'{{ become_test_username }}'
register:become_invalid_pass
failed_when:
- '"Failed to become user " + become_test_username not in become_invalid_pass.msg'
- '"LogonUser failed (The user name or password is incorrect, Win32ErrorCode 1326)" not in become_invalid_pass.msg'
- name:test become with SYSTEM account
win_whoami:
@ -215,21 +227,21 @@
become_flags:logon_type=batch invalid_flags=a
become_method:runas
register:failed_flags_invalid_key
failed_when:failed_flags_invalid_key.msg != "become_flags key 'invalid_flags' is not a valid runas flag, must be 'logon_type' or 'logon_flags'"
failed_when:"failed_flags_invalid_key.msg != \"Failed to parse become_flags 'logon_type=batch invalid_flags=a': become_flags key 'invalid_flags' is not a valid runas flag, must be 'logon_type' or 'logon_flags'\""
- name:test failure with invalid logon_type
vars:*become_vars
win_whoami:
become_flags:logon_type=invalid
register:failed_flags_invalid_type
failed_when:"failed_flags_invalid_type.msg != \"become_flags logon_type value 'invalid' is not valid, valid values are: interactive, network, batch, service, unlock, network_cleartext, new_credentials\""
failed_when:"failed_flags_invalid_type.msg != \"Failed to parse become_flags 'logon_type=invalid': become_flags logon_type value 'invalid' is not valid, valid values are: interactive, network, batch, service, unlock, network_cleartext, new_credentials\""
- name:test failure with invalid logon_flag
vars:*become_vars
win_whoami:
become_flags:logon_flags=with_profile,invalid
register:failed_flags_invalid_flag
failed_when:"failed_flags_invalid_flag.msg != \"become_flags logon_flags value 'invalid' is not valid, valid values are: with_profile, netcredentials_only\""
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