-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
module rewritten to support redis versions from 2.2 to 2.8+
- Loading branch information
Showing
12 changed files
with
3,095 additions
and
857 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ Gemfile.lock | |
.librarian | ||
.tmp | ||
Puppetfile.lock | ||
Vagrantfile |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,40 @@ | ||
VAGRANTFILE_API_VERSION = "2" | ||
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| | ||
# -*- mode: ruby -*- | ||
# vi: set ft=ruby : | ||
# | ||
|
||
if ENV['VAGRANT_HOME'].nil? | ||
ENV['VAGRANT_HOME'] = './' | ||
end | ||
|
||
redis = { | ||
:'centos65' => { :memory => '120', :ip => '10.1.1.13', :box => 'puppetlabs/centos-6.5-64-puppet', :domain => 'redis.local' }, | ||
:'trusty' => { :memory => '240', :ip => '10.1.1.14', :box => 'ubuntu/trusty64', :domain => 'redis.local' }, | ||
:'saucy' => { :memory => '120', :ip => '10.1.1.15', :box => 'puppetlabs/ubuntu-13.10-64-puppet', :domain => 'redis.local' }, | ||
:'precise' => { :memory => '120', :ip => '10.1.1.16', :box => 'puppetlabs/ubuntu-12.04-64-puppet', :domain => 'redis.local' }, | ||
:'debian74' => { :memory => '120', :ip => '10.1.1.17', :box => 'puppetlabs/debian-7.4-64-puppet', :domain => 'redis.local' }, | ||
} | ||
|
||
Vagrant::Config.run("2") do |config| | ||
config.vbguest.auto_update = false | ||
config.hostmanager.enabled = false | ||
|
||
config.vm.define 'redis' do |node| | ||
node.vm.box = "centos65" | ||
node.vm.hostname = "redis.local" | ||
node.vm.network :private_network, ip: "192.168.100.100" | ||
node.vm.provision :shell, :inline => "yum install -y git && gem install librarian-puppet --no-ri --no-rdoc" | ||
node.vm.provision :shell, :inline => "cd /vagrant/tests ; librarian-puppet install --clean --path /etc/puppet/modules" | ||
node.vm.provision :puppet do |puppet| | ||
puppet.manifests_path = ["vm", "/etc/puppet/modules/redis/tests"] | ||
puppet.manifest_file = "init.pp" | ||
end | ||
end | ||
redis.each_pair do |name, opts| | ||
config.vm.define name do |n| | ||
config.vm.provider :virtualbox do |vb| | ||
vb.customize ["modifyvm", :id, "--memory", opts[:memory] ] | ||
end | ||
n.vm.network "private_network", ip: opts[:ip] | ||
n.vm.box = opts[:box] | ||
n.vm.host_name = "#{name}" + "." + opts[:domain] | ||
n.vm.synced_folder "#{ENV['VAGRANT_HOME']}","/etc/puppet/modules/redis" | ||
n.vm.provision :shell, :inline => "gem install puppet facter --no-ri --no-rdoc" if name == "trusty" | ||
n.vm.provision :shell, :inline => "puppet module install thias-sysctl --force" | ||
n.vm.provision :puppet do |puppet| | ||
puppet.manifests_path = "tests" | ||
puppet.manifest_file = "init.pp" | ||
puppet.module_path = "./" | ||
end | ||
end | ||
end | ||
|
||
end |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
require 'facter' | ||
|
||
Facter.add("redis_version", :timeout => 20) do | ||
confine :osfamily => "Debian" | ||
|
||
setcode do | ||
|
||
dpkg = `which apt-cache 2> /dev/null`.chomp | ||
if dpkg == '' | ||
dpkg = '/usr/bin/apt-cache' | ||
end | ||
|
||
redis_version = Facter::Util::Resolution.exec('/usr/bin/redis-server --version') | ||
if redis_version.nil? | ||
redis_version = Facter::Util::Resolution.exec(dpkg+" show redis-server 2> /dev/null | /bin/grep -i 'version:' | /usr/bin/awk '{print $2}'").strip | ||
end | ||
|
||
case redis_version | ||
when /2\.8\.[0-9]/ | ||
#set version to 2.8 | ||
redis_version = '2.8.x' | ||
when /2\.6\.[0-9]/ | ||
#set version to 2.6 | ||
redis_version = '2.6.x' | ||
when /2\.4\.[0-9]/ | ||
#set version to 2.4 | ||
redis_version = '2.4.x' | ||
when /2\.2\.[0-9]/ | ||
#set version to 2.2 | ||
redis_version = '2.2.x' | ||
else | ||
redis_version = 'nil' | ||
end | ||
redis_version | ||
end | ||
end | ||
|
||
Facter.add("redis_version", :timeout => 20) do | ||
confine :osfamily => "RedHat" | ||
|
||
setcode do | ||
|
||
yum = `which yum 2> /dev/null`.chomp | ||
if yum == '' | ||
yum = '/usr/bin/yum' | ||
end | ||
|
||
redis_version = Facter::Util::Resolution.exec('/usr/sbin/redis-server --version') | ||
if redis_version.nil? | ||
redis_version = Facter::Util::Resolution.exec(yum+" info redis 2> /dev/null | /bin/grep '^Version' | /bin/awk -F ':' '{print $2}'").strip | ||
end | ||
|
||
case redis_version | ||
when /2\.8\.[0-9]/ | ||
#set version to 2.8 | ||
redis_version = '2.8.x' | ||
when /2\.6\.[0-9]/ | ||
#set version to 2.6 | ||
redis_version = '2.6.x' | ||
when /2\.4\.[0-9]/ | ||
#set version to 2.4 | ||
redis_version = '2.4.x' | ||
when /2\.2\.[0-9]/ | ||
#set version to 2.2 | ||
redis_version = '2.2.x' | ||
else | ||
redis_version = 'nil' | ||
end | ||
redis_version | ||
end | ||
end |
This file contains 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
This file contains 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
Oops, something went wrong.
ced6e56
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good commit, but isn't it safer to listen to 127.0.0.1 by default? The default introduced by this commit is to listen to all interfaces including possible public ones.
ced6e56
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ced6e56
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have several web servers that connect to a local install of redis via php-redis. I believe it is better to secure network services to be as closed as possible and only configure what is needed. Thus, changing the default to be open to everything sounds like a security issue to me. If people don't firewall their machines properly and the change goes unnoticed then anyone can connect to redis and possibly fetch data from it.