#filebucket
Explore tagged Tumblr posts
zoojar · 10 years ago
Text
PUPPET: DYNAMIC FILEBUCKET SERVERS USING DALEN-PUPPETDBQUERY!
What if you could make a quick db query to see what the puppetmaster’s fqdn is?!.... 
Ok, so site.pp has some static crap in it about your puppet master and where your agent should stuff its files...
#/etc/puppetlabs/code/environments/production/manifests/site.pp # Define filebucket 'main': filebucket { 'main':  server => "puppetmaster.local", # <-- static server name :(  path   => false, }
When the agent runs and fails to find it’s filebucket (usually set to your puppet master) you get an error like this:
Error: /Stage[main]/Puppet_enterprise::Mcollective::Server/File[/etc/puppetlabs/mcollective/server.cfg]/content: change from {md5}73e68cfd79153a49de6f5721ab60657b to {md5}4a934b6c050e5196eaf71d87c81899a6 failed: Could not back up /etc/puppetlabs/mcollective/server.cfg: getaddrinfo: Name or service not known
Puppetlabs kindly documented this error here.
But what if you could make a quick db query to see what the puppetmaster’s fqdn is?! - This would be great because your site.pp would’t need to be updated per site!
So I grab the amazing dalen-puppetdbquery module from the forge and use it to locate the master, and now my site.pp becomes...
#/etc/puppetlabs/code/environments/production/manifests/site.pp # Define filebucket 'main': $puppetmaster = query_nodes('Class["puppet_enterprise::profile::master"]’)[0] filebucket { 'main':   server => "${puppetmaster}",   path   => false, }
The first element in the array is at least sure to be your puppet master (a node that got assigned the “puppet_enterprise::profile::master” class).
If you’re scaling masters then perhaps tag one?
0 notes