Last active
February 12, 2016 16:47
-
-
Save kreczko/3cfd094dd9e50b29f82f to your computer and use it in GitHub Desktop.
hiera with external facts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
message: "This is our common yaml file" | |
classes: | |
- site | |
- 'profile::base' | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
:backends: | |
- yaml | |
:hierarchy: | |
- "nodes/%{::fqdn}" | |
- "cluster/%{::node_info.cluster}" | |
- "groups/%{::node_info.group}" | |
- "roles/%{::node_info.role}" | |
- common | |
:yaml: | |
# datadir is empty here, so hiera uses its defaults: | |
# - /etc/puppetlabs/code/environments/%{environment}/hieradata on *nix | |
# - %CommonAppData%\PuppetLabs\code\environments\%{environment}\hieradata on Windows | |
# When specifying a datadir, make sure the directory exists. | |
:datadir: /etc/puppetlabs/code/environments/%{environment}/hieradata |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class site ( | |
$node_info = undef,) { | |
notify {"${::node_info['cluster']}": } | |
if $node_info { | |
file { [ | |
'/etc/puppetlabs/facter/', | |
'/etc/puppetlabs/facter/facts.d']: ensure => directory, } | |
file { '/etc/puppetlabs/facter/facts.d/node_info.yaml': | |
content => template("${module_name}/node_info.erb"), | |
owner => root, | |
group => root, | |
mode => '0644', | |
} | |
} | |
notify { hiera('message', 'none'): } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
site::node_info: | |
cluster: dice | |
group: service | |
role: puppetserver | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
site::node_info: | |
cluster: dice | |
group: service | |
role: puppetserver |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment