179 lines
4.6 KiB
YAML
179 lines
4.6 KiB
YAML
|
# Copyright: (c) 2019, Prasoon Karunan V (@prasoonkarunan) <kvprasoon@Live.in>
|
||
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||
|
---
|
||
|
- name: set autologon registry keys (check mode)
|
||
|
win_auto_logon:
|
||
|
username: '{{ ansible_user }}'
|
||
|
password: '{{ test_logon_password }}'
|
||
|
state: present
|
||
|
register: set_check
|
||
|
check_mode: yes
|
||
|
|
||
|
- name: get acutal of set autologon registry keys (check mode)
|
||
|
test_autologon_info:
|
||
|
register: set_actual_check
|
||
|
|
||
|
- name: assert set autologon registry keys (check mode)
|
||
|
assert:
|
||
|
that:
|
||
|
- set_check is changed
|
||
|
- set_actual_check.AutoAdminLogon == 0
|
||
|
- set_actual_check.AutoLogonCount == None
|
||
|
- set_actual_check.DefaultDomainName == None
|
||
|
- set_actual_check.DefaultPassword == 'abc'
|
||
|
- set_actual_check.DefaultUserName == None
|
||
|
- set_actual_check.LsaPassword == None
|
||
|
|
||
|
- name: set autologon registry keys
|
||
|
win_auto_logon:
|
||
|
username: '{{ ansible_user }}'
|
||
|
password: '{{ test_logon_password }}'
|
||
|
state: present
|
||
|
register: set
|
||
|
|
||
|
- name: get acutal of set autologon registry keys
|
||
|
test_autologon_info:
|
||
|
register: set_actual
|
||
|
|
||
|
- name: assert set autologon registry keys
|
||
|
assert:
|
||
|
that:
|
||
|
- set is changed
|
||
|
- set_actual.AutoAdminLogon == 1
|
||
|
- set_actual.AutoLogonCount == None
|
||
|
- set_actual.DefaultDomainName == test_domain
|
||
|
- set_actual.DefaultPassword == None
|
||
|
- set_actual.DefaultUserName == test_user
|
||
|
- set_actual.LsaPassword == test_logon_password
|
||
|
|
||
|
- name: set autologon registry keys (idempotent)
|
||
|
win_auto_logon:
|
||
|
username: '{{ ansible_user }}'
|
||
|
password: '{{ test_logon_password }}'
|
||
|
state: present
|
||
|
register: set_again
|
||
|
|
||
|
- name: assert set autologon registry keys (idempotent)
|
||
|
assert:
|
||
|
that:
|
||
|
- not set_again is changed
|
||
|
|
||
|
- name: add logon count (check mode)
|
||
|
win_auto_logon:
|
||
|
username: '{{ ansible_user }}'
|
||
|
password: '{{ test_logon_password }}'
|
||
|
logon_count: 2
|
||
|
state: present
|
||
|
register: logon_count_check
|
||
|
check_mode: yes
|
||
|
|
||
|
- name: get result of add logon count (check mode)
|
||
|
test_autologon_info:
|
||
|
register: logon_count_actual_check
|
||
|
|
||
|
- name: assert add logon count (check mode)
|
||
|
assert:
|
||
|
that:
|
||
|
- logon_count_check is changed
|
||
|
- logon_count_actual_check.AutoLogonCount == None
|
||
|
|
||
|
- name: add logon count
|
||
|
win_auto_logon:
|
||
|
username: '{{ ansible_user }}'
|
||
|
password: '{{ test_logon_password }}'
|
||
|
logon_count: 2
|
||
|
state: present
|
||
|
register: logon_count
|
||
|
|
||
|
- name: get result of add logon count
|
||
|
test_autologon_info:
|
||
|
register: logon_count_actual
|
||
|
|
||
|
- name: assert add logon count
|
||
|
assert:
|
||
|
that:
|
||
|
- logon_count is changed
|
||
|
- logon_count_actual.AutoLogonCount == 2
|
||
|
|
||
|
- name: change auto logon (check mode)
|
||
|
win_auto_logon:
|
||
|
username: '{{ ansible_user }}'
|
||
|
password: '{{ test_logon_password2 }}'
|
||
|
state: present
|
||
|
register: change_check
|
||
|
check_mode: yes
|
||
|
|
||
|
- name: get reuslt of change auto logon (check mode)
|
||
|
test_autologon_info:
|
||
|
register: change_actual_check
|
||
|
|
||
|
- name: assert change auto logon (check mode)
|
||
|
assert:
|
||
|
that:
|
||
|
- change_check is changed
|
||
|
- change_actual_check == logon_count_actual
|
||
|
|
||
|
- name: change auto logon
|
||
|
win_auto_logon:
|
||
|
username: '{{ ansible_user }}'
|
||
|
password: '{{ test_logon_password2 }}'
|
||
|
state: present
|
||
|
register: change
|
||
|
|
||
|
- name: get reuslt of change auto logon
|
||
|
test_autologon_info:
|
||
|
register: change_actual
|
||
|
|
||
|
- name: assert change auto logon
|
||
|
assert:
|
||
|
that:
|
||
|
- change is changed
|
||
|
- change_actual.AutoLogonCount == None
|
||
|
- change_actual.LsaPassword == test_logon_password2
|
||
|
|
||
|
- name: remove autologon registry keys (check mode)
|
||
|
win_auto_logon:
|
||
|
state: absent
|
||
|
register: remove_check
|
||
|
check_mode: yes
|
||
|
|
||
|
- name: get result of remove autologon registry keys (check mode)
|
||
|
test_autologon_info:
|
||
|
register: remove_actual_check
|
||
|
|
||
|
- name: assert remove autologon registry keys (check mode)
|
||
|
assert:
|
||
|
that:
|
||
|
- remove_check is changed
|
||
|
- remove_actual_check == change_actual
|
||
|
|
||
|
- name: remove autologon registry keys
|
||
|
win_auto_logon:
|
||
|
state: absent
|
||
|
register: remove
|
||
|
|
||
|
- name: get result of remove autologon registry keys
|
||
|
test_autologon_info:
|
||
|
register: remove_actual
|
||
|
|
||
|
- name: assert remove autologon registry keys
|
||
|
assert:
|
||
|
that:
|
||
|
- remove is changed
|
||
|
- remove_actual.AutoAdminLogon == 0
|
||
|
- remove_actual.AutoLogonCount == None
|
||
|
- remove_actual.DefaultDomainName == None
|
||
|
- remove_actual.DefaultPassword == None
|
||
|
- remove_actual.DefaultUserName == None
|
||
|
- remove_actual.LsaPassword == None
|
||
|
|
||
|
- name: remove autologon registry keys (idempotent)
|
||
|
win_auto_logon:
|
||
|
state: absent
|
||
|
register: remove_again
|
||
|
|
||
|
- name: assert remove autologon registry keys (idempotent)
|
||
|
assert:
|
||
|
that:
|
||
|
- not remove_again is changed
|