Hi, add the items to the list in the loop
- set_fact:
indice: "{{ indice|default([]) + [item.split(',')[0]] }}"
...
-vlado
On Wed, 21 Aug 2019 08:36:58 -0700 (PDT)
Karther <[email protected]> wrote:
> Hey,
>
> I have on file csv "clef_applicatives.csv" with this content :
>
> 13,my_user,my_host,gis
> 14,my_user,my_host,gis
>
>
> I have next tasks with this content :
>
> - set_fact:
> indice: "{{ item.split(',')[0] }}"
> with_lines: cat /home/ansible/test/test_ssh_manager/clef_applicatives.csv
> when: item.split(',')[2] == inventory_hostname
> delegate_to: localhost
>
> - name: "Afficher indice"
> debug:
> msg: "{{ indice }}"
>
> The problem is that my variable indice get only last indice of my file who
> is 14 and not 13.
>
> How do for that ansible play playbook with this both values.
> (there is probabily other values in this file ...)
>
> Help me please community ansible !!!!
>
> Regards,
>
> Karther
>
--
Regards,
Vladimir
Vladimir Botka
[email protected]
+420.773.041.182
Smeralova 13, Prague 17000, Czech
https://www.botka.link/
https://www.linkedin.com/in/vbotka/
--
--
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/20190821182909.2a9231ec%40gmail.com.
pgpCl8BOU3YIa.pgp
Description: OpenPGP digital signature
