Ask Your Question

New to puppet: Can not distribute files across multiple agents

asked 2015-06-18 07:54:47 -0500

Red010 gravatar image
 - Hi there,

   I am new to puppet and i am trying to distribute my /etc/hello file across
   multiple systems. I have 2 systems:  puppet

   When i run puppet cert list -all, I see both the systems.

   I made the following site.pp:

   [root@laptop-vm2 manifests]# pwd
   [root@laptop-vm2 manifests]# ls -rtl
   total 4
   -rw-r--r--. 1 root root 75 Jun 18 14:23 site.pp 
   [root@laptop-vm~/manifests]# cat site.pp 
   node default {  } 
   file { '/tmp/hello':     
   content => "Hello, world\n",

   [root@laptop-vm2 manifests]# puppet
   apply site.pp Notice: Compiled
   catalog for in
   environment production in 0.19
   seconds Notice: Finished catalog run
   in 0.32 seconds [root@laptop-vm2

   It doesnt distribute to I also tried
   adding to
   site.pp, but it doesnt distribute.

   I also tried this:

   node '' {  
   file { '/tmp/hello':     content =>
   "Hello, world\n",

   But then i get the following error:

   [root@laptop-vm2 manifests]# puppet
   apply site.pp Error: Could not find
   default node or by name with
   laptop-vm2.example, laptop-vm2' on
   node Error:
   Could not find default node or by
   name with ',
   laptop-vm2.example, laptop-vm2' on
   [root@laptop-vm2 manifests]# 

   Any help is appreciated.

edit retag flag offensive close merge delete


Please check your entries in /etc/hosts. There seems to be issue with resolving the names.

far4d gravatar imagefar4d ( 2015-06-19 05:43:11 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2015-06-19 18:01:58 -0500

GregLarkin gravatar image

There are a couple of issues here - first, your file resource is outside of the context of your node definitions, from what you've posted. Node definitions should look like this:

node '' {
  file { '/tmp/hello':
    content => "Hello, world\n",

node '' {
  file { '/tmp/hello':
    content => "Hello, world\n",

node default {
  file { '/tmp/hello':
    content => "Hello, world\n",

The next problem is that you are running puppet apply on the site.pp file. Puppet apply only enforces the catalog on the machine that you run it on, not on other machines. site.pp is usually loaded by the Puppet master when you running puppet agent on a machine, and then the master compares the node name to the list of node definitions to build the catalog.

It doesn't usually make sense to run puppet apply site.pp. You'll typically have another file in your module's tests/ or examples/ subdirectory that has a number of include and/or resource statements in it, and you'll puppet apply that file.

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: 2015-06-18 07:45:02 -0500

Seen: 49 times

Last updated: Jun 19 '15