mirror of https://github.com/ansible/ansible.git
user - add password expiration parameters (#69531)
* Add integration test Co-authored-by: Sam Doran <sdoran@redhat.com>pull/73553/head
parent
bf10bb370b
commit
4344607d7d
@ -0,0 +1,2 @@
|
||||
minor_changes:
|
||||
- user - add new parameters ``password_expire_max`` and ``password_expire_min`` for controlling password expiration (https://github.com/ansible/ansible/issues/68775)
|
@ -0,0 +1,55 @@
|
||||
# https://github.com/ansible/ansible/issues/68775
|
||||
- name: Test setting maximum expiration
|
||||
when: ansible_facts.os_family in ['RedHat', 'Debian', 'Suse']
|
||||
block:
|
||||
- name: create user
|
||||
user:
|
||||
name: ansibulluser
|
||||
state: present
|
||||
|
||||
- name: add maximum expire date for password
|
||||
user:
|
||||
name: ansibulluser
|
||||
password_expire_max: 10
|
||||
register: pass_max_1_0
|
||||
|
||||
- name: again add maximum expire date for password
|
||||
user:
|
||||
name: ansibulluser
|
||||
password_expire_max: 10
|
||||
register: pass_max_1_1
|
||||
|
||||
- name: validate result for maximum expire date
|
||||
assert:
|
||||
that:
|
||||
- pass_max_1_0 is changed
|
||||
- pass_max_1_1 is not changed
|
||||
|
||||
- name: add minimum expire date for password
|
||||
user:
|
||||
name: ansibulluser
|
||||
password_expire_min: 5
|
||||
register: pass_min_2_0
|
||||
|
||||
- name: again add minimum expire date for password
|
||||
user:
|
||||
name: ansibulluser
|
||||
password_expire_min: 5
|
||||
register: pass_min_2_1
|
||||
|
||||
- name: validate result for minimum expire date
|
||||
assert:
|
||||
that:
|
||||
- pass_min_2_0 is changed
|
||||
- pass_min_2_1 is not changed
|
||||
|
||||
- name: Get shadow data for ansibulluser
|
||||
getent:
|
||||
database: shadow
|
||||
key: ansibulluser
|
||||
|
||||
- name: Ensure password expiration was set properly
|
||||
assert:
|
||||
that:
|
||||
- ansible_facts.getent_shadow['ansibulluser'][2] == '5'
|
||||
- ansible_facts.getent_shadow['ansibulluser'][3] == '10'
|
Loading…
Reference in New Issue