mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
21 lines
606 B
YAML
21 lines
606 B
YAML
|
---
|
||
|
- name: get current workgroup
|
||
|
win_shell: (Get-WmiObject Win32_ComputerSystem).Workgroup
|
||
|
register: workgroup
|
||
|
|
||
|
- name: fail if workgroup result is empty (means test host is in a domain)
|
||
|
fail:
|
||
|
msg: Cannot run tests for win_domain_membership when host is a member of a domain
|
||
|
when: workgroup.stdout == ""
|
||
|
|
||
|
- block:
|
||
|
- include_tasks: tests.yml
|
||
|
|
||
|
always:
|
||
|
- name: revert workgroup back to original before tests
|
||
|
win_domain_membership:
|
||
|
workgroup_name: '{{workgroup.stdout_lines[0]}}'
|
||
|
state: workgroup
|
||
|
domain_admin_user: fake user
|
||
|
domain_admin_password: fake password
|