* ci: disable injecting facts as own vars in the main namespace Signed-off-by: Norman Ziegner <[email protected]> * Consistently access facts via the ansible_facts.* namespace Signed-off-by: Norman Ziegner <[email protected]> --------- Signed-off-by: Norman Ziegner <[email protected]>
33 lines
1.3 KiB
YAML
33 lines
1.3 KiB
YAML
---
|
|
- name: Get Password Expiry date for use pw_no_ageing
|
|
ansible.builtin.shell: chage -l pw_no_ageing | grep "Password expires" | cut -d ":" -f 2
|
|
changed_when: false
|
|
register: expiry_date
|
|
|
|
- name: Check that the expiry date of pw_no_ageing is "never"
|
|
ansible.builtin.assert:
|
|
that:
|
|
- expiry_date.stdout | trim == 'never'
|
|
|
|
- name: Get Password Expiry date for pw_ageing
|
|
ansible.builtin.shell: chage -l pw_ageing | grep "Password expires" | cut -d ":" -f 2
|
|
changed_when: false
|
|
register: expiry_date
|
|
|
|
- name: Check that the expiry date of pw_ageing is 60 days
|
|
ansible.builtin.assert:
|
|
# this uses the date from the expire_date variable and subtracts the current date.
|
|
# it should be bigger that the password_expire_min of the user "pw_no_ageing"
|
|
that:
|
|
- ( expiry_date.stdout | trim | to_datetime('%b %d, %Y') - ansible_facts.date_time.date | to_datetime('%Y-%m-%d')).days == 60
|
|
|
|
- name: Get Password Expiry warning days for pw_ageing
|
|
ansible.builtin.shell: chage -l pw_ageing | grep "warning before password expires" | cut -d ":" -f 2
|
|
changed_when: false
|
|
register: expiry_warndays
|
|
|
|
- name: Check that number of days of warning before password expires is 7 days
|
|
ansible.builtin.assert:
|
|
that:
|
|
- expiry_warndays.stdout | trim == '7'
|