Maybe something like this:

     - name: find files
       find:
         path: /var/log
         patterns: '*.log'
         size: 100m
       register: bigfiles
       changed_when: bigfiles.files != []
       notify: start service


On Tue, May 19, 2020 at 2:29 PM Dan Idar <dan7843...@gmail.com> wrote:

> Hello
> I would like to be able to find the files that are bigger than a certain
> dize and then restart a service if this happens because it mean the
> rotation is not working after the configurtion update
>
> the find module does not 'change' when the file is found or not and i know
> i can trigger a change using
> when_changed: true
>
>
>
> per instance:
>
> ---
>
> - hosts: all
>   gather_facts: false
>   handlers:
>    - name: start service
>      command: service auditd restart
>      args:
>        warn: false
>
>
>   tasks:
>      - name: find files
>        find:
>          path: /var/log
>          patterns: '*.log'
>          size: 100m
>        register: bigfiles
>
>
>
>
> how would I execute the handler and the find files task never changes
>
> i only want to start the service on server that have such big files..
>
> thanks
>
> --
> 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 ansible-project+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/0236f5ba-ae30-4100-ba5b-3b170f655859%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/0236f5ba-ae30-4100-ba5b-3b170f655859%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>


-- 
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 ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAD8N0v_TPSbj-xaSozrQ25VXUTMK8HXTjY1NxN8BdP2cnELH_w%40mail.gmail.com.

Reply via email to