The stat module cannot take fileglobs, and must check a specific asset.

What you have with the test is probably reasonable.



On Fri, Nov 14, 2014 at 3:12 PM, faust <[email protected]> wrote:

> Hi,
> is it possible to use the stat module with meta characters:
> - stat: path=/etc/rc2.d/S*init_script.sh
>   register: i
>
> - debug: msg="Path is a simlink"
>   when: i.stat.islnk
>
> Or what is the elegant way of doing the following (without breaking the
> very useful 'ansible-playbook --check' feature):
> - name: check init script present
>   shell: if test -f /etc/rc2.d/S*init_script.sh ; then echo true; fi
>   register: result
>   ignore_errors: true
>   changed_when: false
>
> - name: install init script
>   shell: /usr/sbin/update-rc.d init_script.sh remove &&
> /usr/sbin/update-rc.d init_script.sh defaults
>   when: result.stdout != 'true'
>
> I am trying to configure Debian init script.
> Regards.
>
> --
> 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/a02d074d-81db-4316-a7e6-d6b21b090b16%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/a02d074d-81db-4316-a7e6-d6b21b090b16%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%2BnsWgxxfGxkSC2wFSER_uxsCbfJk9oAv3iW_hrLh_kWwT_TLg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to