On 4/30/15 10:10 AM, Joseph Swick wrote:

dev-db-01.mydomain.net.yaml:
---
mysql::server::override_options:
   mysqld:
     server_id: 1

dev-db-02.mydomain.net.yaml:
---
mysql::server::override_options:
   mysqld:
     server_id: 2


John covered the technical in detail. However I'd like to apply some sysadmin knowledge to your example problem. With Puppet or any other config framework it's important to specify as little as possible within your system. Another way to put it is to only manage what you need to and nothing more. It allows you more flexibility as you grow when your code never cared that x might be more than a single digit. Also it keeps you from having to solve technical problems that do not benefit your system.

In this case Mysql's server_id is a 32bit integer. It needs to be unique within a set of servers that replicate with each other. That's it. The number has no other meaning than an identifier. If you realize the value of the number doesn't matter only it's uniqueness, you can easily manage it programmatically.

# not sure how to quote this for insertion into Hiera
# I'll leave that to you
server_id = <% require 'ipaddr'%><%= IPAddr.new(@ipaddress).to_i %>

IPs should be unique between servers replicating with each other which makes the ipaddress fact easy to reuse.

I encourage you to think about any values you add to Hiera particularly though at the fqdn level and decide if they actually need to be specially managed or if some statement at the env, os, etc level might be a better option.

Ramin

--
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 puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/5543E93A.8090700%40badapple.net.
For more options, visit https://groups.google.com/d/optout.

Reply via email to