2017-09-21 19:59:42 +00:00
|
|
|
---
|
|
|
|
- name: change workgroup (check mode)
|
|
|
|
win_domain_membership:
|
|
|
|
workgroup_name: ANSIBLETEST
|
|
|
|
state: workgroup
|
|
|
|
domain_admin_user: fake user
|
|
|
|
domain_admin_password: fake password
|
|
|
|
register: change_workgroup_check
|
|
|
|
check_mode: yes
|
|
|
|
|
|
|
|
- name: get result of change workgroup (check mode)
|
|
|
|
win_shell: (Get-WmiObject Win32_ComputerSystem).Workgroup
|
|
|
|
register: change_workgroup_result_check
|
|
|
|
|
|
|
|
- name: assert result of change workgroup (check mode)
|
|
|
|
assert:
|
|
|
|
that:
|
2017-11-27 22:58:08 +00:00
|
|
|
- change_workgroup_check is changed
|
2017-09-21 19:59:42 +00:00
|
|
|
- change_workgroup_result_check.stdout == workgroup.stdout
|
|
|
|
|
|
|
|
- name: change workgroup
|
|
|
|
win_domain_membership:
|
|
|
|
workgroup_name: ANSIBLETEST
|
|
|
|
state: workgroup
|
|
|
|
domain_admin_user: fake user
|
|
|
|
domain_admin_password: fake password
|
|
|
|
register: change_workgroup
|
|
|
|
|
|
|
|
- name: get result of change workgroup
|
|
|
|
win_shell: (Get-WmiObject Win32_ComputerSystem).Workgroup
|
|
|
|
register: change_workgroup_result
|
|
|
|
|
|
|
|
- name: assert result of change workgroup
|
|
|
|
assert:
|
|
|
|
that:
|
2017-11-27 22:58:08 +00:00
|
|
|
- change_workgroup is changed
|
2017-09-21 19:59:42 +00:00
|
|
|
- change_workgroup_result.stdout_lines[0] == "ANSIBLETEST"
|
|
|
|
|
|
|
|
- name: change workgroup (idempotent)
|
|
|
|
win_domain_membership:
|
|
|
|
workgroup_name: ANSIBLETEST
|
|
|
|
state: workgroup
|
|
|
|
domain_admin_user: fake user
|
|
|
|
domain_admin_password: fake password
|
|
|
|
register: change_workgroup_again
|
|
|
|
|
|
|
|
- name: assert result of change workgroup (idempotent)
|
|
|
|
assert:
|
|
|
|
that:
|
2017-11-27 22:58:08 +00:00
|
|
|
- change_workgroup_again is not changed
|
2017-09-21 19:59:42 +00:00
|
|
|
|
|
|
|
- name: change workgroup fail invalid name
|
|
|
|
win_domain_membership:
|
|
|
|
workgroup_name: ANSIBLELONGNAMEFAILURE
|
|
|
|
state: workgroup
|
|
|
|
domain_admin_user: fake user
|
|
|
|
domain_admin_password: fake password
|
|
|
|
register: fail_change_workgroup
|
|
|
|
failed_when: "fail_change_workgroup.msg != 'failed to set workgroup through WMI, return value: 2695'"
|