I have a playbook that gathers some information, then sets a fact based on that information. This has worked for over 2 years now. Over the weekend, the playbook started failing with an “unexpected templating type error”. Here’s the portion of the play:
- name: Set List of users to get Disabled Warning message
set_fact:
warning_users: "{{ user_show.results | json_query('[*].json.result.result.{uid: uid[0], mail: mail[0], nsaccountlock: nsaccountlock, pwdexp: krbpasswordexpiration[0].__datetime__}') | selectattr('pwdexp','<',warning_date) | selectattr('nsaccountlock', 'equalto', False) | list }}"
Here’s the error:
fatal: [server1]: FAILED! => {“msg”: “Unexpected templating type error occurred on ({{ user_show.results | json_query(‘[*].json.result.result.{uid: uid[0], mail: mail[0], nsaccountlock: nsaccountlock, pwdexp: krbpasswordexpiration[0].datetime}’) | selectattr(‘pwdexp’,‘<’,warning_date) | selectattr(‘nsaccountlock’, ‘equalto’, False) | list }}): ‘<’ not supported between instances of ‘NoneType’ and ‘AnsibleUnsafeText’. ‘<’ not supported between instances of ‘NoneType’ and ‘AnsibleUnsafeText’”}
Any ideas on why this is suddenly no longer working? What I’m thinking that it could be was that on this server, Red Hat had me enable the ansible-automation-platform-2.4-for-rhel-8-x86_64-rpms repository as we’re trying to install AAP on this server. Could this have caused something to change? Ansible core is version 2.15.12.
Thanks,
Harry