0

I'm using Foreman (1.4) and Puppet (3.4.3). I just started using Foreman and Puppet like 4 weeks ago, so I'm new.

What I want to do is set a default path for exec resources. According to many howtos this is not a problem if you are using Puppet without Foreman, since you can put it in your site.pp.

My site.pp read as follows:

# Empty site.pp required (puppet #15106, foreman #1708)

I have tried some things like putting it in a class and

  • Include the class in any class I use with exec resources
  • Include the class in the topmost host group
  • Include the class in the host (explicit)

Nothing worked.

What worked was putting the definition in the class where I want to use some exec resources, but that is basically the same as defining the path for every exec.

Furthermore this applies also to file resources, which should have a default ignore, like ignore => '.svn'

So my question is, is there a way to do things like that with Foreman? I would love to solve this with Foreman and Puppet "as is".

4
  • 1
    The bugs (puppet #15106, foreman #1708) seem to say that a site.pp must exist, and an empty file is adequate. Those bugs don't say that the file must be actually empty of any configuration/content. I am not a foreman user, but what leads to believe that this file actually has to be empty? – Zoredache Mar 13 '14 at 18:21
  • Hmm, good point. But I'm a little shy to edit the puppet module puppet. This manages the file and puts only that line inside. And I was not aware the were bug numbers. I thougt the were versions/revisions. I'll look into that tomorrow. – Christoph Mar 13 '14 at 18:25
  • See: projects.theforeman.org/issues/1708 projects.puppetlabs.com/issues/15106 --- If the file you have is the same one referenced by github.com/theforeman/puppet-puppet/blob/master/manifests/… then replace => false, option is the critical part. Having a replace=> false means puppet will only modify that file if it didn't already exist. So edit it to be whatever you want. – Zoredache Mar 13 '14 at 20:00
  • Okay, this works like a charm and I feel a little stupid now. Side note: Puppet doesn't like german umlauts, not even in comments. – Christoph Mar 14 '14 at 8:40
1

As we discussed in the comments. Simply put your Exec defaults into your site.pp.

Any empty site.pp is created by Foreman is created because it must exist, or else there are errors. The file is only created if it doesn't exist. The contents of the file is not otherwise modified.

https://github.com/theforeman/puppet-puppet/blob/master/manifests/server/config.pp

# make sure your site.pp exists (puppet #15106, foreman #1708)
file { "${puppet::server_manifest_path}/site.pp":
  ensure  => present,
  replace => false,
  content => "# Empty site.pp required (puppet #15106, foreman #1708)\n",
  mode    => '0644',
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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