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

I've tried to google this, but haven't had any luck. My goal is to have a packaged directory with a puppet file and an accompanying directory holding file resources where I can just type puppet apply setup.pp and then puppet will do its thing.

I know that puppet's recommended workflow is to create modules and place the file resources there for copying. This is too inconvenient for me, as I don't want to have to install my modules there; I just want to be able to carry around this small package (i.e. pp file and file resources).

How can I configure my pp file to look into my sibling directory if I don't want to use absolute paths? Are there other environment variables I can manipulate to force puppet to look "in the right place"?

I saw a suggestion here that looks like it's extending Facter, but I'm just looking for something to put at the top of my pp file like this:

$basepath = exec{"/usr/bin/pwd":}


file {"/home/$title/.nanorc": source => "${basepath}/resources/.nanorc"}
share|improve this question

Puppet is just Ruby under the hood. I would try to use the inline_template function:

  content => inline_template("<%=["PWD"] + '/resources/.nanorc') %>"),
share|improve this answer
I tried this (I'm trying to copy an entire directory): source => inline_template("<%= ENV['PWD'].to_s + '/skel_dir/' %>"). The error I get is this: err: /Stage[main]//Student[test1]/File[/home/test1/]: Failed to generate additional resources using 'eval_generate: undefined method 'relative_path' for nil:NilClass err: /Stage[main]//Student[test1]/File[/home/test1/]: Could not evaluate: Could not retrieve information from environment production source(s) file:/skel_dir at /home/shared/puppet/crt_students.pp:15. Do you know how I can resolve this? – Avery Chan Jun 10 '13 at 6:16

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.