Move hiera.yaml to avoid file-sync overwriting it

File sync appears to sync everything in the $codedir which
inlcudes hiera.yaml.  When managing hiera.yaml with puppet code
you don't want file sync to overwrite its contents.  So, I'm
moving it out of $codedir and removing the original hiera.yaml
to avoid confusion for users investigating later.
This commit is contained in:
Nick Walker 2015-12-11 18:22:22 -08:00
parent 5dcdf01963
commit b8d4980f86

View File

@ -1,18 +1,36 @@
class profile::puppetmaster { class profile::puppetmaster {
$hiera_yaml = "${::settings::confdir}/hiera.yaml"
class { 'hiera': class { 'hiera':
hierarchy => [ hierarchy => [
'virtual/%{::virtual}', 'virtual/%{::virtual}',
'nodes/%{::trusted.certname}', 'nodes/%{::trusted.certname}',
'common', 'common',
], ],
hiera_yaml => '/etc/puppetlabs/code/hiera.yaml', hiera_yaml => $hiera_yaml,
datadir => '/etc/puppetlabs/code/environments/%{environment}/hieradata', datadir => '/etc/puppetlabs/code/environments/%{environment}/hieradata',
owner => 'pe-puppet', owner => 'pe-puppet',
group => 'pe-puppet', group => 'pe-puppet',
notify => Service['pe-puppetserver'], notify => Service['pe-puppetserver'],
} }
ini_setting { 'puppet.conf hiera_config' :
ensure => present,
path => "${::settings::confdir}/puppet.conf",
section => 'master',
setting => 'hiera_config',
value => $hiera_yaml,
notify => Service['pe-puppetserver'],
}
#remove the default hiera.yaml from the code-staging directory
#after the next code manager deployment it should be removed
#from the live codedir
file { '/etc/puppetlabs/code-staging/hiera.yaml' :
ensure => absent,
}
#Lay down update-classes.sh for use in r10k postrun_command #Lay down update-classes.sh for use in r10k postrun_command
#This is configured via the pe_r10k::postrun key in hiera #This is configured via the pe_r10k::postrun key in hiera
file { '/usr/local/bin/update-classes.sh' : file { '/usr/local/bin/update-classes.sh' :