3. Minimin configuration

3.1. Fabric’s rcfile (.fabricrc)

The default location for a user’s Fabric rcfile is ~/.fabricrc.

We use it to set the following paths (with example values):

; directories to 3rd party support files
admin_support_path = /export/public/src /export/private/lib
; directories holding Puppet modules
admin_puppet_path = /etc/puppet/modules /opt/puppet/modules
; directories containing minimin .ini files
admin_cfg_path = /home/admin/etc /opt/project
; administrator's SSH home directory (ssh_home)
admin_ssh_home = /home/admin/.ssh

And we specify our active Minimin config files, to be found in one of the diretories in admin_cfg_path:

; active minimin config files (found in admin_cfg_path)
admin_cfg_include = conf1.ini conf2.ini

We also set some native Fabric options - a default fabfile so we don’t have to be in the same directory as one or provide it explicitly, and an ssh_config file to explicitly map our configured node names to their respective network addresses and keys:

; active/default fabfile
fabfile = /home/admin/proj/minimin/lib/minimin/fabfile.py
; personal/administrative ssh_config file
ssh_config_path = /home/admin/.ssh/config
; activate the ssh_config
use_ssh_config = True

3.2. Minimin INI config

3.2.1. Included config files

INI-style config files must be in one of the admin_cfg_path directories. admin_cfg_include configs are included first, followed by those provided on the commandline using --set cfg_include=.

All the config files are combined into a single, master configuration.

3.2.2. [node]

Our configuration begins with a list of nodes. Each node specifies an OS/platform:

websvr = f15
mailsvr = s10

The platform is a somewhat arbitraty identifier used to determine the relevancy of options in other sections:

pkg-rm.txt = remove package {pkg} *
pkg-rm.f15 = /bin/rpm -e {pkg}
pkg-rm.s10 = /usr/sbin/pkgrm -n {pkg}

3.2.3. [role]

Roles bundle a list of nodes and their common requirements:

; targeted node(s)
{rolename}.nodes = {node1} {node2}
; modules to copy to the node(s)
{rolename}.puppet.mods = {module1} {module2}
; target module dir
{rolename}.puppet.modpath = /etc/puppet/modules
; target site manifest
{rolename}.puppet.site = /etc/puppet/modules/prod/manifest/site.pp

An arbitrary {rolename} is used to identify a list of nodes ({rolename}.nodes) on the command line using fab -R{rolename}.

The main purpose is to determine:

  1. a list of nodes’ Puppet module dependencies ({rolename}.puppet.mods), located in admin_puppet_path,
  2. where those modules should be located on each node ({rolename}.puppet.modpath), and
  3. what site manifest should be applied on each node ({rolename}.puppet.site, which should be a site.pp manifest in one of the required modules).

You may provide a role with no nodes, perhaps for testing:

test1.puppet.mods = testmodA testmodB
test1.puppet.modpath = /etc/puppet/test/modules
test1.puppet.site = /etc/puppet/test/modules/testmodA/manifests/site.pp

..and then test the role-based configuration on a single host:

fab -Rtest1 -Htestsvr1 config

Likewise, you don’t need to provide the Puppet options if all you want is a convenient node list:

new.nodes = node1A node1B

3.2.4. [exe]

Command “aliases” are configured in the exe section:

{alias}.txt = {description}
{alias}.{os1} = {cmd1}
{alias}.{os2} = {cmd2}

The {alias}, for now, follows a {category}-{action} format, though this is only for convenient grouping by category.

Commands may require keyword values as {key}:

pkg-info.txt = information on package {pkg}
pkg-info.f15 = /bin/rpm -qi {pkg}
pkg-info.s10 = /usr/bin/pkginfo -l {pkg}

The keywords should be used in the description to make fab showexe summaries more useful.

3.2.5. [install]

Manual installs require a number of options per package ({pkgname}) and OS/platform suffix ({os}):

; helper option interpolated later
{os}.pth = /sbin:/usr/sbin:/bin:/usr/bin

; description with version and formal package name/id
{pkgname}.txt.{os} = a fantastic application MyApp 1.2-3
; pacakge file in admin_support_path
{pkgname}.src.{os} = myapp-1.2-3.tgz
; destination filename on node
{pkgname}.dst.{os} = /tmp/myapp-1.2-3.tgz
; executable path (interpolated)
{pkgname}.pth.{os} = %({os}.pth)s
; cmd to check for existence of package
{pkgname}.chk.{os} = myapp -V
; cmd to check for support requirements
{pkgname}.req.{os} = which tar
; deletion script
{pkgname}.del.{os} = #!/bin/sh
    rm -rf /opt/myapp-1.2-3
; installer script
{pkgname}.exe.{os} = #!/bin/sh
    cd /tmp && \
    tar -xzf myapp-1.2-3.tgz && \
    sh /tmp/myapp-1.2-3/install-me

The URL option isn’t used yet, but it may be handy for documentation (note the interpolation of our URL value as well as the default path):

url-sfw10 = ftp://ftp.sunfreeware.com/pub/freeware/intel/10

nc.txt.s10 = Netcat, the all-purpose network tool SMCnc
nc.url.s10 = %(url-sfw10)s/nc-110-sol10-x86-local.gz
nc.src.s10 = nc-110-sol10-x86-local.gz
nc.dst.s10 = /tmp/nc-110-sol10-x86-local.gz
nc.pth.s10 = /usr/sbin:/usr/bin
nc.req.s10 = which pkgadd pkgrm gunzip
nc.chk.s10 = /usr/local/bin/nc -h 2>&1 | grep 'v1.10'
nc.del.s10 = pkgrm SMCnc
nc.exe.s10 = #!/bin/sh
    cd /tmp && \
    gunzip nc-110-sol10-x86-local.gz && \
    pkgadd -d nc-110-sol10-x86-local all