arioch/puppet-keepalived — pull request #26 by devin-c (2014-03-11 23:03:40+00:00)
Title: Allow separate real_server definitions

This adds a separate definition for real servers and configures the
virtual server definition to automatically realize the exported real
server resources that have been assigned to it. The inspiration for this
comes largely from the puppetlabs/haproxy module. The configuration,
specifically through the `options` parameter, is flexible enough to handle
all the current options available in the keepalived real_server
configuration block.

The trick I borrowed from the puppetlabs/haproxy to make this work is in
the ordering string passed to `concat::fragment`. The virtual server
uses an order string of "250-virtual_server_name-000". The name of the
virtual server, i.e., "virtual_server_name", is then passed to the
`real_server` definition via the `virtual_server` parameter. This allows
the `real_server` definition to set its `concat::fragment` order to
"250-virtual_server_name-real_server_name". The ending block is then
appended via "251-virtual_server_name". This ensures that all the
real_servers are correctly included inside of the `virtual_server`
block.

This does not conflict with the `real_servers` parameter in the
`virtual_server` definition. They can both be used without interfering
with each other.