facter_conf
Version information
This version is compatible with:
- Puppet Enterprise 2023.8.x, 2023.7.x, 2023.6.x, 2023.5.x, 2023.4.x, 2023.3.x, 2023.2.x, 2023.1.x, 2021.7.x
- Puppet >= 7.24 < 9.0.0
- , , , , , ,
Tasks:
- clear_facter_cache_data
- delete_facter_conf
Start using this module
Add this module to your Puppetfile:
mod 'jortencio-facter_conf', '1.3.0'
Learn more about managing modules with a PuppetfileDocumentation
facter_conf
A Puppet module that is used to configure facter.conf
.
For more information, please refer to Configuring Facter with facter.conf
Table of Contents
Description
facter_conf is a module for easily configuring Facter to set how it interacts with a system, configure fact caching, fact groups and facts/fact groups to block.
Setup
Beginning with facter_conf
By default, facter_conf will simply create an empty facter.conf
file.
include facter_conf
Usage
facter_conf supports the use of Hiera data for setting parameters. Please refer to REFERENCE for a list of configurable parameters.
Configure fact caching
---
facter_conf::facts_ttls:
- timezone: '30 days'
- os: '1 hour'
Configure fact caching for a custom fact group
---
facter_conf::facts_ttls:
- custom_fact_group: '30 days'
facter_conf::fact_groups:
- name: 'custom_fact_group'
facts:
- 'os.name'
- 'ec2_metadata'
Configuring all sections of facter.conf
facter_conf::facts_blocklist:
- 'file system'
- 'EC2'
- 'os.architecture'
facter_conf::facts_ttls:
- timezone: '30 days'
- os: '30 days'
facter_conf::global_external_dir:
- 'path1'
- 'path2'
facter_conf::global_custom_dir:
- 'custom/path'
facter_conf::global_no_external_facts: false
facter_conf::global_no_custom_facts: false
facter_conf::global_no_ruby: false
facter_conf::cli_debug: false
facter_conf::cli_trace: true
facter_conf::cli_verbose: false
facter_conf::cli_log_level: 'warn'
facter_conf::fact_groups:
- name: 'custom_fact_group'
facts:
- 'os.name'
- 'ssh'
The same configuration can be done as a class declaration as follows:
class { 'facter_conf':
facts_blocklist => ['file system', 'EC2', 'os.architecture'],
facts_ttls => [
{ 'timezone' => '30 days' },
{ 'os' => '30 days' },
],
global_external_dir => ['path1', 'path2'],
global_custom_dir => ['custom/path'],
global_no_external_facts => false,
global_no_custom_facts => false,
global_no_ruby => false,
cli_debug => false,
cli_trace => true,
cli_verbose => false,
cli_log_level => 'warn',
fact_groups => [
{
name => 'custom-group-name',
facts => ['os.name','ssh'],
}
],
}
Limitations
This module has only been tested with Facter versions > 4.3.1
Development
If you would like to contribute with the development of this module, please feel free to log development changes in the issues register for this project
Reference
Table of Contents
Classes
facter_conf
: A class for configuring facter.conf
Tasks
clear_facter_cache_data
: A task for clearing out facter cachedelete_facter_conf
: A task for deleting facter.conf. This is useful for when Puppet/Facter runs are failing due to a malformed/incorrect facter.conf file
Classes
facter_conf
Configures facter.conf based on settings available at https://www.puppet.com/docs/puppet/latest/configuring_facter.html
Examples
include facter_conf
Parameters
The following parameters are available in the facter_conf
class:
facter_conf_ensure
config_path
owner
group
mode
facts_blocklist
facts_ttls
global_external_dir
global_custom_dir
global_no_external_facts
global_no_custom_facts
global_no_ruby
cli_debug
cli_trace
cli_verbose
cli_log_level
fact_groups
facter_conf_ensure
Data type: Enum['present','absent']
Sets whether to ensure facter.conf is present or absent
Default value: 'present'
config_path
Data type: String[1]
Path for configuring facter.conf
Default value: '/etc/puppetlabs/facter'
owner
Data type: String[1]
Owner of facter.conf file
Default value: 'root'
group
Data type: String[1]
Group of facter.conf file
Default value: 'root'
mode
Data type: String[1]
Mode of facter.conf file
Default value: '0644'
facts_blocklist
Data type: Optional[Array[String[1]]]
Optional array for setting facts to block
Default value: undef
facts_ttls
Data type: Optional[Array[Hash]]
Optional array of hashes for setting the time to live (ttl) for given facts. This will cache the facts listed for the given duration.
Default value: undef
global_external_dir
Data type: Optional[Array[String[1]]]
Optional array of paths to search in for external facts
Default value: undef
global_custom_dir
Data type: Optional[Array[String[1]]]
Optional array of paths to search in for custom facts
Default value: undef
global_no_external_facts
Data type: Optional[Boolean]
Optional boolean. If true, prevents Facter from searching for external facts.
Default value: undef
global_no_custom_facts
Data type: Optional[Boolean]
Optional boolean. If true, prevents Facter from searching for custom facts.
Default value: undef
global_no_ruby
Data type: Optional[Boolean]
Optional boolean. If true, prevents Facter from loading its Ruby functionality.
Default value: undef
cli_debug
Data type: Optional[Boolean]
Optional boolean. If true, Facter outputs debug messages.
Default value: undef
cli_trace
Data type: Optional[Boolean]
Optional boolean. If true, Facter prints stacktraces from errors arising in your custom facts.
Default value: undef
cli_verbose
Data type: Optional[Boolean]
Optional boolean. If true, Facter outputs its most detailed messages.
Default value: undef
cli_log_level
Data type:
Optional[
Enum[
'none',
'fatal',
'error',
'warn',
'info',
'debug',
'trace'
]
]
Sets the minimum level of message severity that gets logged. Valid options: "none", "fatal", "error", "warn", "info", "debug", "trace".
Default value: undef
fact_groups
Data type:
Optional[
Array[
Struct[
{
name => String[1],
facts => Array[String[1]],
}
]
]
]
Definition of custom fact groups which can be used for blocking (blocklist) or caching (ttls) groups of facts.
Default value: undef
Tasks
clear_facter_cache_data
A task for clearing out facter cache
Supports noop? false
delete_facter_conf
A task for deleting facter.conf. This is useful for when Puppet/Facter runs are failing due to a malformed/incorrect facter.conf file
Supports noop? false
What are tasks?
Modules can contain tasks that take action outside of a desired state managed by Puppet. It’s perfect for troubleshooting or deploying one-off changes, distributing scripts to run across your infrastructure, or automating changes that need to happen in a particular order as part of an application deployment.
Tasks in this module release
clear_facter_cache_data
A task for clearing out facter cache
delete_facter_conf
A task for deleting facter.conf. This is useful for when Puppet/Facter runs are failing due to a malformed/incorrect facter.conf file
Changelog
All notable changes to this project will be documented in this file.
Release 1.3.0
Features
- Updated PDK template to version 3.2.0 (#12)
- Clean up checks for undef and update variable values for facter_conf_ensure (#13)
- Ensure sections are absent if the parameter with data for the section is undef (#14)
Bugfixes
Known Issues
Release 1.2.0
Features
- Add additional OS support
Bugfixes
Known Issues
Release 1.1.0
Features
- Updated PDK template to version 3.0.1 (#6)
- Added facts
facter_conf_exists
andfacter_cached_facts
(#7)
Bugfixes
Known Issues
Release 1.0.0
Features
Initial release - basic configuration of facter.conf
Bugfixes
Known Issues