Iâve tried using some of the methods below but it gave an error:
FAILED! => {âmsgâ: "The task includes an option with an undefined variable. The error was: âdict objectâ has no attribute â[is_standby,dbname]â
...
{% for db in databases | sort(attribute='is_standby,dbname', reverse=true) %}
...
What version of Jinja is Ansible using? ansible --version gives you that. As I read the docs, what youâre doing should work, but your ansible-core is very old.
$ ansible-playbook doublesortdic.yml
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does
not match 'all'
PLAY [localhost] ********************************************************************************************
TASK [Output] ***********************************************************************************************
ok: [localhost] => {
"msg": "C_dg\nB_dg\nA_dg\n"
}
PLAY RECAP **************************************************************************************************
localhost : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0