How do I copy files from Master to Client?

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

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

Comments

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 -0600 )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 -0600 )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 -0600 )edit