Last active
December 17, 2015 21:29
-
-
Save nightfly19/5675032 to your computer and use it in GitHub Desktop.
The variable names in global.yaml are being expanded when the template is expanded. Not sure where I need to escape something
This file contains hidden or 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
| #global.yaml | |
| 'puppet::hiera::backends': - file | |
| - yaml | |
| 'puppet::hiera::logger': console | |
| 'puppet::hiera::hierarchy': - '%{::environment}/fqdn/%{::fqdn}' | |
| - 'fqdn/%{::fqdn}' | |
| - '%{::environment}' | |
| - global | |
| 'puppet::hiera::yaml': | |
| :datadir: /var/lib/hiera | |
| #hiera.pp | |
| class puppet::hiera ( | |
| $backends = ['yaml'], | |
| $logger = ['console'], | |
| $hierarchy = ['global'], | |
| $yaml = {':datadir' => '/var/lib/hiera'}, | |
| $other = {} | |
| ) { | |
| #Puppet configuration | |
| file{'/etc/puppet/hiera.yaml': | |
| ensure => present, | |
| mode => '0660', | |
| owner => 'puppet', | |
| content => template('puppet/hiera.yaml.erb'), | |
| require => Package['puppet'], | |
| notify => $::puppet::to_notify, | |
| } | |
| } | |
| #hiera.yaml.erb | |
| <% | |
| require 'yaml' | |
| data = {:backends => @backends, | |
| :logger => @logger, | |
| :hierarchy => @hierarchy, | |
| :yaml => @yaml}.merge( @other.class == Hash ? @other : {}) | |
| -%> | |
| <%= data.to_yaml%> | |
| #evaluates to | |
| --- | |
| !ruby/sym hierarchy: | |
| - production/fqdn/rainbowdash.sagenite.net | |
| - fqdn/rainbowdash.sagenite.net | |
| - production | |
| - global | |
| !ruby/sym logger: console | |
| !ruby/sym yaml: | |
| !ruby/sym datadir: /var/lib/hiera | |
| !ruby/sym backends: | |
| - file | |
| - yaml |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment