continuous integration - Ansible : Using regular expression in the module "copy" -


the context

i'm trying build continuous-integration platform , in ansible playbook use maven-dependency-plugin:get download artifact nexus on master deployed on remote server using ansible module copy.

in order make lightweight , generic playbook, defined variable called app_version that, if it's defined, download given version , if not download latest version nexus repository. artifact downloaded in given directory (/tmp/delivery/). below ansible task:

- hosts: local   tasks:     - name: "downloading war"       shell: >            mvn org.apache.maven.plugins:maven-dependency-plugin:2.10:get -dgroupid=app-dartifactid=app-dversion={{ app_version if app_version defined else 'latest' }} -dpackaging=war -drepositoryid=my-nexus -ddest=/tmp/delivery/ 


my problem

to assure playbook genericity, need write regular expression in ansible module copy pick artifact having pattern app*.war looks module don't provide ability. below copy tastk:

- hosts: agir   tasks:     - name: "copying war"       copy: src=/tmp/delivery/app*.war dest=/folder/app.war  owner=user group=group mode=0755 

how can use regular expression in module copy ?


i'm using ansible 1.8

you can use:

  - name: "copying war"       copy: src={{item}} dest=/folder/app.war  owner=user group=group mode=0755       with_fileglob: /tmp/delivery/app*.war 

but if there more 1 file?
recommend register stdout of previous shell command , filename there if possible.


Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -