In another thread, I was explaining how I'm getting a user's information 
from our IPA server.  I believe that the password expiration is already in 
a datetime format.  I'd like to display it to the user via email in a more 
standard format.

For example, let's say that the user's password expiration date/value is 
20210715141027Z.  In the email I send out to them, I'd like to show 
07/15/2021.  Then, I'd like to calculate the date where their account will 
be automatically disabled, which should be 90 days after the expiration 
date.  But I can't figure out how to add 90 days to the expiration date.

Here's part of my playbook for reference:

  - name: Set Disabled Users fact
    set_fact:
      disabled_users: "{{ user_show.results | 
json_query('[*].json.result.result.{uid: uid[0], mail: mail[0], 
nsaccountlock: nsaccountlock, pwdexp: 
krbpasswordexpiration[0].__datetime__}') | 
selectattr('pwdexp','<',cutoff_date) | selectattr('nsaccountlock', 
'equalto', False) | list }}"

  - name: Print disabled users
    debug:
      msg: "{{ item.uid }} / {{ item.mail }} / {{ 
item.pwdexp.format('%m/%d/%Y') }}"
    loop: "{{ disabled_users }}"

Thanks,
Harry

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/abf9d827-3130-4154-b761-f36032f6cf68n%40googlegroups.com.

Reply via email to