thnks, that worked (of course). 

I try not to be embarrased too much for having someone spelling this outfor me 
like this :-). 
Hopefully I'll be able to pay back to this list later down the road.

I see there is a lot to learn and understand yet (in this case "use of 
variables" for example).


> On 07/20/2022 2:03 PM CEST Vladimir Botka <[email protected]> wrote:
> 
>  
> 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/1133741358.56363.1658321331877%40office.mailbox.org.

Reply via email to