Just pull out those fields from the returned user information. I use that
in 2 or 3 other playbooks so I know that it works.
Thanks,
Harry
On Friday, February 23, 2024 at 11:53:04 AM UTC-5 Rowe, Walter P. (Fed)
wrote:
> pwd_expire_soon: "{{ user_show.results |
> json_query('[*].json.result.result.{uid: uid[0], pwdchg:
> krblastpwdchange[0].__datetime__}') | selectattr('pwdchg', 'lessthan',
> 'expire_date') | list }}"
>
> What are you expecting this red portion to do? I don't think it is valid
> in json_query.
>
> Walter
> --
> Walter Rowe, Division Chief
> Infrastructure Services Division
> Mobile: 202.355.4123 <(202)%20355-4123>
>
> On Feb 23, 2024, at 11:30 AM, [email protected] <[email protected]> wrote:
>
> I am trying to determine when user's password's are going to expire in the
> next 10 days. After I traverse my FreeIPA users and store those users into
> a variable, I try to set a fact like so:
> - name: Find users who's password will expire in the next 10 days
> set_fact:
> pwd_expire_soon: "{{ user_show.results |
> json_query('[*].json.result.result.{uid: uid[0], pwdchg:
> krblastpwdchange[0].__datetime__}') | selectattr('pwdchg', 'lessthan',
> 'expire_date') | list }}"
>
> When I run my playbook, I get the following error:
>
> fatal: [localhost]: FAILED! => {"msg": "Unexpected templating type error
> occurred on ({{ user_show.results |
> json_query('[*].json.result.result.{uid: uid[0], pwdchg:
> krblastpwdchange[0].__datetime__}') | selectattr('pwdchg', 'lessthan',
> 'expire_date') | list }}): '<' not supported between instances of
> 'NoneType' and 'str'. '<' not supported between instances of 'NoneType' and
> 'str'"}
>
> I can't seem to find what the issue is. I originally had '<' instead of
> 'lessthan' but got the same error. Any ideas?
>
> 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/a1131cb0-bc23-46bb-afbf-ca9ad6f4ce34n%40googlegroups.com
>
> <https://groups.google.com/d/msgid/ansible-project/a1131cb0-bc23-46bb-afbf-ca9ad6f4ce34n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
>
>
--
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/c0b4de3d-50e2-4fff-85b1-0437076137dcn%40googlegroups.com.