On Tuesday, March 15, 2016 at 3:50:28 PM UTC+1, jcbollinger wrote: > > > > On Monday, March 14, 2016 at 11:23:53 AM UTC-5, Jelle Smet wrote: >> >> Hi list, >> >> >> I have a Puppet module (internal to the company) which makes use of >> exported resources. >> The exported resource data stored in PuppetDB is used to configure an >> external application. >> > > > That sounds like an odd way to go about it. One would normally export > resources that directly configure the external application, one way or > another. Details vary greatly with nature of the application that needs to > be configured, of course. >
So we have an internal restful service which has to be configured by submitting JSON data into the appropriate api endpoints. The JSON data can be constructed from data stored in PuppetDB. We have a process which reads the content of puppetdb, constructs the JSON and submits that to the necessary api end points of the restful webservice. The problem with this approach is that the middleware process (responsible for reading puppetdb, converting & submitting the data to the api endpoint) continuously needs to read puppetdb for added and removed hosts. This is simply not a very practical thing to do and causes a lot IO whilst nothing needs to be done. The idea is to trigger this middleware to read from PuppetDB if the exported resources of a host have changed. Because only then it needs to update the configuration in the restful interface. That would be better because you don't need to continuously scrape puppetdb for changes. > I'm looking for a way to notify this external service in order to trigger >> it load the stored exported resources from PuppetDB. >> If the "trigger" would be a log (syslog) event that would already be >> sufficient to work with. >> >> I have found 3 ways to achieve this, but for different reasons I'm not >> allowed to use them: >> >> >> 1. Use a Postgress trigger on the PuppetDB database which generates >> an event in case data changes. >> >> 2. https://github.com/ryanuber/puppet-tell. >> >> 3. An exec of the "/usr/bin/logger" command with "*refreshonly*" >> which subscribes to a a file resource writing the exported resources to a >> file. >> The data written to the file would then have to be the same as the >> exported resources. >> This would mean, if the "exported resources" change, the content of >> the file changes which only then produce a syslog. >> >> Unfortunately, the notify resource doesn't support "*refreshonly*". >> >> >> Are there any other constructions which would allow me to notify an >> external application in case exported resources for a host have changed? >> >> > So that we do not waste our time suggesting other non-viable alternatives, > how about giving us the constraints on what solutions you will be allowed > to use? > If puppet (agent/master/whatever puppet component) could produce a log event (like syslog) when the exported resources of a host have changed that would be great. The constraints I got: - No execs because it's considered to be bad practice. - Adding triggers to Postgress is not allowed because it requires modifications to the DB schema and might impact upgrade procedures to deviate from trom what is provided by Puppetlabs - The Puppet is not allowed to contact / have a dependency on any external networked services (local syslog would be fine though). hence no puppet-tell > So that we can get a handle on what even to consider, how about describing > what has to happen to configure the target application? > See earlier, though I don't want to elaborate too much on that part. I simply want to achieve away to generate a syslog when exported resources of a host change. Without more information, anything we might suggest would be a shot in the > dark. > I didn't want to overload the question by sticking to the essence. I hope things are a bit more clear now. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/6e486927-3033-4758-927e-7d2c30e0e867%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.