How can you copy directories from puppet master to the puppet client?

3,298 views
Skip to first unread message

JGonza1

unread,
Sep 11, 2012, 4:04:29 PM9/11/12
to puppet...@googlegroups.com
Is there a way to copy directories and the subdirectories under the parent directory with puppet master to puppet client? How would I do that? 

Daniel Pittman

unread,
Sep 11, 2012, 4:31:40 PM9/11/12
to puppet...@googlegroups.com
On Tue, Sep 11, 2012 at 1:04 PM, JGonza1 <jgonz...@gmail.com> wrote:
> Is there a way to copy directories and the subdirectories under the parent
> directory with puppet master to puppet client? How would I do that?

Yes: use the file server, and the `file` type with `recurse`.

http://docs.puppetlabs.com/guides/file_serving.html
http://docs.puppetlabs.com/references/latest/type.html#file

--
Daniel Pittman
⎋ Puppet Labs Developer – http://puppetlabs.com
♲ Made with 100 percent post-consumer electrons

JGonza1

unread,
Sep 11, 2012, 5:18:46 PM9/11/12
to puppet...@googlegroups.com
So if I have in my module in files the directory and all the files and directories under neath it. If the direcctory is not there I should be able to copy all of it with the syntex below.
file { "/srv/www":
      ensure => "directory",
      recurse => inf, true,
      owner => "root",
      group => "root",
      mode => 755,
     }

Daniel Pittman

unread,
Sep 11, 2012, 5:25:34 PM9/11/12
to puppet...@googlegroups.com
On Tue, Sep 11, 2012 at 2:18 PM, JGonza1 <jgonz...@gmail.com> wrote:
> So if I have in my module in files the directory and all the files and
> directories under neath it. If the direcctory is not there I should be able
> to copy all of it with the syntex below.
> file { "/srv/www":
> ensure => "directory",
> recurse => inf, true,

Either 'inf', or 'true', not both, but yes - that should do what you want.

> owner => "root",
> group => "root",
> mode => 755,

These permissions will apply to *everything* in the tree. If you omit
those statements it will copy the values from the files on the master.

JGonza1

unread,
Sep 11, 2012, 6:06:10 PM9/11/12
to puppet...@googlegroups.com
Daniel that did not work see below on the master under /etc/puppet/modules/websharedlibs/files  I have the directory /ehrweb which has the directory and files below but on the client it just creates the parent directory and nothing else, client is ct-eng-web02-devint server. My code is
[root@ct-eng-pup manifests]# more init.pp
class websharedlibs {
  file { "/opt/caretools/webapps/ehrweb":
      ensure => "directory",
      recurse => "true",

      owner => "root",
      group => "root",
      mode => 755,
     }
}
[root@ct-eng-pup manifests]#
 
[root@ct-eng-web02-devint webapps]# pwd
/opt/caretools/webapps
[root@ct-eng-web02-devint webapps]# ll ehrweb
total 0
[root@ct-eng-web02-devint webapps]#
 
[root@ct-eng-pup files]# pwd
/etc/puppet/modules/websharedlibs/files
[root@ct-eng-pup files]# ll
total 4
drwxr-xr-x. 13 root root 4096 Sep 11 14:26 ehrwe
drwxr-xr-x. 13 root root 4096 Sep 11 14:26 ehrweb
[root@ct-eng-pup files]# ll ehrweb
total 800
-rw-r--r--.  1 root root    947 Sep 11 14:26 404.html
-rw-r--r--.  1 root root    938 Sep 11 14:26 422.html
-rw-r--r--.  1 root root    948 Sep 11 14:26 500.html
drwxr-xr-x.  2 root root   4096 Sep 11 14:26 assets
-rw-r--r--.  1 root root    103 Sep 11 14:26 blank_iframe.html
-rw-r--r--.  1 root root 341157 Sep 11 14:26 ccd-schema.xsd
-rw-r--r--.  1 root root  18899 Sep 11 14:26 CCD.xsl
-rw-r--r--.  1 root root  65482 Sep 11 14:26 ccr-schema.xsd
-rw-r--r--.  1 root root 146074 Sep 11 14:26 CCR.xsl
drwxr-xr-x.  4 root root   4096 Sep 11 14:26 cdar2c32
drwxr-xr-x.  2 root root   4096 Sep 11 14:26 dev
 
Please help what am I missing?

On Tuesday, September 11, 2012 1:04:30 PM UTC-7, JGonza1 wrote:

JGonza1

unread,
Sep 11, 2012, 6:38:00 PM9/11/12
to puppet...@googlegroups.com
I made a change to include the source so the file looks like this below but now when I run puppet agent --server ct-eng-pup --test it hangs a bit but it actually works. Thanks a lot Daniel for pointing me in the right direction.
 
class websharedlibs {
  file { "/opt/caretools/webapps/ehrweb":
      ensure => "directory",
      source => "puppet:///websharedlibs/ehrweb",
      recurse => "remote",

      owner => "root",
      group => "root",
      mode => 755,
     }
}

On Tuesday, September 11, 2012 1:04:30 PM UTC-7, JGonza1 wrote:

JGonza1

unread,
Sep 11, 2012, 6:49:29 PM9/11/12
to puppet...@googlegroups.com
The only problem is it just keeps on looping around and never stops coping.

On Tuesday, September 11, 2012 1:04:30 PM UTC-7, JGonza1 wrote:
Reply all
Reply to author
Forward
0 new messages