Skip to content

Commit 372b795

Browse files
committed
Add note on ENC and example configuration in quickstart.yaml
1 parent fca48eb commit 372b795

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

doc/octofacts-updater.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,21 @@ octofacts-updater --config octofacts-updater.yaml --action reindex
133133

134134
:information_source: If a file or directory path starts with `.` or `..`, the path is treated as relative to the configuration file itself. This allows you to specify locations within a Puppet code repository, without regard to where on the system `octofacts-updater` is actually installed. Of course, you can also use absolute paths (starting with `/`).
135135

136+
## Using an External Node Classifier (ENC)
137+
138+
If your Puppet setup uses an external node classifier (ENC), it may supply settings in its `parameters` hash that are treated as top level variables by Puppet code (like facts), and can be accessed in Puppet manifests. For example, if your ENC sets a top level parameter `app: application_name` then in your Puppet code, `$::app` will equal "application_name". Furthermore, `%{::app}` will be interpolated in a Hiera configuration file.
139+
140+
To configure `octofacts-updater` to run your ENC when updating facts for a node, add the path to your ENC in the configuration file.
141+
142+
```title=octofacts-updater.yaml
143+
enc:
144+
path: /usr/local/sbin/enc.sh
145+
```
146+
147+
Note that per conventions, all ENCs must take exactly one parameter (the hostname) and return output in YAML format. You do not need to indicate the hostname (via `%%NODE%%` or hard-coding) when configuring the ENC, because this is assumed.
148+
149+
If the ENC returns `parameters` at the top level, these are merged in to the facts gathered for the node. In the case that the node and the ENC both contain the same key, the key from the ENC will be used.
150+
136151
## Anonymizing and rewriting facts
137152

138153
To avoid committing sensitive information into source control, and to prevent rspec-puppet tests from inadvertently contacting actual systems, `octofacts-updater` supports anonymizing and rewriting facts. For example, you might remove or scramble SSH keys, delete or hard-code facts like system uptime that change upon each run, or change IP addresses.

examples/config/quickstart.yaml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,20 @@
3131
# without explicitly naming a node, list the facts here that you would like to have indexed.
3232
# You can also specify the path to the index file. Be sure to adjust it for your site.
3333
index:
34-
file: /var/lib/jenkins/workspace/puppet/spec/fixtures/facts/octofacts-index.yaml
34+
file: ../spec/fixtures/facts/octofacts-index.yaml
35+
node_path: ../spec/fixtures/facts/octofacts
3536
indexed_facts:
37+
- app
38+
- role
3639
- virtual
3740

41+
# If you are using an external node classifier (ENC) you can import its results into octofacts
42+
# by having the octofacts-updater run the ENC as the node's facts are obtained. Anything in the
43+
# ENC's "parameters" hash will be configured as a fact and override the facts from the data source.
44+
# Provide the path to your ENC script here.
45+
# enc:
46+
# path: ./config/enc.sh
47+
3848
# This section cleans up and anonymizes facts. We have added a number of facts to this list
3949
# that contain sensitive information or change frequently. You should add any facts from your
4050
# site as needed.

0 commit comments

Comments
 (0)