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 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 test on the $hostname fact. But then you'd have to
>    have 4 files corresponding to each host. 
>    But I'd like to find a way to get this to happen automatically using
>    templates. 
>    I'm already setting up the SSL certs for the DB servers using the fqdn
>    fact like this:
>    ssl-cert=/opt/mysql/<%= fqdn %>.crt
>    ssl-key=/opt/mysql/<%= fqdn %>.key
>    I'm looking for a way to just have one my.cnf template for all 4 db hosts
>    that automatically assigns the right value to server-id the way I describe
>    above. 
>    Any suggestions that could allow for that would be very welcome!
>    Thanks,
>    Tim
>    --
>    GPG me!!
> 
>    gpg --keyserver [1]pool.sks-keyservers.net --recv-keys F186197B
> 
>    --
>    You received this message because you are subscribed to the Google Groups
>    "Puppet Users" group.
>    To unsubscribe from this group and stop receiving emails from it, send an
>    email to [2][email protected].
>    To view this discussion on the web visit
>    
> [3]https://groups.google.com/d/msgid/puppet-users/CAOZy0ekzV%2B8PAHjHVMiVmWS6%3DvXo2FNLpGowtWu-%2B-qCFKe6Tg%40mail.gmail.com.
>    For more options, visit [4]https://groups.google.com/d/optout.
> 
> References
> 
>    Visible links
>    1. http://pool.sks-keyservers.net/
>    2. mailto:[email protected]
>    3. 
> https://groups.google.com/d/msgid/puppet-users/CAOZy0ekzV%2B8PAHjHVMiVmWS6%3DvXo2FNLpGowtWu-%2B-qCFKe6Tg%40mail.gmail.com?utm_medium=email&utm_source=footer
>    4. https://groups.google.com/d/optout

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/20150915200731.GA22592%40iniquitous.heresiarch.ca.
For more options, visit https://groups.google.com/d/optout.

Reply via email to