Thank you for your answer, exactly, il like to make a loop for the role , each time he copie each host in file
example: turn 1 for loop: copie 10.10.10.10. in file and send it to distant server turn 2 for loop: copie 20.20.20.20. in file and send it to distant server Thank you Le lundi 23 novembre 2020 à 12:54:54 UTC+1, [email protected] a écrit : > Typo > {{hostvars [inventory_hostname]["environment"][0]}} > > On Mon, 23 Nov, 2020, 5:20 pm Jerin J, <[email protected]> wrote: > >> {{hostvars [inventory_hostname]["environment"]}} >> >> On Mon, 23 Nov, 2020, 5:12 pm Stefan Hornburg (Racke), <[email protected]> >> wrote: >> >>> On 11/23/20 12:36 PM, blue fox wrote: >>> > Hello, >>> > >>> > How to filter ans extract variable in static inventory. >>> > >>> > Example: >>> > >>> > [webserver] >>> > >>> > 10.10.10.10 >>> > >>> > 20.20.20.20 >>> > >>> > >>> > -------------------------- >>> > >>> > i would to extract each host alone and put him in variable for use in >>> playbook. >>> >>> First entry: >>> >>> groups['webserver'][0] >>> >>> Second entry: >>> >>> groups['webserver'][1] >>> >>> Use in a task >>> >>> debug: >>> msg: {{ groups['webserver'][0] }} >>> >>> Regards >>> Racke >>> >>> > >>> > Thank you >>> > >>> > -- >>> > 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] <mailto: >>> [email protected]>. >>> > To view this discussion on the web visit >>> > >>> https://groups.google.com/d/msgid/ansible-project/0ba5cde2-d244-499a-9711-57b7749cf1c0n%40googlegroups.com >>> > < >>> https://groups.google.com/d/msgid/ansible-project/0ba5cde2-d244-499a-9711-57b7749cf1c0n%40googlegroups.com?utm_medium=email&utm_source=footer >>> >. >>> >>> >>> -- >>> Ecommerce and Linux consulting + Perl and web application programming. >>> Debian and Sympa administration. Provisioning with Ansible. >>> >>> -- >>> 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/65f28581-924a-4d9e-016a-90c7cd0eb9c2%40linuxia.de >>> . >>> >> -- 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/09456cf6-81c3-4754-86e9-a7abb107e5e6n%40googlegroups.com.
