Ask Your Question

How do I copy files from Master to Client?

asked 2014-09-11 13:07:22 -0500

GLN gravatar image

I am new to puppet and trying to copy files (the content of a directory) from the master to the client. I am using the learning pupet VMs. On the master under /etc/puppetlabs/puppet/modules I created a directory called testcopy and then created a a subdirectory called files and then a directory called filestomove that has 1 text file called file.txt

This is my directory tree image description

I did the following test on my master. under /tmp directory I created this file copy.pp and run it on the Master and it is working just fine

image description

I try to run the exact same file on the agent and I get errors.

image description

I am trying to follow example i saw online and I must be missing something but I am not sure what. Has anybody tested this before and know what I am doing wrong? Thanks GLN

edit retag flag offensive close merge delete


Does /etc/puppetlabs/modules/copy/testcopy/filestomove/file.txt exist on the agent? Probably not. You probably want to create a group on your puppet master and assign the class, copy, and the node, agent1, to this group and then execute "puppet agent -t" on agent1.

Red Cricket gravatar imageRed Cricket ( 2014-09-12 01:18:38 -0500 )edit

Thanks. I will try it. What I ended up doing was creating a manifest with init.pp that looked like this class testcopy { file {'/opt/movedfiles/': source => "puppet:///modules/testcopy/filestomove", ensure => "directory", recurse => "true", } } when I deploy the class it works

GLN gravatar imageGLN ( 2014-09-12 12:55:36 -0500 )edit

GLN sir i m getting the same issue please tell me how to solve it.

R.S kaushik gravatar imageR.S kaushik ( 2016-02-15 02:28:16 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2018-08-10 12:47:38 -0500

binford2k gravatar image

The puppet:/// scheme has a spot for the server in there. It's actually puppet://<servername>/. Because you left it empty (like it almost always is) it means to source the file from the same place the code came from. This means that when you run puppet agent, the file will be sourced from the master and when you run puppet apply it will be sourced from the filesystem of the node you typed the command into.

edit flag offensive delete link more

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


Asked: 2014-09-11 11:54:56 -0500

Seen: 9,682 times

Last updated: Aug 10