I want to use this output (from a previous command) as an array of key-values or as an inventory for the next command in the same playbook
stdout:
hot-01: 10.100.0.101
hot-02: 10.100.0.102
hot-03: 10.100.0.103
....
hot-32: 10.100.0.132
like this:
- shell: "echo {{ item.key }} has value {{ item.value }}"
with_items: "{{ output.stdout_lines }}"
or:
- add_host: name={{ item.key }} ansible_ssh_host={{ item.value }}
with_items: "{{ output.stdout_lines }}"
Desired output of the echo command:
hot-01 has value 10.100.0.101
I also tried with with_dict: "{{ output.stdout }}" but still no luck
"fatal: [ANSIBLE] => with_dict expects a dict"