What behavior are you getting?
The recurse => 1 means it should only get the first level of that directory,
I think you want recurse => true.
On Wed, Sep 17, 2008 at 5:02 PM, pfleming <[EMAIL PROTECTED]> wrote:
>
> Hi, I'm trying to manage war files on several tomcat servers. Here is
> what I'm trying to do:
>
> I have a source directory with war files that I want to sync to the
> nodes. The nodes mount this directory via nfs.
> When a change is detected I want to copy the war files from the nfs
> share to /webapps, stop tomcat, remove any directories in /webapps and
> restart tomcat.
>
> The part that is hanging me up is the use of the file resource on
> directories. It does not seem to copy the files. I can get it to work
> if I use it for 1 file but not the whole directory. Here is my def:
>
> # make sure the NFS directory is mounted under /dist
> class prep_puppet_nfs {
> file { nfs-dist:
> name => "/dist",
> ensure => directory,
> }
> mount { puppet-nfs:
> ensure => mounted,
> device => "$servername:/etc/puppet/dist/packages",
> fstype => "nfs",
> options => "ro",
> name => "/dist",
> subscribe => File[nfs-dist]
> }
> }
>
> define war_download($tomcat_version, $subdir) {
>
> $tomcat_major_v = $tomcat_version ? {
> "6.0.18" => "6",
> default => "6",
> }
>
> file { "/home/tomcat/apache-tomcat-$tomcat_version/webapps":
> source => "/dist/tomcat-wars/$subdir",
> owner => "tomcat",
> group => "tomcat",
> recurse => 1,
> checksum => md5,
> replace => true;
> }
>
> exec { stop_tomcat_war:
> command => "/sbin/service tomcat$tomcat_major_v stop",
> path => "/usr/bin:/usr/sbin:/bin",
> user => root,
> group => root,
> refreshonly => true,
> subscribe => File["/home/tomcat/apache-tomcat-$tomcat_version/
> webapps"],
> }
>
> exec { remove_war_dir:
> # removes just directories
> command => "find /home/tomcat/apache-tomcat-$tomcat_version/
> webapps/* -type d | awk '/.\//' | xargs rm -rf",
> cwd => "/home/tomcat/apache-tomcat-$tomcat_version/webapps",
> path => "/usr/bin:/usr/sbin:/bin",
> user => root,
> group => root,
> subscribe => Exec['stop_tomcat_war'],
> }
>
> exec { start_tomcat_war:
> command => "/sbin/service tomcat$tomcat_major_v start",
> path => "/usr/bin:/usr/sbin:/bin",
> user => root,
> group => root,
> subscribe => Exec['remove_war_dir'],
> }
>
> }
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en
-~----------~----~----~----~------~----~------~--~---