Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .markdownlint.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
---
# Managed by modulesync - DO NOT EDIT
# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/

default: true

line-length:
Expand All @@ -12,3 +9,7 @@ no-inline-html:
- br

descriptive-link-text: false

table:
style: 'compact'
aligned_delimiter: true
56 changes: 29 additions & 27 deletions docs/_openfact_5x/configuring_openfact.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ toc_levels: 1
title: "Configuring OpenFact with facter.conf"
---

The `facter.conf` file is a configuration file that allows you to cache and block fact groups, and manage how OpenFact interacts with your system. There are three sections: `facts`, `global` and `cli`. All sections are optional and can be listed in any order within the file.
The `facter.conf` file is a configuration file that allows you to cache and block fact groups, and manage how OpenFact interacts with your system. There are three sections: `facts`, `global` and `cli`.
All sections are optional and can be listed in any order within the file.

When you run OpenFact from the Ruby API, only the `facts` section and limited `global` settings are loaded.

Example facter.conf file:

~~~
~~~yaml
facts : {
blocklist : [ "file system", "EC2" ],
ttls : [
Expand All @@ -33,15 +34,18 @@ cli : {
}
~~~

### Location
## Location

OpenFact does not create the `facter.conf` file automatically, so you must create it manually, or use a module to manage it. OpenFact loads the file by default from `/etc/puppetlabs/facter/facter.conf` on *nix systems and `C:\ProgramData\PuppetLabs\facter\etc\facter.conf` on Windows. Or, you can specify a different default with the `--config` command line option:
OpenFact does not create the `facter.conf` file automatically, so you must create it manually, or use a module to manage it.
OpenFact loads the file by default from `/etc/puppetlabs/facter/facter.conf` on *nix systems and `C:\ProgramData\PuppetLabs\facter\etc\facter.conf` on Windows.
Or, you can specify a different default with the `--config` command line option:

`facter --config path/to/my/config/file/facter.conf`

### `facts`

This section of `facter.conf` contains settings that affect fact groups. A fact group is a set of individual facts that are resolved together because they all rely on the same underlying system information. When you add a group name to the config file as a part of either of these `facts` settings, all facts in that group will be affected. Currently only built-in facts can be cached or blocked.
This section of `facter.conf` contains settings that affect fact groups. A fact group is a set of individual facts that are resolved together because they all rely on the same underlying system information.
When you add a group name to the config file as a part of either of these `facts` settings, all facts in that group will be affected. Currently only built-in facts can be cached or blocked.

Settings:

Expand All @@ -53,13 +57,16 @@ Settings:

* Cached facts are stored as JSON in `/opt/puppetlabs/facter/cache/cached_facts` on *nix and `C:\ProgramData\PuppetLabs\facter\cache\cached_facts` on Windows.

Caching and blocking facts is useful when OpenFact is taking a long time and slowing down your code. When a system has a lot of something --- for example, mount points or disks --- OpenFact can take a long time to collect the facts from each one. When this is a problem, you can speed up OpenFact’s collection by either blocking facts you’re uninterested in (`blocklist`), or caching ones you don’t need retrieved frequently (`ttls`).
Caching and blocking facts is useful when OpenFact is taking a long time and slowing down your code. When a system has a lot of something - for example, mount points or disks - OpenFact can take a long time
to collect the facts from each one.
When this is a problem, you can speed up OpenFact’s collection by either blocking facts you’re uninterested in (`blocklist`), or caching ones you don’t need retrieved frequently (`ttls`).

#### Example

To see a list of valid group names, from the command line, run `facter --list-block-groups` or `facter --list-cache-groups`. The output shows the fact group at the top level, with all facts in that group nested below.
To see a list of valid group names, from the command line, run `facter --list-block-groups` or `facter --list-cache-groups`.
The output shows the fact group at the top level, with all facts in that group nested below.

~~~
~~~text
$ facter --list-block-groups
EC2
- ec2_metadata
Expand All @@ -72,40 +79,35 @@ file system

If you want to block any of these groups, add the group name to the `facts` section of `facter.conf`, with the `blocklist` setting.


~~~
~~~yaml
facts : {
blocklist : [ "file system" ],
}
~~~

Here, the "file system" group has been added, so the `mountpoints`, `filesystems`, and `partitions` facts will all be prevented from loading.


### `global`

The `global` section of `facter.conf` contains settings to control how OpenFact interacts with its external elements on your system.

Setting | Effect | Default
---------------|---------------------------------------------------------------|--------
`external-dir` | A list of directories to search for external facts. |
`custom-dir` | A list of directories to search for custom facts. |
`no-external`* | If true, prevents OpenFact from searching for external facts. | `false`
`no-custom`* | If true, prevents OpenFact from searching for custom facts. | `false`
`no-ruby`* | If true, prevents OpenFact from loading its Ruby functionality. | `false`
| Setting | Effect | Default |
| ------- | ------ | ------- |
| `external-dir` | A list of directories to search for external facts. | |
| `custom-dir` | A list of directories to search for custom facts. | |
| `no-external`* | If true, prevents OpenFact from searching for external facts. | `false` |
| `no-custom`* | If true, prevents OpenFact from searching for custom facts. | `false` |
| `no-ruby`* | If true, prevents OpenFact from loading its Ruby functionality. | `false` |

\*Not available when you run OpenFact from the Ruby API.

### `cli`

The `cli` section of `facter.conf` contains settings that affect OpenFact’s command line output. All of these settings are ignored when you run OpenFact from the Ruby API.


Setting | Effect | Default
----------------|--------------------------------------------------|-------
`debug` | If true, OpenFact outputs debug messages. | `false`
`trace` | If true, OpenFact prints stacktraces from errors arising in your custom facts. | `false`
`verbose` | If true, OpenFact outputs its most detailed messages. | `false`
`log-level` | Sets the minimum level of message severity that gets logged. Valid options: “none”, “fatal”, “error”, “warn”, “info”, “debug”, “trace”. | “warn”


| Setting | Effect | Default |
| ------- | ------ | ------- |
| `debug` | If true, OpenFact outputs debug messages. | `false` |
| `trace` | If true, OpenFact prints stacktraces from errors arising in your custom facts. | `false` |
| `verbose` | If true, OpenFact outputs its most detailed messages. | `false` |
| `log-level` | Sets the minimum level of message severity that gets logged. Valid options: “none”, “fatal”, “error”, “warn”, “info”, “debug”, “trace”. | “warn” |
Loading
Loading