Configure the MoM to update the classifier after deploying code

This entailed configring the classifier to never sync on a
schedule.

Changing environment_timeout to unlimited for all masters.

Setting a postrun command for r10k that would update the class
information in the classifier (the update-classes endpoint).
This commit is contained in:
Nick Walker 2015-10-26 14:59:20 -07:00
parent baf376d30f
commit 92f8d2d251
4 changed files with 36 additions and 0 deletions

View File

@ -3,3 +3,8 @@ message: "This node is using common data"
#Puppet Server Tuning
puppet_enterprise::master::puppetserver::jruby_max_requests_per_instance: 10000
#pe-console-services tuning
#https://docs.puppetlabs.com/pe/latest/console_config.html#tuning-the-classifier-synchronization-period
#disable classifier scheduled sync and rely on r10k postrun command to sync the classes
puppet_enterprise::profile::consolei::classifier_synchronization_period: 0

View File

@ -2,3 +2,7 @@
git_management_system: 'gitlab'
gms_server_url: 'https://gitlab-server'
gms_api_token: 'BDkZfWWnk4LVTLHdAywd'
#setup r10k to update classes in the console after code deploy
pe_r10k::postrun:
- '/usr/local/bin/update-classes.sh'

View File

@ -0,0 +1,11 @@
#https://docs.puppetlabs.com/pe/latest/nc_update_classes.html#post-v1update-classes
CONFDIR=$(puppet master --configprint confdir)
CERT=$(puppet master --confdir ${CONFDIR} --configprint hostcert)
CACERT=$(puppet master --confdir ${CONFDIR} --configprint localcacert)
PRVKEY=$(puppet master --confdir ${CONFDIR} --configprint hostprivkey)
OPTIONS="--cert ${CERT} --cacert ${CACERT} --key ${PRVKEY}"
CONSOLE=$(awk '/server =/{print $NF}' ${CONFDIR}/console.conf)
curl -k -X POST ${OPTIONS} "https://${CONSOLE}:4433/classifier-api/v1/update-classes"

View File

@ -48,4 +48,20 @@ class profile::puppetmaster {
}
#END - Add deploy key and webhook to git management system
#Lay down update-classes.sh for use in r10k postrun_command
#This is configured via the pe_r10k::postrun key in hiera
file { '/usr/local/bin/update-classes.sh' :
ensure => file,
source => 'puppet::///modules/profile/puppetmaster/update-classes.sh',
}
#https://docs.puppetlabs.com/puppet/latest/reference/config_file_environment.html#environmenttimeout
ini_setting { "environment_timeout = unlimited":
ensure => present,
path => '/etc/puppetlabs/puppet/puppet.conf',
section => 'main',
setting => 'environment_timeout',
value => 'unlimited',
}
}