(ansible 2.1)
I have a set_fact like:
- name: Get plant agent data from consul
set_fact:
myfact: “{{ lookup(‘consul_kv’, ‘mykey recurse=true’) }}”
When the lookup returns an array of size >= 2, ‘myfact’ is assigned the array value.
But when the lookup returns an array of size == 1, ‘myfact’ is assigned the single object at index 0 of the array. The result is arrays of size one are flattened into an dict.
Is this by design? Some kind of attempted helpfulness? Its causing all kinds of grief because subsequent uses of this fact can’t depend on it being an array of dict or just a simple dict.