http://docs.ansible.com/ansible/group_by_module.html
will let you make a group by fact, you could then just have a task
on localhost output '{{ groups["has_that_file"] _ length }}".
There's a set_fact task you can use to set a (boolean) fact on hosts,
or just bite the bullet and write a custom fact.
It seems a bit of an odd requirement to be honest, that's the best I can
suggest from what you've posted.
On 19 June 2017 at 00:39, Tommy Ash <[email protected]> wrote:
> Hi, I'm trying to get a count of how many servers have a specific file on
> them. For example, if /tmp/testFile is on 8 of 25 hosts that I'm running a
> playbook against, I'd like to register a variable and give it the value of
> 8. Is this possible?
>
> --
> 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/8bd181dc-20ce-4ce1-97b4-e85921799c69%40googlegroups.com.
> 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/CAK5eLPS%3DtLdehEG0jQ09n%2BV0iNTzUEwDq8qLmto6Vkxs%2BD-y-Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.