Merge pull request #116 from battlemidget/salt-feature-1

Salt feature 1
This commit is contained in:
Fabio Rehm 2013-07-21 18:54:31 -07:00
commit bff0f8019b
4 changed files with 46 additions and 16 deletions

11
boxes/common/install-salt Executable file
View file

@ -0,0 +1,11 @@
#!/bin/bash
cache=`readlink -f .`
rootfs="${cache}/rootfs"
echo "installing salt"
chroot $rootfs apt-add-repository -y ppa:saltstack/salt
chroot $rootfs apt-get update
chroot $rootfs apt-get install salt-minion -y --force-yes
rm -rf $rootfs/tmp/*

View file

@ -148,12 +148,18 @@ write_sourceslist()
deb [arch=$2] $MIRROR ${release} main restricted universe multiverse deb [arch=$2] $MIRROR ${release} main restricted universe multiverse
deb [arch=$2] $MIRROR ${release}-updates main restricted universe multiverse deb [arch=$2] $MIRROR ${release}-updates main restricted universe multiverse
deb [arch=$2] $SECURITY_MIRROR ${release}-security main restricted universe multiverse deb [arch=$2] $SECURITY_MIRROR ${release}-security main restricted universe multiverse
deb-src [arch=$2] $MIRROR ${release} main restricted universe multiverse
deb-src [arch=$2] $MIRROR ${release}-updates main restricted universe multiverse
deb-src [arch=$2] $SECURITY_MIRROR ${release}-security main restricted universe multiverse
EOF EOF
else else
cat >> "$1/etc/apt/sources.list" << EOF cat >> "$1/etc/apt/sources.list" << EOF
deb $MIRROR ${release} main restricted universe multiverse deb $MIRROR ${release} main restricted universe multiverse
deb $MIRROR ${release}-updates main restricted universe multiverse deb $MIRROR ${release}-updates main restricted universe multiverse
deb $SECURITY_MIRROR ${release}-security main restricted universe multiverse deb $SECURITY_MIRROR ${release}-security main restricted universe multiverse
deb-src $MIRROR ${release} main restricted universe multiverse
deb-src $MIRROR ${release}-updates main restricted universe multiverse
deb-src $SECURITY_MIRROR ${release}-security main restricted universe multiverse
EOF EOF
fi fi
} }
@ -248,7 +254,7 @@ post_process()
release=$2 release=$2
trim_container=$3 trim_container=$3
if [ $trim_container -eq 1 ]; then if [[ $trim_container -eq 1 ]]; then
trim $rootfs $release trim $rootfs $release
elif [ ! -f $rootfs/etc/init/container-detect.conf ]; then elif [ ! -f $rootfs/etc/init/container-detect.conf ]; then
# Make sure we have a working resolv.conf # Make sure we have a working resolv.conf

View file

@ -57,6 +57,7 @@ end
puppet = ENV['PUPPET'] == '1' puppet = ENV['PUPPET'] == '1'
babushka = ENV['BABUSHKA'] == '1' babushka = ENV['BABUSHKA'] == '1'
salt = ENV['SALT'] == '1'
namespace :boxes do namespace :boxes do
namespace :ubuntu do namespace :ubuntu do
@ -65,20 +66,25 @@ namespace :boxes do
desc 'Build an Ubuntu Precise 64 bits box' desc 'Build an Ubuntu Precise 64 bits box'
BuildUbuntuBoxTaskV3. BuildUbuntuBoxTaskV3.
new(:precise64, new(:precise64,
:precise, 'amd64', puppet: puppet, babushka: babushka) :precise, 'amd64', puppet: puppet, babushka: babushka, salt: salt)
desc 'Build an Ubuntu Quantal 64 bits box' desc 'Build an Ubuntu Quantal 64 bits box'
BuildUbuntuBoxTaskV3. BuildUbuntuBoxTaskV3.
new(:quantal64, new(:quantal64,
:quantal, 'amd64', puppet: puppet, babushka: babushka) :quantal, 'amd64', puppet: puppet, babushka: babushka, salt: salt)
desc 'Build an Ubuntu Raring 64 bits box' desc 'Build an Ubuntu Raring 64 bits box'
BuildUbuntuBoxTaskV3. BuildUbuntuBoxTaskV3.
new(:raring64, new(:raring64,
:raring, 'amd64', puppet: puppet, babushka: babushka) :raring, 'amd64', puppet: puppet, babushka: babushka, salt: salt)
desc 'Build an Ubuntu Saucy 64 bits box'
BuildUbuntuBoxTaskV3.
new(:saucy64,
:saucy, 'amd64', puppet: puppet, babushka: babushka, salt: salt)
desc 'Build all Ubuntu boxes' desc 'Build all Ubuntu boxes'
task :all => %w( precise64 quantal64 raring64 ) task :all => %w( precise64 quantal64 raring64 saucy64 )
end end
end end
@ -87,17 +93,17 @@ namespace :boxes do
desc 'Build an Debian Squeeze 64 bits box' desc 'Build an Debian Squeeze 64 bits box'
BuildDebianBoxTaskV3. BuildDebianBoxTaskV3.
new(:squeeze64, new(:squeeze64,
:squeeze, 'amd64', puppet: puppet, babushka: babushka) :squeeze, 'amd64', puppet: puppet, babushka: babushka, salt: false)
desc 'Build an Debian Wheezy 64 bits box' desc 'Build an Debian Wheezy 64 bits box'
BuildDebianBoxTaskV3. BuildDebianBoxTaskV3.
new(:wheezy64, new(:wheezy64,
:wheezy, 'amd64', puppet: puppet, babushka: babushka) :wheezy, 'amd64', puppet: puppet, babushka: babushka, salt: false)
desc 'Build an Debian Sid/unstable 64 bits box' desc 'Build an Debian Sid/unstable 64 bits box'
BuildDebianBoxTaskV3. BuildDebianBoxTaskV3.
new(:sid64, new(:sid64,
:sid, 'amd64', puppet: puppet, babushka: babushka) :sid, 'amd64', puppet: puppet, babushka: babushka, salt: false)
desc 'Build all Debian boxes' desc 'Build all Debian boxes'
task :all => %w( squeeze64 wheezy64 sid64 ) task :all => %w( squeeze64 wheezy64 sid64 )

View file

@ -14,6 +14,7 @@ class BuildGenericBoxTaskV2 < ::Rake::TaskLib
@install_chef = opts.fetch(:chef, false) @install_chef = opts.fetch(:chef, false)
@install_puppet = opts.fetch(:puppet, true) @install_puppet = opts.fetch(:puppet, true)
@install_babushka = opts.fetch(:babushka, true) @install_babushka = opts.fetch(:babushka, true)
@install_salt = opts.fetch(:salt, true)
@file = opts[:file] || default_box_file @file = opts[:file] || default_box_file
@scripts_path = Pathname(Dir.pwd).join('boxes') @scripts_path = Pathname(Dir.pwd).join('boxes')
@ -86,7 +87,7 @@ class BuildGenericBoxTaskV2 < ::Rake::TaskLib
end end
def install_cfg_engines def install_cfg_engines
[ :puppet, :chef, :babushka ].each do |cfg_engine| [ :puppet, :chef, :babushka, :salt ].each do |cfg_engine|
next unless instance_variable_get :"@install_#{cfg_engine}" next unless instance_variable_get :"@install_#{cfg_engine}"
script_name = "install-#{cfg_engine}" script_name = "install-#{cfg_engine}"
run script_name run script_name
@ -125,6 +126,7 @@ end
chef = ENV['CHEF'] == '1' chef = ENV['CHEF'] == '1'
puppet = ENV['PUPPET'] == '1' puppet = ENV['PUPPET'] == '1'
babushka = ENV['BABUSHKA'] == '1' babushka = ENV['BABUSHKA'] == '1'
salt = ENV['SALT'] == '1'
namespace :boxes do namespace :boxes do
namespace :v2 do namespace :v2 do
@ -134,21 +136,26 @@ namespace :boxes do
desc 'Build an Ubuntu Precise 64 bits box' desc 'Build an Ubuntu Precise 64 bits box'
BuildUbuntuBoxTaskV2. BuildUbuntuBoxTaskV2.
new(:precise64, new(:precise64,
:precise, 'amd64', chef: chef, puppet: puppet, babushka: babushka) :precise, 'amd64', chef: chef, puppet: puppet, babushka: babushka, salt: salt)
desc 'Build an Ubuntu Quantal 64 bits box' desc 'Build an Ubuntu Quantal 64 bits box'
BuildUbuntuBoxTaskV2. BuildUbuntuBoxTaskV2.
new(:quantal64, new(:quantal64,
:quantal, 'amd64', chef: chef, puppet: puppet, babushka: babushka) :quantal, 'amd64', chef: chef, puppet: puppet, babushka: babushka, salt: salt)
# FIXME: Find out how to install chef on raring # FIXME: Find out how to install chef on raring
desc 'Build an Ubuntu Raring 64 bits box' desc 'Build an Ubuntu Raring 64 bits box'
BuildUbuntuBoxTaskV2. BuildUbuntuBoxTaskV2.
new(:raring64, new(:raring64,
:raring, 'amd64', chef: chef, puppet: puppet, babushka: babushka) :raring, 'amd64', chef: chef, puppet: puppet, babushka: babushka, salt: salt)
desc 'Build an Ubuntu Saucy 64 bits box'
BuildUbuntuBoxTaskV2.
new(:saucy64,
:saucy, 'amd64', chef: chef, puppet: puppet, babushka: babushka, salt: salt)
desc 'Build all Ubuntu boxes' desc 'Build all Ubuntu boxes'
task :all => %w( precise64 quantal64 raring64 ) task :all => %w( precise64 quantal64 raring64 saucy64 )
end end
end end
@ -158,17 +165,17 @@ namespace :boxes do
desc 'Build an Debian Squeeze 64 bits box' desc 'Build an Debian Squeeze 64 bits box'
BuildDebianBoxTaskV2. BuildDebianBoxTaskV2.
new(:squeeze64, new(:squeeze64,
:squeeze, 'amd64', chef: false, puppet: puppet, babushka: babushka) :squeeze, 'amd64', chef: false, puppet: puppet, babushka: babushka, salt: false)
desc 'Build an Debian Wheezy 64 bits box' desc 'Build an Debian Wheezy 64 bits box'
BuildDebianBoxTaskV2. BuildDebianBoxTaskV2.
new(:wheezy64, new(:wheezy64,
:wheezy, 'amd64', chef: false, puppet: puppet, babushka: babushka) :wheezy, 'amd64', chef: false, puppet: puppet, babushka: babushka, salt: false)
desc 'Build an Debian Sid/unstable 64 bits box' desc 'Build an Debian Sid/unstable 64 bits box'
BuildDebianBoxTaskV2. BuildDebianBoxTaskV2.
new(:sid64, new(:sid64,
:sid, 'amd64', chef: false, puppet: puppet, babushka: babushka) :sid, 'amd64', chef: false, puppet: puppet, babushka: babushka, salt: false)
desc 'Build all Debian boxes' desc 'Build all Debian boxes'
task :all => %w( squeeze64 wheezy64 sid64 ) task :all => %w( squeeze64 wheezy64 sid64 )