Hi,

validate is for basically running things like visudo against a sudoers file
before finally copying it in place over the file.   This wouldn't be a good
fit here.

It seems that what you would want to do, instead, is adapt your fileglob to
only accept those files, or instead, name those files explicitly.

Sort of make sense?

Thanks!



On Thu, Sep 25, 2014 at 7:20 AM, Dan Bohea <[email protected]> wrote:

> Pretty sure I need to use the validate parameter in a copy task but am
> unclear on how to use it.
>
> Here's my copy task for context:
>
> - copy: src={{ item }} dest=/home/vagrant/.drush/{{ boxname
> }}.aliases.drushrc.php
>   with_fileglob:
>     - ../../settings/drush_aliases/*
>   notify: drush cc drush
>   when: php_install is defined and php_install == "y"
>   tags: drush_aliases
>
> I guess the only bit we need to focus on here is:
>
> - copy: src={{ item }} dest=/home/vagrant/.drush/{{ boxname
> }}.aliases.drushrc.php
>   with_fileglob:
>     - ../../settings/drush_aliases/*
>
> I'd like to make sure that only certain files can be copied from
> ../../settings/drush_aliases/*
>
> Things like:
>
>    1. Only files with a .php extension
>    2. Only 1 file can be copied (fail if the directory contains multiple)
>
> Any pointers on how I might achieve this?
>
> --
> 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/778d9005-dfe3-4eff-977b-ff93ebde23ed%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/778d9005-dfe3-4eff-977b-ff93ebde23ed%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%2BnsWgz2-RMZWGm_-ajEtYTyhaOFpU_snOifo11H-bbXreo-hw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to