Ask Your Question
0

How to copy directory from master to hosts

asked 2016-03-17 15:52:31 -0500

JamesHailey gravatar image

I have been trying to copy a directory from my master to different hosts. I have a script that checks out a code and puts it in certain directory. My template script looks like below.

#!/bin/bash
export CVSROOT=:pserver:anonymous@server101:2401/cvs/PXI/
cvs checkout -r 2_a Jcode
mv  Jcode /etc/example/puppettest/
Now I want to copy this Jcode to my hosts.
edit retag flag offensive close merge delete

Comments

You want to know how to take a directory on your puppet master, 'serve' it out, and use something like a recursive file resource to put those files in place on your hosts?

DarylW gravatar imageDarylW ( 2016-03-17 23:46:28 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2016-03-18 00:10:16 -0500

DarylW gravatar image

In your above example, your script puts the files you want to serve into /etc/example/puppettest/

What we want to do next is to set up that location and use the puppetmaster's built in file serving.

See Serving Files from Custom Mount points in the official docs.

It looks like in your case, if we (insecurely) open up the file serving to anyone, You would want something that looks like the following.

#/etc/puppet/fileserver.conf
[mount_point]
    path /etc/example/puppettest
    allow *

I believe this will allow you to specify a file resource similar to

file{'/shared':
  ensure => directory,
  recursive => true,
  source => 'puppet:///mount_point/',
}

I'm not working directly with a puppet master, and I haven't used that functionaily before.. I'll update my answer when I get a chance to try it out.

edit flag offensive delete link more

Comments

1

It works well. Thank you.

JamesHailey gravatar imageJamesHailey ( 2016-03-21 16:33:01 -0500 )edit

Glad I could help!

DarylW gravatar imageDarylW ( 2016-04-11 21:10:01 -0500 )edit

Appreciate it. Please also check my latest question. That has been killing me.

JamesHailey gravatar imageJamesHailey ( 2016-05-25 09:36:40 -0500 )edit

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

Stats

Asked: 2016-03-17 15:52:31 -0500

Seen: 82 times

Last updated: Mar 18 '16