allow passing extra_params to puppet agent #10

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
4 participants
Member

frimik commented Aug 30, 2012

Pass an array of configuration lines to add to the [agent] section of
puppet.conf:

$agent_params = ["splay = true"]

class {'::puppet':
agent_params => $agent_params,
}

Owner

GregSutcliffe commented Aug 30, 2012

I like this - we need to use it to remove some of the explicit params that people probably don't use much, and maybe implement it in other places too

Owner

GregSutcliffe commented Oct 2, 2012

So we had some debate on this on the mailing list. Looks like we were coming to the idea of a separate file, to keep the config in one place, but not puppet.conf, as foreman will treat it as an environment. Does that sound right? and if so, do you have time to update the PR?

Member

frimik commented Oct 4, 2012

Will revisit these soon
On Oct 2, 2012 3:42 AM, "Greg Sutcliffe" notifications@github.com wrote:

So we had some debate on this on the mailing list. Looks like we were
coming to the idea of a separate file, to keep the config in one place, but
not puppet.conf, as foreman will treat it as an environment. Does that
sound right? and if so, do you have time to update the PR?


Reply to this email directly or view it on GitHubhttps://github.com/theforeman/puppet-puppet/pull/10#issuecomment-9066962.

Member

skottler commented Nov 1, 2012

Any update @frimik?

Member

frimik commented Nov 5, 2012

just as a note to any readers; I think this comment thread is re: 2 pullreqs. One for the little improvement to allow extra_params in the puppet module and then the other one about extracting all the settings from the various foreman functions and report files into /etc/puppet/foreman.yml. I updated my parameters_and_yaml branch recently and will rebase this one too I guess.

allow passing extra_params to puppet agent
Pass an array of configuration lines to add to the [agent] section of
puppet.conf:

$agent_params = ["splay = true"]

class {'::puppet':
  agent_params => $agent_params,
}
Member

frimik commented Nov 5, 2012

I rebased this particular pullreq (agent_params). This one is in case you think this method is acceptable/usable to get "custom" settings onto an agent without supplying an entire custom template. One could also do it by supplying a hash with $agent_config = { section => ["param = value", "param2 = bar"] }. Not sure that's motivated, when going that complex it would perhaps be acceptable to use a template instead.

Owner

GregSutcliffe commented Nov 5, 2012

I like this - I'll test it tomorrow. I think this would let us strip some of the less-used params from the module.

@@ -21,7 +21,8 @@
$post_hook_content = $puppet::params::post_hook_content,
$post_hook_name = $puppet::params::post_hook_name,
$agent_template = $puppet::params::agent_template,
- $master_template = $puppet::params::master_template
+ $master_template = $puppet::params::master_template,
+ $agent_params = undef
@GregSutcliffe

GregSutcliffe Nov 12, 2012

Owner

Why call it "agent_params" and only put it in server.pp? Do you not want it in init.pp too? If you don't, your example in the commit log doesn't work...

@@ -29,3 +29,8 @@
environment = <%= environment %>
certname = <%= clientcert %>
server = <%= puppetmaster rescue fqdn %>
+<% if has_variable?("agent_params") and agent_params != :undef -%>
@GregSutcliffe

GregSutcliffe Nov 12, 2012

Owner

This doesn't work - the variable is $puppet::agent_params (or $puppet::server::agent_params). You need to do something like:

$params = $puppet::agent_params

in config.pp and then use the local $params variable in the template.

Contributor

vStone commented Nov 29, 2012

I would be in favour of supporting a hash for key-pair values, but I would not go as far as supporting sections since this would probably indeed confuse either puppet or foreman.

vStone commented on 89bd0a1 Nov 29, 2012

<%
    # Sanitize the variable. See if there is anything defined.
    if has_variable?('puppet::agent_params') and ! [:undef, ''].include?(scope.lookupvar('puppet::agent_params'))
      agent_params = scope.lookupvar('puppet::agent_params')
    else
      agent_params = []
    end
%>
<%  if agent_params.is_a?(String) -%>
   <%= agent_params %>
<%  elsif agent_params.is_a?(Array)
      agent_params.each do |param| -%>
    <%= param %>
<%    end -%>
<%  elsif agent_params.is_a?(Hash)
      agent_params.each do |key, value| -%>
    <%= key %> = <%= value %>
<%    end -%>
<%  end -%>

Untested and the <% %> blocks should probably be reviewed.

Owner

frimik replied Nov 29, 2012

The major disadvantage of having a lot of options is always a more complex template :/

Member

frimik commented Nov 29, 2012

could be neat, had those thoughts as well but never tried it

On Thu, Nov 29, 2012 at 9:12 AM, Jan Vansteenkiste <notifications@github.com

wrote:

How about supporting a hash with key-value pairs


Reply to this email directly or view it on GitHubhttps://github.com/theforeman/puppet-puppet/pull/10#issuecomment-10838563.

Owner

GregSutcliffe commented Jan 14, 2013

Closing this for now, @frimik let us know if you update it ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment