Created
November 1, 2013 19:31
-
-
Save sandeepkunkunuru/7270672 to your computer and use it in GitHub Desktop.
VoltDB puppet manifest
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import "templates" | |
import "nodes" | |
Exec { path => [ "/bin/", "/sbin/" , "/usr/bin/", "/usr/sbin/" , "/root/voltdb/bin"] } | |
package { 'ntp': | |
ensure => '4.2.4p8-3.el6', | |
} | |
package { 'java-1.7.0-openjdk': | |
ensure => '1.7.0.45-2.4.3.2.el6_4', | |
require => Package['ntp'], | |
} | |
package { 'java-1.7.0-openjdk-devel': | |
ensure => '1.7.0.45-2.4.3.2.el6_4', | |
require => Package['java-1.7.0-openjdk'], | |
} | |
package { 'htop': | |
ensure => '1.0.2-1.el5.rf', | |
require => Package['java-1.7.0-openjdk-devel'], | |
} | |
service { 'ntpd': | |
ensure => 'running', | |
enable => 'false', | |
require => Package['htop'], | |
} | |
# copy VoltDB file to all cluster nodes | |
## untar latest version of voltdb into /etc/puppet/modules/voltdb/files/voltdb/ | |
# http://serverfault.com/questions/296299/how-to-deploy-applications-in-tar-gz-with-puppet/296413#296413 | |
file { "/root/voltdb": | |
source => "puppet:///modules/voltdb/voltdb", | |
ensure => directory, | |
replace => true, | |
purge => true, | |
recurse => true, | |
require => Service['ntpd'], | |
} | |
file { "/root/deployment.xml": | |
owner => root, | |
group => root, | |
source => "puppet:///modules/voltdb/deployment.xml", | |
require => File['/root/voltdb'], | |
} | |
# Copy the license file | |
file { "/root/Enterprise-2014-10-17-v2.xml": | |
owner => root, | |
group => root, | |
source => "puppet:///modules/voltdb/Enterprise-2014-10-17-v2.xml", | |
require => File['/root/deployment.xml'], | |
} | |
# Ent.jar is the catalog jar file | |
file { "/root/Ent.jar": | |
owner => root, | |
group => root, | |
source => "puppet:///modules/voltdb/Ent.jar", | |
require => File['/root/Enterprise-2014-10-17-v2.xml'], | |
} | |
# on SAN each node reads and writes to a folder created with their ip address as the name | |
exec { 'symlink_voltb_node_snapshot': | |
command => "ln -s /mnt/san/VoltDB/${ipaddress_eth0}/ /root/voltdb_snapshots", | |
cwd => '/root', | |
unless => "find /root | grep voltdb_snapshots", | |
require => File['/root/Ent.jar'], | |
} | |
# replace leader_hostname with actual hostname of the leader | |
exec { 'start_voltdb_leader': | |
command => "nohup voltdb create leader 0.0.0.0 catalog /root/Ent.jar deployment /root/deployment.xml license /root/Enterprise-2014-10-17-v2.xml port 8484 & >>/root/nohup.out", | |
cwd => '/root', | |
onlyif => [ | |
"ps aux | grep volt | grep -c java" | |
], | |
unless => [ | |
"hostname | grep -cv leader_hostname" | |
], | |
logoutput => true, | |
require => Exec['symlink_voltb_node_snapshot'], | |
} | |
# replace leader_hostname with actual hostname of the leader | |
# replace leader_ip with actual ip address of the leader | |
exec { 'start_voltdb_nodes': | |
command => "nohup voltdb create leader leader_ip catalog /root/Ent.jar deployment /root/deployment.xml license /root/Enterprise-2014-10-17-v2.xml port 8484 & >>/root/nohup.out", | |
cwd => '/root', | |
onlyif => [ | |
"ps aux | grep volt | grep -c java" | |
], | |
unless => [ | |
"hostname | grep -c leader_hostname" | |
], | |
logoutput => true, | |
require => Exec['symlink_voltb_node_snapshot'], | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment