Re: [ansible-project] Issue with selectattr

2024-02-26 Thread lift...@gmail.com
I think I got it. I set the fact like so: - name: Find users who's password will expire in the next {{ warning_days }} days ansible.builtin.set_fact: pwd_expire_soon: "{{ user_show.results | json_query('[*].json.result.result.{uid: uid[0], pwdchg: krblastpwdchange[0].__datetime__}'

Re: [ansible-project] Issue with selectattr

2024-02-26 Thread Todd Lewis
Assuming what you posted is the result of:   - name: Show user info     debug: msg: "{{ user_show.results | json_query('[*].json.result.result.{uid: uid[0], pwdchg: krblastpwdchange[0].__datetime__}') }}" Then throw this onto the end: | selectattr("pwdchg", "!=", None) You could p

Re: [ansible-project] Issue with selectattr

2024-02-26 Thread lift...@gmail.com
I totally understand where you're coming from. You guys have always been great and extremely helpful, and I appreciate that. I have adjusted the playbook to look at the first 5 users, and the anonymized output is below. Thanks, Harry TASK [Show user info]

Re: [ansible-project] Issue with selectattr

2024-02-26 Thread Todd Lewis
Normally I would change krblastpwdchange[0].__datetime__ to krblastpwdchange[0].__datetime__ | default('0') but your expression is part of json_query(). Perhaps there's an equivalent of Jinja's default() in json_query(); I just don't know. Without standing up an IPA instance and experimenti

Re: [ansible-project] Issue with selectattr

2024-02-26 Thread lift...@gmail.com
I'm including the playbook below. I'm still unable to find a way to ignore any user that does not have the krblastpwdchange property set. When I run the playbook, I still get the following error: TASK [Find users who's password will expire in the next 10 days]