puppet version 2.7.18 stored configs (not puppetdb)
I my case i have 3 couchbase nodes, which should be concated to an couchbase connection string which looks like that:
192.168.19.12;192.168.19.40;192.168.19.66
so on each couchbase server i do something like this:
@@concat::fragment { "foo": target => '/tmp/foo', content => "$ipaddress", order => 1, }
and on the app server, which should connect to the couchbase server, i want generate a yaml config file looking like this:
couchbase:
class: MyCouchbaseStorage
param:
connection: MyCouchbaseConnection
connection_param:
username: myusername
password: mypassword
bucket: mybucket
host: 192.168.19.12;192.168.19.40;192.168.19.66
persist: 1
all except the host lines are no problem, but the host entry is really tricky
i concat the hosts by collecting them with:
Concat::Fragment <<| tag == 'mycbtag' |>> { target => '/tmp/database.yml' }
so now i have the problem, that i have no ";" calling concat like this
@@concat::fragment { "foo": target => '/tmp/foo', content => ";$ipaddress", order => 1, }
will produce:
host: ;192.168.19.12;192.168.19.40;192.168.19.66
calling concat like that
@@concat::fragment { "foo": target => '/tmp/foo', content => "$ipaddress;", order => 1, }
will produce:
host: 192.168.19.12;192.168.19.40;192.168.19.66;
so how to modify the collected content or how do i get the desired result?
host: 192.168.19.12;192.168.19.40;192.168.19.66
I achieve this for Zookeeper using PuppetDB to retrieve the nodes, and a custom plugin to join them. The details of using PuppetDB are in the answer to my original question, and the custom plugin looks like this:
This should allow you to create a string in your manifest like this:
Which will use PuppetDB to find all nodes assigned the
couchbase
class, and return their IP addresses.Note that this shoots for eventual consistency - it will take a run for all the nodes to report to PuppetDB that they have the
couchbase
class assigned, and only on the second run will they all connect. This works fine for my Zookeeper class, but I suppose may not quite suit for the Couchbase one.