ReleaseEngineering/PuppetAgain/Modules/config

From MozillaWiki
Jump to navigation Jump to search

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

Summary

We handle config variables via puppets extlookup() 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 extlookup() function at all.

The csv files are stored in the modules/extlookup/ dir of our whole repo (source). Our search order is as follows, first->last.

  1. local-config.csv
    optional, preferably symlinked to an in-repo site specific config file (e.g. seamonkey-config.csv)
  2. default-config.csv
    stored directly in puppet, and should contain reasonable defaults.
  3. moco-config.csv, seamonkey-config.csv
    User-specific configuration (more can be added). These are generally linked to by local-config.csv.
  4. supplied-config.csv
    optional lower precedence than local-config.csv, this can be used for automated creation of config. Within mozilla we use this to inject configuration from the puppet instance that builds our puppetmasters (don't think about that too hard!)
  5. secrets.csv
    Necessarily not stored in hg as this file contains secrets (e.g. password hashes). For simplicity we have a secrets.csv.in file in this directory that can be copied over and have the secrets added.

Manifests

Config

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

puppet_notif_email
The e-mail address or list to send errors of the puppet daemon to. (Defaults to dustin@mozilla.com)
puppet_server
The server-name of the puppet master we should connect to. Qualified or Unqualified hostnames are acceptable. (Defaults to puppet)
yum_server
The server name of the static yum-repo server (we currently expect the yum repo's to be found at http://${yum_server}/repos/yum/) (Defaults to the value of puppet_server)
builder_username
The username for the build and test slaves (Defaults to cltbld)
nrpe_allowed_hosts
A comma-separated list of IPs from which NRPE should accept check requests (added in bug 733545)

Config::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 strings (note use of empty namespace designation)

Hash is ${::config::secrets::builder_password}

Variables

root_pw_hash
linux md5 password hash for the root password (No Default)
builder_pw_hash
linux md5 password hash for the builder user (No Default)