How can i copy a directory

6,507 views
Skip to first unread message

Sumith Sudhakaran

unread,
May 23, 2011, 6:05:54 AM5/23/11
to puppet...@googlegroups.com
HI

How can i copy a directory from puppet master to client

I have tried this, but its giving error. I am using redhat 5.6 and puppet 2.6.8

file { "/usr":
ensure => "directory",
owner => "root",
group => "root",
mode => 777,
content => template("/usr/local/sbin/),

Please help me..
--
  Regards

 Sumith

Nathan Clemons

unread,
May 23, 2011, 6:27:31 AM5/23/11
to puppet...@googlegroups.com
Try looking into the recurse => true parameter.

--
Nathan Clemons
The worlds largest online language learning community



--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To post to this group, send email to puppet...@googlegroups.com.
To unsubscribe from this group, send email to puppet-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.

Denmat

unread,
May 23, 2011, 6:47:08 AM5/23/11
to puppet...@googlegroups.com
Hi,

You've got it a bit wrong.

Here is what I think you're trying to do:
http://docs.puppetlabs.com/guides/techniques.html#how-can-i-manage-whole-directories-of-files-without-explicitly-listing-the-files

I think if you're starting out, you should try something simpler and less likely to destroy your system :)

http://docs.puppetlabs.com/learning/manifests.html#resource-declarations

For complete file type reference:
http://docs.puppetlabs.com/references/stable/type.html#file

content => template("/usr/local/sbin/),

That does not work like you think it does. It is for file templates using ERB. For recursive directories you need something like:

source => puppet:///module/name/somedirectory

Cheers,
Den

Sumith Sudhakaran

unread,
May 23, 2011, 7:08:54 AM5/23/11
to puppet...@googlegroups.com
Hi,

Now i am getting error like:

err: /Stage[main]//File[/usr/local/sbin]: Failed to generate additional resources using 'eval_generate': Error 400 on SERVER: Not authorized to call search on /file_metadata/usr/local/sbin with {:recurse=>true, :links=>"manage", :checksum_type=>"md5"}
--
  Regards

 Sumith

Aaron Grewell

unread,
May 23, 2011, 10:08:15 AM5/23/11
to puppet...@googlegroups.com

You'll have to copy the entire contents of /usr into the Puppet tree to do this, you can't serve it in place.  I wouldn't do what you're doing anyway.  Puppet is great for serving config files but for serving all of /usr I'd choose either NFS or rsync and call your sync script from Puppet.

On May 23, 2011 4:09 AM, "Sumith Sudhakaran" <sumi...@gmail.com> wrote:

Adam Heinz

unread,
May 23, 2011, 11:28:34 AM5/23/11
to puppet...@googlegroups.com
On Mon, May 23, 2011 at 10:08 AM, Aaron Grewell <aaron....@gmail.com> wrote:
> You'll have to copy the entire contents of /usr into the Puppet tree to do
> this, you can't serve it in place.  I wouldn't do what you're doing anyway.
> Puppet is great for serving config files but for serving all of /usr I'd
> choose either NFS or rsync and call your sync script from Puppet.

I find myself using something like this fairly often:

$rsync_html = "/usr/bin/rsync -a $user@$host:$svnfolder/html/
$approot/html --exclude=.svn --delete"

exec { $rsync_html:
onlyif => "test `$rsync_html --dry-run --itemize-changes | wc -l` -gt 0"
}

Reply all
Reply to author
Forward
0 new messages