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:
- Only files with a .php extension
- Only 1 file can be copied (fail if the directory contains multiple)
Any pointers on how I might achieve this?