Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Keepalived installer.
- # Only supports one VRRP instance per server currently
- # (Although keepalived supports multiple)
- # Requires module: https://github.com/arioch/puppet-keepalived
- # Settings for the vrrp instance.
- # Note a vrrp instance refers to the behavior between two servers
- # that allows the floating IP to be moved around.
- # The ID to use for vrrp instance.
- # Only need to change this if running more than
- # one failover IP on the same network.
- # Should be different for each failover IP on the same network,
- # but the same for every server with the same IP.
- # "1" is used by our core routers, so best to avoid it.
- $vrrp_id = '10'
- # What interface the instance runs on.
- # (currently used for both the floating address and control multicast)
- # Note multicast must be enabled on this interface!
- $interface = 'eth1'
- # The floating IP/CIDR to use for failvover.
- $ip = '192.168.232.97/24'
- # This should be MASTER on one server and BACKUP on the other.
- # Unless you are running nopreempt, in which case both shoulde be BACKUP.
- #$state = 'MASTER'
- $state = 'BACKUP'
- # This should usually be 101 on the MASTER and 100 on BACKUP
- $priority = '101'
- #$priority = '100'
- # Set this true if the failback process is disruptive to applications
- # and should be done manually.
- # Probably should be true for databases.
- # Should be false if there is some reason to prefer a specific machine be active.
- # To failback, just restart keepalived on the machine with the IP.
- # See: http://article.gmane.org/gmane.linux.keepalived.devel/1537%22
- $nopreempt = true
- # This should be set to a random password.
- # It needs to be the same on every instance with the same $vrrp_id.
- $password = 'RANDOM_PASSWORD'
- # A simple bash command to check of the process that will use
- # the floating IP is running.
- # If this goes down, the IP should go to the other server in
- # the same vrrp isntance.
- $check_command = 'kill -0 `cat /var/run/mysqld/mysqld.pid`'
- # end of config #
- # There are lots of advanced settings if you want to muck around.
- # See: https://github.com/arioch/puppet-keepalived
- include keepalived
- keepalived::vrrp::instance { "VRID_${vrrp_id}":
- interface => $interface,
- state => $state,
- virtual_router_id => $vrrp_id,
- priority => $priority,
- auth_type => 'PASS',
- auth_pass => $password,
- virtual_ipaddress => [ $ip ],
- #track_interface => ['eth1','tun0'], # optional, monitor these interfaces.
- track_script => "VRID_${vrrp_id}_check",
- }
- keepalived::vrrp::script { "VRID_${vrrp_id}_check":
- script => $check_command,
- }
- # For RHEL, redhat makes it difficult to install keepalived.
- # The package is burried in a paid add-on, so we use a 3rd party repo.
- # CentOS is fine.
- if($operatingsystem == 'RedHat' and $operatingsystemmajrelease == 6) {
- package { 'powerstack-release':
- ensure => 'latest',
- provider => 'rpm',
- source => 'http://powerstack.org/powerstack-release.rpm',
- }
- # Ignore: "Warning: Augeas[powerstack-repo-augeas](provider=augeas): Loading failed for one or more files, see debug for /augeas//error output"
- # The warning is fixed in puppet 3.5.0.
- # https://tickets.puppetlabs.com/browse/PUP-1158
- augeas { 'powerstack-repo-augeas':
- require => Package['powerstack-release'],
- before => Package['keepalived'],
- context => '/files/etc/yum.repos.d/powerstack.repo',
- changes => [
- # This will eventually break. See: https://fedorahosted.org/augeas/ticket/275
- 'set powerstack/includepkgs keepalived',
- 'set powerstack/baseurl http://download.powerstack.org/6/$basearch/',
- ],
- }
- }
- #package { 'keepalived': ensure => 'latest' }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement