Puppet copy not working

51 views
Skip to first unread message

Nishantu Kumar

unread,
Jul 11, 2014, 5:51:38 AM7/11/14
to puppet...@googlegroups.com
Hello All,

I have successfully configured puppet master and agent on two machines and i have created a file in manifest directory to copy a file from master server to agent machine but its not copying and throwing some error,  can anyone tell me and share with me the procedure to copy file from master server to client machine.

Thanks in advance
Nishantu

Rich Burroughs

unread,
Jul 11, 2014, 2:09:44 PM7/11/14
to puppet...@googlegroups.com
http://docs.puppetlabs.com/guides/file_serving.html


Rich
--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/d9bbef52-a805-46c9-ac5f-437193e27baf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Peter Meier

unread,
Jul 11, 2014, 5:30:03 PM7/11/14
to puppet...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 07/11/2014 08:09 PM, Rich Burroughs wrote:
> http://docs.puppetlabs.com/guides/file_serving.html

If you intend to get more help than this, it might be worth thinking
about what others could get from your statement "it throws some error".

Btw: It works for me... ;-) ...at least on my machine...

~pete

-----BEGIN PGP SIGNATURE-----
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEARECAAYFAlPAV0IACgkQbwltcAfKi38OJwCdGNmtj7i9RzjxcxHcOwOKDCc3
R6EAoLZ0RNqc/wDEUNCU00K2AWNnzZHj
=ETmW
-----END PGP SIGNATURE-----

Dejan Golja

unread,
Jul 12, 2014, 6:02:35 PM7/12/14
to puppet...@googlegroups.com
Hey Nishantu,

please share some output and at least the manifests content.

Nishantu Kumar

unread,
Jul 14, 2014, 3:33:58 AM7/14/14
to puppet...@googlegroups.com
Hi all,

I have created a file in "/etc/puppet/manifests/classes" as copy.pp and contents are :-

# copy a remote file to /etc/sudoers
file { "/etc/sudoers":
    mode   => 440,
    owner  => root,
    group  => root,
    source => "puppet:///home/ubuntu"
}

and i run the command on agent machine as:-  sudo puppet agent -t

info: Caching catalog for ip-10-148-160-84.ap-southeast-1.compute.internal
info: Applying configuration version '1405071378'
notice: Finished catalog run in 0.05 seconds


but its not copying a file from master server to agent machine.

Can anyone pls share with me a manifest for copying a file from master server to agent machine and pls share the procedure to implement that. as i am new on puppet.

Thanks in advance
-Nishantu

Yanis Guenane

unread,
Jul 14, 2014, 9:25:27 AM7/14/14
to puppet...@googlegroups.com
Hi Nishantu,

I think if you haven't done the Learn Puppet tutorial you should start
there http://docs.puppetlabs.com/learning/.

Based on your previous email, you expect your manifest to be
/etc/puppet/manifests/classes/copy.pp, but if you haven't specify it to
be, your default manifest will be /etc/puppet/manifests/site.pp.

On your master, simply run `puppet config print manifest` to have the
actual value.

Hence you should adapt it in your puppet.conf

--
Yanis Guenane

signature.asc

jcbollinger

unread,
Jul 14, 2014, 10:18:29 AM7/14/14
to puppet...@googlegroups.com


On Monday, July 14, 2014 2:33:58 AM UTC-5, Nishantu Kumar wrote:
Hi all,

I have created a file in "/etc/puppet/manifests/classes" as copy.pp and contents are :-

# copy a remote file to /etc/sudoers
file { "/etc/sudoers":
    mode   => 440,
    owner  => root,
    group  => root,
    source => "puppet:///home/ubuntu"
}

and i run the command on agent machine as:-  sudo puppet agent -t

info: Caching catalog for ip-10-148-160-84.ap-southeast-1.compute.internal
info: Applying configuration version '1405071378'
notice: Finished catalog run in 0.05 seconds


but its not copying a file from master server to agent machine.

Can anyone pls share with me a manifest for copying a file from master server to agent machine and pls share the procedure to implement that. as i am new on puppet.



There are at least three problems there:
  1. You defined a resource, but you did so at top level.  Pretty much every resource declaration should be in a class or in a type definition.
  2. Even if your resource had been declared in a class, you did nothing to assign it to your node.  Classes define pieces of configuration that can be assigned to nodes, but most people do not want all their nodes configured identically, so Puppet only applies a given class to a target node if you tell it that it must do so.
  3. Your file declaration looks highly questionable.  Unless you have configured a custom "home" mount point in your Puppet file serving configuration (which I am pretty confident you have not done), the agent would fail trying to apply that File resource.
  4. Although it's not a fundamental problem, you really ought to put all your manifests into modules.  Doing so will make your life easier in multiple ways.
In addition to the file serving docs Rich referenced, it looks like you would really benefit from a general introduction to Puppet, such as the one Yanis pointed you towards.  Alternatively, if you want to try to come up to full speed faster, then you could go straight to the Puppet Language Reference, which is pretty clear and readable.

Here's something to get you started, though:

/etc/puppet/modules/site/manifests/sudoers.pp:
----
class site::sudoers {

  file { '/etc/sudoers':
    mode   => 440,
    owner  => root,
    group  => root,
    source => "puppet:///modules/site/sudoers"
  }
}


/etc/puppet/modules/site/files/sudoers:
----
<the desired content for your sudoers file>


/etc/puppet/manifests/site.pp:
----
node default {
  include 'site::sudoers'
}


That creates a simple module named "site", and in it a class "sudoers" which manages file /etc/sudoers on nodes to which it is assigned.  It does so by ensuring that the sudoers file content exactly matches that provided by another file in the module.  Finally, the site.pp file (not part of the "site" module) says that nodes for which there is no other, more specific node block are assigned class 'site::sudoers'.


John

Nishantu Kumar

unread,
Jul 16, 2014, 12:42:44 AM7/16/14
to puppet...@googlegroups.com
Thanks for your support


On Friday, July 11, 2014 3:21:38 PM UTC+5:30, Nishantu Kumar wrote:
Reply all
Reply to author
Forward
0 new messages