Sébastien Aperghis-Tramoni
and 1 contributors

NAME

cfengine-tags - Generate tags files for Cfengine

SYNOPSIS

    cfengine-tags [--config /etc/rack.conf] [--tags tag1,tag2,...] [type]
    cfengine-tags { --help | --man | --version }

OPTIONS

Standard options

-c, --config path

Specify the path to the configuration file. Default to /usr/local/etc/rack.conf

-O, --path, --output-path path

Specify the path where to write the tags files. This option overrides the [cfengine-tags]/path config parameter.

-v, --verbose

Run the program in verbose mode.

Program options

-T, --tags list of tags

Specify a comma-separated list of tags to process. This option overrides the [cfengine-tags]/tags config parameter.

-A, --attrs list of attributes

Specify a comma-separated list of attributes, which values will be used as tag names. This option overrides the [cfengine-tags]/attrs config parameter.

-F, --filter list of tokens

Specify a comma-separated list of tokens, defining tags and attribute values. This option overrides the [cfengine-tags]/filter config parameter. See the corresponding documentation for more details.

-N, --class-names

Request to mogrify the host names so they are valid Cfengine class names. This was the default behaviour for versions of this program older than 1.06. This option is now needed to enable this behaviour.

Help options

-h, --help

Print a short usage description, then exit.

--man

Print the manual page of the program, then exit.

-V, --version

Print the program name and version, then exit.

DESCRIPTION

This program generate a bunch of definition files for Cfengine, one for each RackTables tag, containing the names of the devices with that tag.

The list of tags to process can be given by the [cfengine-tags]/tags config parameter or the --tags option. If no explicit list is provided, process all the tags attached to the devices.

In a similar way, a list of attributes can be given with the [cfengine-tags]/attrs config parameter or the --attrs option. The value of these attributes will be mogrified to generate additional tags.

A filter can be given, either by the [cfengine-tags]/filter config parameter or the --filter option, to filter the result devices list: only the devices with any of the given tags or attribute name-value pairs will be included. A lack of tag or attribute definition disables the filtering of that type.

CONFIGURATION

cfengine-tags(1)'s configuration is stored in rack(1)'s configuration, with the following additional definitions.

Section [cfengine-tags]

  • path - specify the path where to write the tags files; will be overridden by the --output-path option

  • type - specify the default type if none is given to the command; default to "server".

  • tags - specify the defaults tags as a comma-separated list; will be overridden by the --tags option

  • attrs - specify some attributes, as a comma-separated list, which values will be used as tag names; will be overridden by the --attrs option

  • filter - specify a filter; will be overridden by the --filter option. See "FILTER SYNTAX" for details and examples.

    When defined, only the devices with the matching tags and attributes will be included in the resulting lists. When no tag or attribute pair is defined, the filtering fot that particular type is disabled.

FILTER SYNTAX

A filter is a comma-separated list of tokens, defining tags and attribute values used as criteria to determine which device to keep. The general syntax is:

    token, token, ...

with no arbitrary limits on the number of tokens. The syntax of a token works like this:

  • a token in the form tag:name defines the tag with the given name

  • a token in the form attr=value defines the pair (attribute, value)

Examples

  • only keep the devices with the tags generic and infra (no attribute filtering):

        tag:generic, tag:infra
  • only keep the devices with the attribute Use set to prod or preprod (no tag filtering):

        Use=prod, Use=preprod
  • only keep the devices with the tag cfengine and the attribute Use set to prod or preprod:

        tag:cfengine, Use=prod, Use=preprod

AUTHOR

Sebastien Aperghis-Tramoni (sebastien@aperghis.net)