You're welcome. Put the declarations of *ver* and *pkg* into the *vars*. I edited your code in-line
On Wed, 20 Jul 2022 13:48:40 +0200 (CEST) Gunnar Wagner <[email protected]> wrote: > - hosts: all > vars: > ansible_user: gwagner > ver: "{{ ansible_play_hosts| > map('extract', hostvars, ['backrest_version', 'stdout'])| > map('split', ' ')|map('last')| > list }}" > pkg: "{{ dict(ansible_play_hosts|zip(ver)) }}" > > tasks: > - name: check pgBackRest version > ansible.builtin.command: /usr/bin/pgbackrest version > register: backrest_version > > - name: Print return information from the previous task > ansible.builtin.debug: > var: backrest_version.stdout > when: debug|d(false)|bool > > - name: Write the CSV file > ansible.builtin.copy: > dest: pkg.csv > content: |- > {% for k,v in pkg.items() %} > {{ k }},{{ v }} > {% endfor %} > delegate_to: localhost > run_once: true -- Vladimir Botka -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/20220720140300.0277131c%40gmail.com.
pgpObdQbgIFI7.pgp
Description: OpenPGP digital signature
