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.

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

Reply via email to