Ask Your Question
1

How Can I Copy Client Files to A Puppet Master?

asked 2013-07-02 09:22:32 -0500

linuxer gravatar image

I'd like to copy client file(s) to a directory on the Puppet master for processing. What is the easiest way to do this? I've Googled a bit and can't find an answer. Thanks in advance.

edit retag flag offensive close merge delete

Comments

Please supply more details. Do you want files to be copied during a Puppet sync? Where are the files stored that you're trying to copy? Explain your entire workflow ...(more)

Ancillas gravatar imageAncillas ( 2013-07-02 12:39:00 -0500 )edit

Hi Ancillas, Here's an example: I have a script that creates hostname.csv file in the /usr/local/csvfiles/ directory of all of my Puppet clients (/usr/local/csvfiles ...(more)

linuxer gravatar imagelinuxer ( 2013-07-02 14:20:30 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted
2

answered 2013-07-02 17:52:14 -0500

GregLarkin gravatar image

updated 2013-07-03 10:02:53 -0500

Since the files are not related to Puppet, I'm assuming the fact that you are copying them to the Puppet master can be safely ignored.

Therefore, you can use a simple Exec to scp the files to the Puppet master. You may want to set up password-less public key authentication to make this easier.

Once you do that, this should work on each of your agents:

exec { "copy_csv_file":
    command => "/usr/bin/scp /usr/local/csvfiles/${::fqdn}.csv csvuser@puppetmaster.local:/usr/local/csvprocess/",
}

NB: Replace "csvuser@puppetmaster.local" with the proper value for your server.

If you have a ... (more)

edit flag offensive delete link more

Comments

Thanks, Greg.

linuxer gravatar imagelinuxer ( 2013-07-03 11:33:18 -0500 )edit
0

answered 2013-07-03 11:06:35 -0500

Ancillas gravatar image

Puppet doesn't natively have a method of transferring files from clients to the master. You need to use your own transport for this, and invoke it from the client when it is applying its catalog.

The simplest solution might be to have Puppet setup a cron job that then executes a simple script every 15 minutes that attempts to either a) rsync the file or b) scp the file. Puppet creates cron jobs using Cron resources.

It would be nice if Puppet allowed this sort of data transfer without requiring a shell command so that you wouldn't have ... (more)

edit flag offensive delete link more

Comments

Thanks, Ancillas.

linuxer gravatar imagelinuxer ( 2013-07-03 11:33:29 -0500 )edit

I have actually run into wishing for this exact feature. I am attempting to build some IPA servers which generate GPG keys. These files are created locally on the servers and I need to be able to distribute them to the puppet master to allow puppet to distribute them out to the clients.

John Baird gravatar imageJohn Baird ( 2014-05-22 12:15:08 -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: 2013-07-02 09:22:32 -0500

Seen: 1,939 times

Last updated: Jul 03 '13