forked from Gandi/hieracles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hc.1
246 lines (215 loc) · 5.01 KB
/
hc.1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
.TH hc 1 "2015-12-05" "version 0.2.1" "Hieracles command manual"
.SH NAME
hc \- Command line tool for Hieracles
.SH SYNOPSIS
.B hc
.I fqdn
.I action
.B [
.I options
.B ]
.SH DESCRIPTION
.PP
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.
.PP
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.
.PP
hc command takes at minimum 2 arguments:
.RS 4
.IP fqdn 10
the fqdn under which the node is known in the ENC dir
.IP action
the action needs to be one of the following
.RS
.IP info 10
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.
.RS
eg. hc <fqdn> info timestamps
.RE
.IP facts 10
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.
.RS
eg. hc <fqdn> facts architecture
.RE
.RS
eg. hc <fqdn> facts 'memory.*mb'
.RE
.IP files
list all files containing params affecting this fqdn
(in more than commons).
.IP paths
list all file paths for files with params.
.IP modules
list modules included in the farm where the node is.
.IP 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.
.RS
eg. hc <fqdn> params postfix.*version
.RE
.RS
eg. hc <fqdn> params '^postfix'
.RE
.RS
eg. hc <fqdn> params 'version$'
.RE
.IP allparams
same as params but including the common.yaml params (huge)
Also accepts a search string
.RE
.RE
.SH OPTIONS
.TP
.PD 0
.B \-v
.TP
.PD
.B \-\-version
outputs version.
.TP
.PD 0
.B \-f \fRformat
.TP
.PD
.B \-\-format \fRformat
outputs in the selected format. Available formats are
csv, json, console, plain, yaml and rawyaml
.IP
Note that the difference between yaml and rawyaml
is that rawyaml don't include comments with the
provenance of each params.
.TP
.PD 0
.B \-p \fRextraparam=what,anotherparam=this
.TP
.PD
.B \-\-params \fRextraparam=what,anotherparam=this
makes possible to add additional params.
Those params will be merged with the ones provided in the hierafile.
.TP
.PD 0
.B \-c \fRfile
.TP
.PD
.B \-\-config \fRfile
specify an alternative config file instead of
~/.config/hieracles/config.yaml
.TP
.PD 0
.B \-h \fRfile
.TP
.PD
.B \-\-hierafile \fRfile
specify an alternative hierafile instead of the one
stated in the configfile.
.TP
.PD 0
.B \-b \fRpath
.TP
.PD
.B \-\-basepath \fRpath
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.
.TP
.PD 0
.B \-e \fRpath
.TP
.PD
.B \-\-encdir \fRpath
encdir is where we can find the ENC definitions. It's stated in the configfile but can be overridden by the -e option.
.TP
.PD 0
.B \-y \fRfile
.TP
.PD
.B \-\-yaml \fRfile
use an arbitrary facts file that can be obtained with
.B "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.
.TP
.PD 0
.B \-j \fRfile
.TP
.PD
.B \-\-json \fRfile
same as the
.B "-y"
flag but in json format, which can be obtained on the node with
.B "facter -j"
and this behave the same way. Note that the \-y has precedence on
the \-j in this context.
.TP
.PD 0
.B \-i
.TP
.PD
.B \-\-interactive
if a scope var is not defined or if the file declared in hiera config is not found, this entry is silently ignored.
.RS
This option enables the
.B "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
.I "interactive: true"
in hieracles configuration file.
.RE
.TP
.PD 0
.B \-db
if
.I "usedb: false"
is specified in the hieracles configuration file, it cancels the calls to puppetdb
and only display information according to local data.
.TP
.PD 0
.B \-nodb
if
.I "usedb: true"
is specified in the hieracles configuration file, it forces the calls to puppetdb
for gathering facts and node information.
.SH FILES
.I ~/.config/hieracles/config.yaml
.RS
Where sits the main hieracles configuration
.SH EXAMPLES
A typical config file would look like:
.PP
.RS
---
.RE
.RS
basepath: /home/mose/git/puppet
.RE
.RS
classpath: farm_modules/%s/manifests/init.pp
.RE
.RS
hierafile: dev/hiera-local.yaml
.RE
.RS
encpath: enc
.RE
.RS
interactive: false
.RE
.SH SEE ALSO
hiera(1), puppet(8), ppdb(1)
.SH BUGS
Please report any bug to https://github.com/Gandi/hieracles/issues
.SH AUTHORS
Copyright (c) 2015 gandi.net https://gandi.net
.LP
Hieracles is written by [email protected]
.LP
https://github.com/Gandi/hieracles