Ask Your Question

Can we use wild cards(*) in file resource - path and source parameters?

asked 2015-02-13 02:49:33 -0600

abhishekb gravatar image

updated 2015-02-13 11:57:05 -0600

GregLarkin gravatar image

I am trying to use

file {'/var/lib/tomcat7/webapps/EmployeeApplication-*.war':

but it's not working.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2015-02-13 13:38:13 -0600

GregLarkin gravatar image

The Puppet file resource doesn't support wildcards in that fashion, but if you're trying to recursively copy the source directory to the destination directory on the agent node, have a look at the details for the file resource's source attribute and the recurse attribute.

Alternately, if you only want to manage those WAR files and the file resource won't do exactly what you want, you may need to use an exec resource to accomplish it, something like this:

exec { 'Copy WAR files':
  command => 'cp /var/lib/tomcat7/webapps/EmployeeApplication-*.war /tmp/mywar/EmployeeApplication-*.war',
  path    => '/bin',

We recommend that people stay away from exec resources as much as possible, since you have to implement your own idempotency (NB: I did not do that in the above example), and that makes that resource type harder to use.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2015-02-13 02:49:33 -0600

Seen: 3,344 times

Last updated: Feb 13 '15