hc - Command line tool for Hieracles
hc fqdn action [ options ]
Hieracles is a command-line tool for analysis and deep examination of Hiera
parameters in a Puppet setup. It can be used to quickly visualize, from a
local puppet (typically on a developers environment), all the Hiera params
related to a specific node.
It's used internally at Gandi and its first incarnation is
strongly tied to Gandi puppet architecture. But Hieracles tends to become,
in time, a generic Hiera overlay visualization tool.
hc command takes at minimum 2 arguments:
- fqdn
- the fqdn under which the node is known in the ENC dir
- action
- the action needs to be one of the following
- info
- provides the farm, datacenter, country associated to the given fqdn. An
extra filter can be added to limit the list. Use ruby regexp without the
enclosing slashes.
eg. hc <fqdn> info timestamps
- facts
- lists facts for a given fqdn, from puppetdb or local facts (see
configuration). An extra filter can be added to limit the list. use ruby
regexp without the enclosing slashes.
eg. hc <fqdn> facts architecture
eg. hc <fqdn> facts 'memory.*mb'
- files
- list all files containing params affecting this fqdn (in more than
commons).
- paths
- list all file paths for files with params.
- modules
- list modules included in the farm where the node is.
- params
- list params for the node matching the fqdn. An extra filter can be added
to limit the list. Use ruby regexp without the enclosing slashes.
eg. hc <fqdn> params postfix.*version
eg. hc <fqdn> params '^postfix'
eg. hc <fqdn> params 'version$'
- allparams
- same as params but including the common.yaml params (huge) Also accepts a
search string
- -v
- --version
- outputs version.
- -f format
- --format format
- outputs in the selected format. Available formats are csv, json, console,
plain, yaml and rawyaml
- Note that the difference between yaml and rawyaml is that rawyaml don't
include comments with the provenance of each params.
- -p extraparam=what,anotherparam=this
- --params extraparam=what,anotherparam=this
- makes possible to add additional params. Those params will be merged with
the ones provided in the hierafile.
- -c file
- --config file
- specify an alternative config file instead of
~/.config/hieracles/config.yaml
- -h file
- --hierafile file
- specify an alternative hierafile instead of the one stated in the
configfile.
- -b path
- --basepath path
- the basepath is prepended to the paths found in the configfile and the
hierafile. Default is ./ but you can change this using the -b option.
- -e path
- --encdir path
- encdir is where we can find the ENC definitions. It's stated in the
configfile but can be overridden by the -e option.
- -y file
- --yaml file
- use an arbitrary facts file that can be obtained with facter -y on
the given node. This is useful for having a set of default fact and test
locally what would be the consequences of switching from one environment
to another. It's also good for anticipation of how new node, that don't
have facts yet, will behave.
- -j file
- --json file
- same as the -y flag but in json format, which can be obtained on
the node with facter -j and this behave the same way. Note that the
-y has precedence on the -j in this context.
- -i
- --interactive
- if a scope var is not defined or if the file declared in hiera config is
not found, this entry is silently ignored.
This option enables the interactive mode in which
you are prompted to fill up for undefined scope variables encountered in the
hiera config file. This behavior can be made systematic by enabling
interactive: true in hieracles configuration file.
- -db
- if usedb: false is specified in the hieracles configuration file,
it cancels the calls to puppetdb and only display information according to
local data.
- -nodb
- if usedb: true is specified in the hieracles configuration file, it
forces the calls to puppetdb for gathering facts and node information.
~/.config/hieracles/config.yaml
Where sits the main hieracles configuration
A typical config file would look like:
---
basepath: /home/mose/git/puppet
classpath: farm_modules/%s/manifests/init.pp
hierafile: dev/hiera-local.yaml
encpath: enc
interactive: false
hiera(1), puppet(8), ppdb(1)
Please report any bug to https://github.com/Gandi/hieracles/issues
Copyright (c) 2015 gandi.net https://gandi.net
Hieracles is written by mose@gandi.net
https://github.com/Gandi/hieracles