Re: [Puppet Users] automating mysql my.cnf with puppet

2015-09-19 Thread Tim Dunphy
Hey all, Ok, sorry if I didn't get to all of your suggestions. But I did elect to try this one: server-id=<%= @hostname.match(/db([0-9]+)/); $1 %> Which I modified slightly to: server-id=<%= @hostname.match(/db([0-4]+)/); $1 %> Because I only run 4 mysql servers atm. And BOOM! That does it

Re: [Puppet Users] automating mysql my.cnf with puppet

2015-09-15 Thread Christopher Wood
Use a regular expression? Untested: server-id=<%= @hostname.match(/db([0-9]+)/); $1 %> On Tue, Sep 15, 2015 at 03:59:44PM -0400, Tim Dunphy wrote: >Hey guys, > Is there any other way to automate this setting in my.cnf: >server-id=1 >So that if the host is db1 it'll get a value of

Re: [Puppet Users] automating mysql my.cnf with puppet

2015-09-15 Thread Ramin K
On 9/15/15 12:59 PM, Tim Dunphy wrote: Hey guys, Is there any other way to automate this setting in my.cnf: server-id=1 So that if the host is db1 it'll get a value of 1, for db2 a value of 2, for db3 a value of 3 and db4 a value of 4? Don't bother. Assigning the number manually and

[Puppet Users] automating mysql my.cnf with puppet

2015-09-15 Thread Tim Dunphy
Hey guys, Is there any other way to automate this setting in my.cnf: server-id=1 So that if the host is db1 it'll get a value of 1, for db2 a value of 2, for db3 a value of 3 and db4 a value of 4? The only way I can think of this is to have branching logic in the puppet manifest that does a

Re: [Puppet Users] automating mysql my.cnf with puppet

2015-09-15 Thread Christopher
Try something like this to extract the \d from the hostname: <% id = fqdn.dup %> <% id.gsub!(/db(\d).domain.ext/){$1} %> server-id = <%= id %> On 09/15/2015 03:59 PM, Tim Dunphy wrote: Hey guys, Is there any other way to automate this setting in my.cnf: server-id=1 So that if the host is

Re: [Puppet Users] automating mysql my.cnf with puppet

2015-09-15 Thread Ramin K
On 9/15/15 1:15 PM, Ramin K wrote: server_id = <% require 'ipaddr'%><%= IPAddr.new(@ipaddress).to_i %> server_id = fqdn_rand(2147483647). that last should have been <%= scope.function_fqdn_rand(2147483647) %> assuming it was also in a template. Ramin -- You received this message because