Hi All,
Need your Guidance to achieve the milestone.
I am creating a playbook to validate the user password expiry date . if it expires withing 15 days it should send a mail to user mail id.
but not sure how to enable mail alter after execution of command .
Below is the palybook task detail :-
tasks:
- name: check users password valid time
shell: chage -l “{{ item }}”
register: validate
loop: users
-
debug:
msg: “{{ validate }}”
when: validate.rc !=0 -
name: Intimate concern team by mail if lock occurs
mail:
host: “{{ smtp_host_name }}”
port: “{{ smtp_port }}”
attach: -
/home/kundan/
body: " password getting expires in 10 days"