ReleaseEngineering/PuppetAgain/Modules/config: Difference between revisions

(Created page with "This module handles retrieving and access of the site specific config values. == Summary == We handle config variables via puppets <tt>extlookup()</tt> function, which reads da...")
 
 
(38 intermediate revisions by 6 users not shown)
Line 1: Line 1:
This module handles retrieving and access of the site specific config values.
This module handles retrieving and access of the org specific config values.


== Summary ==
= Summary =


We handle config variables via puppets <tt>extlookup()</tt> function, which reads data from keys in csv files in a directory we specify, and in the order we specify. Missing files are not errors, but missing keys (when not specified with a default here) are. We do not specify any defaults in the <tt>extlookup()</tt> function at all.
Configuration is specified in an org-specific file, <tt>manifests/$org-config.pp</tt>, which is symlinked from <tt>manifests/config.pp</tt>.  This file defines a class, "config", which inherits from "config::base", which defines all config variables.  The inherited class only needs to define variables whose values must change.


The csv files are stored in the <tt>modules/extlookup/</tt> dir of our whole repo ([http://hg.mozilla.org/build/puppet/file/default/manifests/extlookup source]). Our search order is as follows, first->last.
==Usage==
 
# <tt>local-config.csv</tt>
#: '''optional''', preferably symlinked to an in-repo site specific config file (e.g. <tt>[http://hg.mozilla.org/build/puppet/file/default/manifests/extlookup/seamonkey-config.csv seamonkey-config.csv]</tt>)
# <tt>default-config.csv</tt>
#: stored directly in puppet, and should contain defaults suiteable for MoCo (Firefox) environment, sites with different needs should store only necessary differences in <tt>local-config.csv</tt>
# <tt>secrets.csv</tt>
#: Necessarily not stored in hg as this file contains secrets (e.g. password hashes). For simplicity we have a <tt>secrets.csv.in</tt> file in this directory that can be copied over and have the secrets added.
 
== Manifests ==
=== Config ===
 
====Usage====
'''in manifests'''
'''in manifests'''
  class foo {
  class foo {
   include config
   include config
   if ($config::builder_username == '')
   if ($config::builder_username == "")
       fail("bad settings")
       fail("bad settings")
   }
   }
Line 27: Line 15:


'''in templates''' (note use of empty namespace designation)
'''in templates''' (note use of empty namespace designation)
  Hash is ${::config::builder_username}
  Username is <%= scope.lookupvar('::config::builder_username') %>
 
==== Variables ====
;'''puppet_notif_email'''
:The e-mail address or list to send errors of the puppet daemon to. ''(Defaults to <tt>dustin@mozilla.com</tt>)''
;'''puppet_server'''
:The server-name of the puppet master we should connect to. Qualified or Unqualified hostnames are acceptable. ''(Defaults to <tt>puppet</tt>)''
;'''yum_server'''
:The server name of the static yum-repo server (we currently expect the yum repo's to be found at <tt>http://${yum_server}/repos/yum/</tt>) ''(Defaults to the '''value''' of <tt>puppet_server</tt>)''
;'''builder_username'''
:The username for the build and test slaves ''(Defaults to <tt>cltbld</tt>)''
 
=== Secrets ===
The Secrets module handles all the secret config options, for clarity. It is imported directly by the config module, for simplicity throughout.
 
====Usage====
'''in manifests'''
class foo {
  include config
  if ($config::secrets::builder_password == '')
      fail("missing password")
  }
}


'''in templates''' (note use of empty namespace designation)
==Variables ==
Hash is ${::config::secrets::builder_password}
The available configuration variables are all listed in <tt>modules/config/manifests/base.pp</tt>; refer to that file for the most up-to-date information.


==== Variables ====
==Functions==
;'''root_pw_hash'''
This module also defines the <tt>secret</tt> function; see [[ReleaseEngineering/PuppetAgain/Secrets]].
:linux md5 password hash for the root password ''(No Default)''
;'''builder_pw_hash'''
:linux md5 password hash for the builder user ''(No Default)''

Latest revision as of 20:18, 7 November 2013

This module handles retrieving and access of the org specific config values.

Summary

Configuration is specified in an org-specific file, manifests/$org-config.pp, which is symlinked from manifests/config.pp. This file defines a class, "config", which inherits from "config::base", which defines all config variables. The inherited class only needs to define variables whose values must change.

Usage

in manifests

class foo {
  include config
  if ($config::builder_username == "")
     fail("bad settings")
  }
}

in templates (note use of empty namespace designation)

Username is <%= scope.lookupvar('::config::builder_username') %>

Variables

The available configuration variables are all listed in modules/config/manifests/base.pp; refer to that file for the most up-to-date information.

Functions

This module also defines the secret function; see ReleaseEngineering/PuppetAgain/Secrets.