mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-22 03:53:59 -07:00
win_become: Added support to become a service user (#30407)
* win_become: Added support to become a service user * fixes for linting * changes to get local and network service working * fixed linting issues again * pleasing pepe
This commit is contained in:
parent
4e22677e7d
commit
82fa922491
3 changed files with 744 additions and 542 deletions
|
@ -74,6 +74,42 @@
|
|||
- 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 SYSTEM account
|
||||
win_command: whoami
|
||||
become: yes
|
||||
become_method: runas
|
||||
become_user: SYSTEM
|
||||
register: whoami_out
|
||||
|
||||
- name: verify output
|
||||
assert:
|
||||
that:
|
||||
- whoami_out.stdout_lines[0] == "nt authority\\system"
|
||||
|
||||
- name: test become with NetworkService account
|
||||
win_command: whoami
|
||||
become: yes
|
||||
become_method: runas
|
||||
become_user: NetworkService
|
||||
register: whoami_out
|
||||
|
||||
- name: verify output
|
||||
assert:
|
||||
that:
|
||||
- whoami_out.stdout_lines[0] == "nt authority\\network service"
|
||||
|
||||
- name: test become with LocalService account
|
||||
win_command: whoami
|
||||
become: yes
|
||||
become_method: runas
|
||||
become_user: LocalService
|
||||
register: whoami_out
|
||||
|
||||
- name: verify output
|
||||
assert:
|
||||
that:
|
||||
- whoami_out.stdout_lines[0] == "nt authority\\local service"
|
||||
|
||||
# FUTURE: test raw + script become behavior once they're running under the exec wrapper again
|
||||
# FUTURE: add standalone playbook tests to include password prompting and play become keywords
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue