Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

how can i execute a python script on all puppet clients.

i have added a class for the script to be executed

class curp {
       exec { "/usr/src/scripts/": }

and included it in nodes.pp

but when i execute on the remote client, it says file cannot be found ???

#client:# /usr/sbin/puppetd --test --server=puppetmasterserver
notice: //chkconfig/Package[vsftpd]/ensure: created
err: //curp/Exec[/usr/src/scripts/]/returns: change from notrun to 0 failed: Could not `find executable /usr/src/scripts/`

more edition:

i have fixed the configissue by creating a fileserver,

class curp {
       file { '/opt/files/':
          ensure => present,
          owner => 'root',
          group => 'root',
          mode => '0755',
          source => 'puppet:///modules/files/',
       exec { '/opt/files/': require => File['/opt/files/'] }


but the script fails with a dependency, i cant find anywhere else in the log to what it is related to...

err: //curp/File[/opt/files/]: Failed to retrieve current state of resource: Could not retrieve information from source(s) puppet:///modules/files/ at /etc/puppet/manifests/templates.pp:114
notice: //curp/Exec[/opt/files/]: Dependency file[/opt/files/] has 1 failures
warning: //curp/Exec[/opt/files/]: Skipping because of failed dependencies

Any ideas?


problem was /opt/files did not exist on the client servers, it works when the remote directory is available

share|improve this question
So what does ls -l /usr/src/scripts/ say? – womble Aug 23 '11 at 10:50
This is actually what mcollective is for. – pfo Aug 23 '11 at 11:12
You have forget the coma after two lines : source => "puppet:///modules/curp/" }, exec { "/usr/src/scripts/": }, – Razique Aug 23 '11 at 11:30
source => 'puppet:///puppet/files/', --> what does your puppet directory structure look like? – quanta Aug 23 '11 at 12:44
the file is located in /etc/puppet/modules/files/ – krisdigitx Aug 23 '11 at 13:15
up vote 2 down vote accepted

The error:

Failed to retrieve current state of resource: Could not retrieve information from source(s)

means that puppet could not retrieve the file from the puppetmaster. The second error is because it won't attempt to execute the file if it can't retrieve the file.

I think you'll find this page useful as you learn puppet: The error you are hitting here is the top one on that page. It also has some more information about where puppet expects files to be. The URLs don't necessarily match up directly with the file system paths.

In general, when debugging error messages, fix the first one first. It's quite common for later error messages to be caused by earlier ones.

share|improve this answer
the file is located in /etc/puppet/modules/files/ – krisdigitx Aug 23 '11 at 13:15
The URL you have in your error message: puppet:///modules/files/ will be trying to find the file in /etc/puppet/modules/modules/files/files/ on the puppetmaster. If the file is in a module called "curp" the URL you want is puppet:///curp/ – Ladadadada Aug 23 '11 at 13:23
thanks man.. worked.. – krisdigitx Aug 23 '11 at 14:38

You should use the recommended directory structure, something like this:

|-- environments
|   |-- development
|   |   `-- modules
|   `-- testing
|       `-- modules
|-- manifests
|   |-- defines
|   |   `-- netinstall.pp
|   |-- nodes.pp
|   `-- site.pp
|-- modules
|   |-- python
|   |   |-- files
|   |   |-- manifests
|   |   `-- templates

put your class into modules/python/manifests, the into modules/python/files, and use source like belows:

source => 'puppet:///modules/python/',
share|improve this answer

you have to add a file statement :

file { "curp": name => "/usr/src/scripts/", ensure => file, source => "puppet:///modules/your_module/" }


class curp { exec { "/usr/src/scripts/": } require => {File["curp"]}, }

It means the statement File will send the file to all puppet nodes which use that module.

share|improve this answer
You don't need a file statement if the script's already on the system, and you really don't need an explicit require, because Puppet will autorequire if needed. – womble Aug 23 '11 at 10:57
Good to know, thanks. I've always thought that I should use the "require", so I make sure that the function is being run without error. – Razique Aug 23 '11 at 10:59

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.