Hi everyone,
We are using a Jinja2 template to populate a configuration file, based on the information Ansible feeds it on runtime:
`
Main Processes
{% for k, v in some_conf | dictsort() %}
cmdline -c /etc/some_tool/some_agent-{{ k }}.conf -o /var/log/some_tool/some_agent.log
{% endfor %}
`
We get a predictable output thanks to using dictsort():
% cat /etc/some_tool/some_agent.conf <process> cmdline -c some_agent-AAA.conf -o /var/log/some_tool/some_agent.log </process> <process> cmdline -c some_agent-BBB.conf -o /var/log/some_tool/some_agent.log </process>
Thing is we need in the above configuration file that some_agent-BBB.conf is placed before than some_agent-AAA.conf; for that matter I introduced the reverse=True argument to dictsort():
`
Main Processes
{% for k, v in some_conf | dictsort(reverse=True) %}
cmdline -c /etc/some_tool/some_agent-{{ k }}.conf -o /var/log/some_tool/some_agent.log
{% endfor %}
`
When tested using Yasha (https://github.com/kblomqvist/yasha), the output is the expected one:
% cat /etc/some_tool/some_agent.conf <process> cmdline -c some_agent-BBB.conf -o /var/log/some_tool/some_agent.log </process> <process> cmdline -c some_agent-AAA.conf -o /var/log/some_tool/some_agent.log </process>
However, when running the playbook, Ansible complains and stops execution, showing the error message I put on the subject of this email: do_dictsort() got an unexpected keyword argument ‘reverse’
Why’re running ansible 2.1.1.0.
Thanks!