summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Shubin <james@shubin.ca>2014-01-21 11:03:11 -0500
committerJames Shubin <james@shubin.ca>2014-01-21 11:03:11 -0500
commita9e809ff7ae6b30fc5051b3a43166a3caa5c137f (patch)
tree85a12b46a5bd12873409e9d0c9e1963157df01fa
parent51fea724f4b606326489636a0ffb7e9673600f9b (diff)
downloadpuppet-gluster-a9e809ff7ae6b30fc5051b3a43166a3caa5c137f.tar.gz
puppet-gluster-a9e809ff7ae6b30fc5051b3a43166a3caa5c137f.tar.xz
puppet-gluster-a9e809ff7ae6b30fc5051b3a43166a3caa5c137f.zip
Add support for setting the replica through vagrant.
This adds the --gluster-replica=N flag to the 'vagrant up' command.
-rw-r--r--vagrant/gluster/Vagrantfile18
-rw-r--r--vagrant/gluster/puppet/manifests/site.pp1
2 files changed, 18 insertions, 1 deletions
diff --git a/vagrant/gluster/Vagrantfile b/vagrant/gluster/Vagrantfile
index 8408d9d..781c4d0 100644
--- a/vagrant/gluster/Vagrantfile
+++ b/vagrant/gluster/Vagrantfile
@@ -61,6 +61,7 @@ offset = 100 # start gluster hosts after here
count = 4 # default number of gluster hosts to build
version = '' # default gluster version (empty string means latest!)
firewall = false # default firewall enabled (FIXME: default to true when keepalived bug is fixed)
+replica = 1 # default replica count
clients = 1 # default number of gluster clients to build
cachier = false # default cachier usage
@@ -76,6 +77,7 @@ if File.exist?(f)
count = settings[:count]
version = settings[:version]
firewall = settings[:firewall]
+ replica = settings[:replica]
clients = settings[:clients]
cachier = settings[:cachier]
end
@@ -108,6 +110,12 @@ while skip < ARGV.length
firewall = true
end
+ elsif ARGV[skip].start_with?(arg='--gluster-replica=')
+ v = ARGV.delete_at(skip).dup
+ v.slice! arg
+
+ replica = v.to_i # set gluster replica
+
elsif ARGV[skip].start_with?(arg='--gluster-clients=')
v = ARGV.delete_at(skip).dup
v.slice! arg
@@ -131,7 +139,14 @@ while skip < ARGV.length
end
# save settings (ARGV overrides)
-settings = {:count => count, :version => version, :firewall => firewall, :clients => clients, :cachier => cachier}
+settings = {
+ :count => count,
+ :version => version,
+ :firewall => firewall,
+ :replica => replica,
+ :clients => clients,
+ :cachier => cachier
+}
File.open(f, 'w') do |file|
file.write settings.to_yaml
end
@@ -379,6 +394,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
puppet.options = '--test' # see the output
puppet.facter = {
'vagrant' => '1',
+ 'vagrant_gluster_replica' => replica.to_s,
'vagrant_gluster_vip' => vip_ip,
'vagrant_gluster_vip_fqdn' => "#{vip_hostname}.#{domain}",
'vagrant_gluster_firewall' => firewall ? 'true' : 'false',
diff --git a/vagrant/gluster/puppet/manifests/site.pp b/vagrant/gluster/puppet/manifests/site.pp
index a26200f..7e6d53d 100644
--- a/vagrant/gluster/puppet/manifests/site.pp
+++ b/vagrant/gluster/puppet/manifests/site.pp
@@ -52,6 +52,7 @@ node /^annex\d+$/ inherits default { # annex{1,2,..N}
# this is a simple way to setup gluster
class { '::gluster::simple':
volume => 'puppet',
+ replica => "${::vagrant_gluster_replica}",
vip => "${::vagrant_gluster_vip}", # from vagrant
version => "${::vagrant_gluster_version}",
vrrp => true,