Hi Benjamin,
Can you explain what you mean by "use the entire host inventory file as a
variable?"
There are things like using the host selector ("hosts: groupname") and even
stuff like:
- hosts: monitored_servers
tasks:
- shell: /usr/bin/foo --server={{ item }}
delegate_to: "{{ item }}"
with_items: groups.monitoring_servers
That natively use inventory data.
The path to the inventory file is available as a variable, though in
general you should not be updating that during an ansible run -- if you
have that kind of use case, dynamic inventory may be appropriate.
I guess it depends on the usage - so let us know more and we'd be glad to
give more details.
Thanks!
--Michael
On Mon, Sep 15, 2014 at 6:33 PM, Benjamin Leung <[email protected]>
wrote:
> Lets say I have a playbook with the following code
>
> - name: Check port
> command: nc -z -v {{asdf_servers}} 8089
> ignore_errors: true
>
> in the group var
>
> asdf_servers: localhost
>
> Is there a way to use the entire host inventory file as a variable in the
> play book? Or can I enter multiple values for the asdf_servers variable,
> separated by , or ; ?
>
> --
> 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 post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/c4b73482-5f5a-42fa-b503-a3b8f53b6d2f%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/c4b73482-5f5a-42fa-b503-a3b8f53b6d2f%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
--
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 post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/CA%2BnsWgzeYRq12sAZYFTQP98dkGQ9SCV2fL3b3HW2vNfuOUsfAg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.