Re: How to populate files on nodes with data from a MySQL table, via Puppet

41 views
Skip to first unread message
Message has been deleted

jcbollinger

unread,
Nov 27, 2012, 3:52:18 PM11/27/12
to puppet...@googlegroups.com


On Tuesday, November 27, 2012 11:03:25 AM UTC-6, Luca Lesinigo wrote:
[originally asked on ServerFault, but doesn't seem to get much traction there]

I have some data (hundreds of rows, should grow to some thousands in a worst case scenario), managed from external sources, whose authoritative source of truth consists of MySQL tables: I want to populate some files on some nodes with that data, the nodes cannot talk directly to MySQL, I can already do that with some scriptery and rsync or something, but I'd like to use Puppet-3 to do that.

Possible usage scenarios are things like Postfix transport maps, Spamassassin rules / custom settings per recipient, DJBDNS data files, Apache/nginx virtual hosts, and so on. Please do note this kind of data is managed by external sources outside of Puppet's control.

What is the recommended approach to manage them through Puppet? I can imagine dumping data from MySQL to YAML files on the master and try something with Hiera, I can also export data from MySQL to pre-formatted text files in the filebucket and distribute them.
But I also think / hope there is a better way for this use case.


Hiera supports pluggable back ends.  I would consider writing a back-end that loads the requested data directly from your database.  Your manifests don't need to know which data come from the DB and which from elsewhere.

If that doesn't seem suitable, then you can write one or more custom functions that query the needed data from your database.

I would avoid dumping the data to a secondary store, as that presents a freshness problem.


John

Reply all
Reply to author
Forward
0 new messages