Wednesday, 25 June 2014

The Puppet modules - Part 3 (EnterpriseDB)

Over the last year or so I have been working on a Puppet module to replicate PostgreSQL databases between servers. Whilst this is working sort of (trying to merge this with the open source PostgreSQL server is hard and I haven't even start to look at PE internal DB), I decided that a cleaner approach was needed where I could have full control.

Enter PostgresPlus (EnterpriseDB), this version is available commercially and had no modules in the forge to work with.

In starting this I began with creating a manifest that would install the server which was simple enough. When it came to adding in roles,users and databases I found that it was easiest to just merge in parts of the existing Puppetlabs PostgreSQL module. 

Once all of this was done it was time to move onto the replication.

Replication is done through using exported resources. These are similar to virtual resources in that you use @ and spaceships with three major differances.
  1. The class/function is exported with @@
  2. The class/function is substantiated with <<|  |>>
  3. Requires a PuppetDB to work
So now in addition to the usual PostgreSQL module functions we also have classes for master and target.
By attaching the master class to the server it will push back an exported resource to the PuppetDB with a tag.
When we add the target class to the target server it will pull out the exported resource from the PuppetDB and apply it on this node, creating the configuration files for replication to start working.

This will also allow for dynamic creation of target nodes with as many as is required, even witht he master in full production.

The Puppet modules - Part 2 (389DS)

This time around I thought I would tackle something a bit more challenging, 389 Directory Service ( jlcox/ds_389 )

Anyone who has gone through setting up an LDAP server knows that it can be hard to get it the state that you need for production and once it is there it is hard to maintain.

Enter Puppet.

This module now installs the service and can process in add or modify ldif files. It can also turn on encryption of the database fields if required.

The Puppet Modules

As of late my employment has had me working 100% within Puppet writing modules for Government Organistations and large Australian corporations.

In doing all this work I decided it was about time that I created a few public modules for all to use.

The first in the series is on to make VIM setup rodjek puppet-vim so that it is easier to actually write some manifest files. This module ( jlcox/vim_puppet ) allows you to set up an array of users that will need this configured. Once configured simply apply and enjoy the goodness.....