This can also be accomplished using the `stat` module, and then a little
jinja2 pipeline:

- hosts: all
  tasks:
    - stat:
        path: /tmp
      register: stat_result

    - debug:
        msg: "{{
hostvars|dictsort|selectattr('1.stat_result.stat.exists')|list|length }}"
      run_once: true

This would output something like the following for me:

TASK [debug]
*********************************************************************************************************************************************************************
ok: [example.org] => {
    "msg": "8"
}

On Mon, Jun 19, 2017 at 11:13 AM, Dick Davies <[email protected]>
wrote:

> On 19 June 2017 at 17:13, Dick Davies <[email protected]> wrote:
>
> > will let you make a group by fact, you could then just have a task
> > on localhost output '{{ groups["has_that_file"] _ length }}".
>
> sorry that should be:
>
> {{ groups["has_that_file"] | length }}
>
> --
> 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/CAK5eLPQV8OcnQcV%2BTRNhp9pQPrEQzayrP7gQ4GbH%
> 2BOg14mq6bA%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Matt Martz
@sivel
sivel.net

-- 
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/CAD8N0v-27m3UNH7cxDdk6R4%3DYtvCd_555k-Ah_VbHr%2BtmUP4JA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to