progfiguration.sitehelpers.invconf

Inventory configuration files that can be used with AgeSecretStore and MemoryHostStore

Attributes

Functions

_parse_cfgfile_argument(→ configparser.ConfigParser)

Parse a cfgfile argument into a Path and a ConfigParser

hosts_conf(...)

Read a hosts configuration file and return a MemoryHostStore

secrets_conf(...)

Read a secrets configuration file and return an AgeSecretStore

Module Contents

progfiguration.sitehelpers.invconf.CfgfileArgument
progfiguration.sitehelpers.invconf._parse_cfgfile_argument(cfg: CfgfileArgument) configparser.ConfigParser

Parse a cfgfile argument into a Path and a ConfigParser

Arguments:

cfgfile:

The path to the config file, or a ConfigParser object. If a ConfigParser, it is used directly. If a relative path, it look relative to the progfigsite package root, then relative to the current working directory.

progfiguration.sitehelpers.invconf.hosts_conf(cfg: CfgfileArgument) progfiguration.sitehelpers.memhosts.MemoryHostStore

Read a hosts configuration file and return a MemoryHostStore

Arguments:

cfgfile:

The path to the config file, or a ConfigParser object. If a ConfigParser, it is used directly. If a relative path, it look relative to the progfigsite package root, then relative to the current working directory.

An example hosts config file:

####
# Assign group membership
# You can specify more than one group by separating items with newlines or spaces
[groups]
group1 = node1
# group2 = node1 node2 node3

####
# Assign each node to a function.
# WARNING: Any node not listed here will not be visible to progfiguration,
# meaning that it cannot be deployed to, will not be in the 'universal' group, etc.
[node_function_map]
node1 = func1

####
# Set the list of roles for each function
# Roles can be separated by newlines or spaces
[function_role_map]
func1 = settz
# func2 = settz otherrole asdf etc

Hosts config files are designed to be composable with secrets config files for progfiguration.sitehelpers.invconf.secrets_conf() – the two files can be combined into one and each function will read the appropriate section(s).

progfiguration.sitehelpers.invconf.secrets_conf(cfg: CfgfileArgument) progfiguration.sitehelpers.agesecrets.AgeSecretStore

Read a secrets configuration file and return an AgeSecretStore

Arguments:

cfgfile:

The path to the config file, or a ConfigParser object. If a ConfigParser, it is used directly. If a relative path, it look relative to the progfigsite package root, then relative to the current working directory.

An example secrets config file:

[secrets]
# The controller has an age key which can be used to decrypt any secret.
# When this file is not present, progfiguration will still work,
# but activities that require the secret key will throw errors.
controller_age_path = /path/to/controller.age

# We must hard code the public key in this file as well,
# so that it is available even when we aren't running on the controller.
controller_age_pub = paste the public key here

# The default/fallback location for the age key on each node.
node_fallback_age_path = /etc/progfiguration/node.age

Hosts config files are designed to be composable with secrets config files for progfiguration.sitehelpers.invconf.hosts_conf() – the two files can be combined into one and each function will read the appropriate section(s).