vagrant-salt 0.2.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,3 @@
1
+ [submodule "scripts"]
2
+ path = scripts
3
+ url = git://github.com/saltstack/salt-bootstrap.git
data/README.rst CHANGED
@@ -245,7 +245,9 @@ Installing from source
245
245
  1. ``wget https://github.com/saltstack/salty-vagrant/tarball/master -O salty-vagrant.tar.gz``
246
246
  2. ``tar zxf salty-vagrant.tar.gz``
247
247
  3. ``cd saltstack-salty-vagrant-[hash]``
248
- 4. ``gem build vagrant-salt.gemspec``
249
- 5. ``vagrant gem install vagrant-salt-[version].gem``
248
+ 4. ``git submodule init``
249
+ 5. ``git submodule update``
250
+ 6. ``gem build vagrant-salt.gemspec``
251
+ 7. ``vagrant gem install vagrant-salt-[version].gem``
250
252
 
251
253
  .. vim: fenc=utf-8 spell spl=en cc=80 tw=79 fo=want sts=2 sw=2 et
@@ -0,0 +1,130 @@
1
+ Bootstrapping Salt
2
+ ==================
3
+
4
+ Before `Salt`_ can be used for provisioning on the desired machine, the
5
+ binaries need to be installed. Since `Salt`_ supports many different
6
+ distributions and versions of operating systems, the `Salt`_ installation
7
+ process is handled by this shell script ``bootstrap-salt-minion.sh``. This
8
+ script runs through a series of checks to determine operating system type and
9
+ version to then install the `Salt`_ binaries using the appropriate methods.
10
+
11
+
12
+ One Line Bootstrap
13
+ ------------------
14
+
15
+ If you're looking for the *one-liner* to install salt...
16
+
17
+ For example, using ``curl`` to install latest git:
18
+
19
+ .. code:: console
20
+
21
+ curl -L http://bootstrap.saltstack.org | sudo sh -s git develop
22
+
23
+
24
+ Or, using ``wget`` to install your distribution's stable packages:
25
+
26
+ .. code:: console
27
+
28
+ wget -O - http://bootstrap.saltstack.org | sudo sh
29
+
30
+ If you have certificate issues using ``wget`` try the following:
31
+
32
+ .. code:: console
33
+
34
+ wget --no-check-certificate -O - http://bootstrap.saltstack.org | sudo sh
35
+
36
+
37
+ If you already have python installed, then it's as easy as:
38
+
39
+ .. code:: console
40
+
41
+ python -m urllib "http://bootstrap.saltstack.org" | sudo sh -s git develop
42
+
43
+
44
+
45
+ Adding support for other operating systems
46
+ ------------------------------------------
47
+ In order to install salt for a distribution you need to define:
48
+
49
+ 1. To Install Dependencies, which is required, one of:
50
+
51
+ .. code:: bash
52
+
53
+ install_<distro>_<distro_version>_<install_type>_deps
54
+ install_<distro>_<distro_version>_deps
55
+ install_<distro>_<install_type>_deps
56
+ install_<distro>_deps
57
+
58
+
59
+ 2. To install salt, which, of course, is required, one of:
60
+
61
+ .. code:: bash
62
+
63
+ install_<distro>_<distro_version>_<install_type>
64
+ install_<distro>_<install_type>
65
+
66
+
67
+ 3. Optionally, define a minion configuration function, which will be called if
68
+ the ``-c|config-dir`` option is passed. One of:
69
+
70
+ .. code:: bash
71
+
72
+ config_<distro>_<distro_version>_<install_type>_minion
73
+ config_<distro>_<distro_version>_minion
74
+ config_<distro>_<install_type>_minion
75
+ config_<distro>_minion
76
+ config_minion [THIS ONE IS ALREADY DEFINED AS THE DEFAULT]
77
+
78
+
79
+ 4. Also optionally, define a post install function, one of:
80
+
81
+ .. code:: bash
82
+
83
+ install_<distro>_<distro_versions>_<install_type>_post
84
+ install_<distro>_<distro_versions>_post
85
+ install_<distro>_<install_type>_post
86
+ install_<distro>_post
87
+
88
+
89
+ Below is an example for Ubuntu Oneiric:
90
+
91
+ .. code:: bash
92
+
93
+ install_ubuntu_1110_deps() {
94
+ apt-get update
95
+ apt-get -y install python-software-properties
96
+ add-apt-repository -y 'deb http://us.archive.ubuntu.com/ubuntu/ oneiric universe'
97
+ add-apt-repository -y ppa:saltstack/salt
98
+ }
99
+
100
+ install_ubuntu_1110_post() {
101
+ add-apt-repository -y --remove 'deb http://us.archive.ubuntu.com/ubuntu/ oneiric universe'
102
+ }
103
+
104
+ install_ubuntu_stable() {
105
+ apt-get -y install salt-minion
106
+ }
107
+
108
+
109
+ Since there is no ``install_ubuntu_1110_stable()`` it defaults to the
110
+ unspecified version script.
111
+
112
+ The bootstrapping script must be plain POSIX sh only, **not** bash or another
113
+ shell script. By design the targeting for each operating system and version is
114
+ very specific. Assumptions of supported versions or variants should not be
115
+ made, to avoid failed or broken installations.
116
+
117
+ Supported Operating Systems
118
+ ---------------------------
119
+ - Ubuntu 10.x/11.x/12.x
120
+ - Debian 6.x
121
+ - CentOS 6.3
122
+ - Fedora
123
+ - Arch
124
+ - FreeBSD 9.0
125
+
126
+
127
+
128
+
129
+ .. _`Salt`: http://saltstack.org/
130
+ .. vim: fenc=utf-8 spell spl=en cc=100 tw=99 fo=want sts=2 sw=2 et
@@ -14,7 +14,8 @@
14
14
  # CREATED: 10/15/2012 09:49:37 PM WEST
15
15
  #===============================================================================
16
16
  set -o nounset # Treat unset variables as an error
17
- ScriptVersion="1.0"
17
+ ScriptVersion="1.1"
18
+ ScriptName="bootstrap-salt-minion.sh"
18
19
 
19
20
  #===============================================================================
20
21
  # LET THE BLACK MAGIC BEGIN!!!!
@@ -27,7 +28,7 @@ ScriptVersion="1.0"
27
28
  usage() {
28
29
  cat << EOT
29
30
 
30
- Usage : ${0##/*/} [options] <install-type> <install-type-args>
31
+ Usage : ${ScriptName} [options] <install-type> <install-type-args>
31
32
 
32
33
  Installation types:
33
34
  - stable (default)
@@ -35,12 +36,12 @@ usage() {
35
36
  - git
36
37
 
37
38
  Examples:
38
- $ ${0##/*/}
39
- $ ${0##/*/} stable
40
- $ ${0##/*/} daily
41
- $ ${0##/*/} git
42
- $ ${0##/*/} git develop
43
- $ ${0##/*/} git 8c3fadf15ec183e5ce8c63739850d543617e4357
39
+ $ ${ScriptName}
40
+ $ ${ScriptName} stable
41
+ $ ${ScriptName} daily
42
+ $ ${ScriptName} git
43
+ $ ${ScriptName} git develop
44
+ $ ${ScriptName} git 8c3fadf15ec183e5ce8c63739850d543617e4357
44
45
 
45
46
  Options:
46
47
  -h|help Display this message
@@ -63,17 +64,29 @@ do
63
64
  v|version ) echo "$0 -- Version $ScriptVersion"; exit 0 ;;
64
65
  c|config-dir ) TEMP_CONFIG_DIR="$OPTARG" ;;
65
66
 
66
- \? ) echo "\n Option does not exist : $OPTARG\n"
67
- usage; exit 1 ;;
67
+ \? ) echo "\n Option does not exist : $OPTARG\n"
68
+ usage; exit 1 ;;
68
69
 
69
70
  esac # --- end of case ---
70
71
  done
71
72
  shift $(($OPTIND-1))
72
73
 
74
+ __check_unparsed_options() {
75
+ shellopts="$1"
76
+ unparsed_options=$( echo "$shellopts" | grep -E '[-]+[[:alnum:]]' )
77
+ if [ "x$unparsed_options" != "x" ]; then
78
+ usage
79
+ echo
80
+ echo " * ERROR: options come before install arguments"
81
+ echo
82
+ exit 1
83
+ fi
84
+ }
73
85
  # Define installation type
74
86
  if [ "$#" -eq 0 ];then
75
87
  ITYPE="stable"
76
88
  else
89
+ __check_unparsed_options "$*"
77
90
  ITYPE=$1
78
91
  shift
79
92
  fi
@@ -87,12 +100,14 @@ if [ $ITYPE = "git" ]; then
87
100
  if [ "$#" -eq 0 ];then
88
101
  GIT_REV="master"
89
102
  else
103
+ __check_unparsed_options "$*"
90
104
  GIT_REV="$1"
91
105
  shift
92
106
  fi
93
107
  fi
94
108
 
95
109
  if [ "$#" -gt 0 ]; then
110
+ __check_unparsed_options "$*"
96
111
  usage
97
112
  echo
98
113
  echo " * ERROR: Too many arguments."
@@ -144,8 +159,8 @@ trap "__exit_cleanup" EXIT
144
159
 
145
160
 
146
161
  # Define our logging file and pipe paths
147
- LOGFILE="/tmp/$(basename $0 | sed s/.sh/.log/g )"
148
- LOGPIPE="/tmp/$(basename $0 | sed s/.sh/.logpipe/g )"
162
+ LOGFILE="/tmp/$( echo $ScriptName | sed s/.sh/.log/g )"
163
+ LOGPIPE="/tmp/$( echo $ScriptName | sed s/.sh/.logpipe/g )"
149
164
 
150
165
  # Create our logging pipe
151
166
  # On FreeBSD we have to use mkfifo instead of mknod
@@ -172,7 +187,7 @@ exec 2>$LOGPIPE
172
187
  #-------------------------------------------------------------------------------
173
188
  __gather_hardware_info() {
174
189
  if [ -f /proc/cpuinfo ]; then
175
- CPU_VENDOR_ID=$( cat /proc/cpuinfo | grep vendor_id | head -n 1 | awk '{print $3}' )
190
+ CPU_VENDOR_ID=$(cat /proc/cpuinfo | grep -E 'vendor_id|Processor' | head -n 1 | awk '{print $3}' | cut -d '-' -f1 )
176
191
  else
177
192
  CPU_VENDOR_ID=$( sysctl -n hw.model )
178
193
  fi
@@ -467,6 +482,7 @@ install_ubuntu_1110_deps() {
467
482
  install_ubuntu_daily_deps() {
468
483
  apt-get update
469
484
  __apt_get_noinput python-software-properties
485
+ add-apt-repository -y ppa:saltstack/salt-depends
470
486
  add-apt-repository -y ppa:saltstack/salt-daily
471
487
  apt-get update
472
488
  }
@@ -532,30 +548,80 @@ install_debian_stable() {
532
548
  __apt_get_noinput salt-minion
533
549
  }
534
550
 
535
- install_debian_60_stable_deps() {
551
+ install_debian_60_deps() {
536
552
  echo "deb http://backports.debian.org/debian-backports squeeze-backports main" >> \
537
553
  /etc/apt/sources.list.d/backports.list
554
+
555
+ # Add madduck's repo since squeeze packages have been deprecated
556
+ for i in {salt-common,salt-master,salt-minion,salt-syndic,salt-doc}; do
557
+ echo "Package: $i"
558
+ echo "Pin: release a=squeeze-backports"
559
+ echo "Pin-Priority: 600"
560
+ echo
561
+ done > /etc/apt/preferences.d/local-salt-backport.pref
562
+
563
+ cat <<_eof > /etc/apt/sources.list.d/local-madduck-backports.list
564
+ deb http://debian.madduck.net/repo squeeze-backports main
565
+ deb-src http://debian.madduck.net/repo squeeze-backports main
566
+ _eof
567
+
568
+ wget -q http://debian.madduck.net/repo/gpg/archive.key
569
+ apt-key add archive.key
538
570
  apt-get update
539
571
  }
540
572
 
541
- install_debian_60_stable() {
542
- __apt_get_noinput -t squeeze-backports salt-minion
573
+ install_debian_60() {
574
+ __apt_get_noinput salt-minion
575
+ }
576
+
577
+ install_debian_git_deps() {
578
+ apt-get update
579
+ __apt_get_noinput lsb-release python python-pkg-resources python-crypto \
580
+ python-jinja2 python-m2crypto python-yaml msgpack-python git python-zmq
581
+ }
582
+
583
+ install_debian_git() {
584
+ __git_clone_and_checkout
585
+ python setup.py install --install-layout=deb
586
+
587
+ # Let's trigger config_minion()
588
+ if [ "$TEMP_CONFIG_DIR" = "null" ]; then
589
+ TEMP_CONFIG_DIR="${SALT_GIT_CHECKOUT_DIR}/conf/"
590
+ CONFIG_MINION_FUNC="config_minion"
591
+ fi
543
592
  }
544
593
 
545
594
  install_debian_60_git_deps() {
546
- install_debian_60_stable_deps
547
- install_debian_60_stable
595
+ install_debian_60_deps # Add backports
596
+ install_debian_git_deps # Grab the actual deps
548
597
  }
549
598
 
550
599
  install_debian_60_git() {
551
- __apt_get_noinput git
552
600
  apt-get -y purge salt-minion
553
601
 
554
602
  __git_clone_and_checkout
555
603
 
556
604
  python setup.py install --install-layout=deb
557
- mkdir -p /etc/salt
558
- cp conf/minion.template /etc/salt/minion
605
+
606
+ # Let's trigger config_minion()
607
+ if [ "$TEMP_CONFIG_DIR" = "null" ]; then
608
+ TEMP_CONFIG_DIR="${SALT_GIT_CHECKOUT_DIR}/conf/"
609
+ CONFIG_MINION_FUNC="config_minion"
610
+ fi
611
+ }
612
+
613
+ install_debian_git_post() {
614
+ for fname in $(echo "minion master syndic"); do
615
+ if [ $fname != "minion" ]; then
616
+ # Guess we should only enable and start the minion service. Right??
617
+ continue
618
+ fi
619
+ if [ -f ${SALT_GIT_CHECKOUT_DIR}/debian/salt-$fname.init ]; then
620
+ cp ${SALT_GIT_CHECKOUT_DIR}/debian/salt-$fname.init /etc/init.d/salt-$fname
621
+ fi
622
+ chmod +x /etc/init.d/salt-$fname
623
+ /etc/init.d/salt-$fname start
624
+ done
559
625
  }
560
626
  #
561
627
  # Ended Debian Install Functions
@@ -667,13 +733,13 @@ install_centos_63_git_post() {
667
733
  #
668
734
  install_arch_stable_deps() {
669
735
  echo '[salt]
670
- Server = http://red45.org/archlinux
736
+ Server = http://intothesaltmine.org/archlinux
671
737
  ' >> /etc/pacman.conf
672
738
  }
673
739
 
674
740
  install_arch_git_deps() {
675
741
  echo '[salt]
676
- Server = http://red45.org/archlinux
742
+ Server = http://intothesaltmine.org/archlinux
677
743
  ' >> /etc/pacman.conf
678
744
  }
679
745
 
@@ -706,45 +772,43 @@ install_arch_post() {
706
772
  # FreeBSD Install Functions
707
773
  #
708
774
  install_freebsd_90_stable_deps() {
709
- if [ "$CPU_VENDOR_ID_L" = "AuthenticAMD" -a $CPU_ARCH_L = "x86_64" ]; then
710
- local ARCH="amd64"
711
- elif [ "$CPU_VENDOR_ID_L" = "GenuineIntel" -a $CPU_ARCH_L = "x86_64" ]; then
775
+ if [ $CPU_ARCH_L = "amd64" ]; then
712
776
  local ARCH="x86:64"
713
- elif [ "$CPU_VENDOR_ID_L" = "GenuineIntel" -a $CPU_ARCH_L = "i386" ]; then
714
- local ARCH="i386"
715
- elif [ "$CPU_VENDOR_ID_L" = "GenuineIntel" -a $CPU_ARCH_L = "i686" ]; then
777
+ elif [ $CPU_ARCH_L = "x86_64" ]; then
778
+ local ARCH="x86:64"
779
+ elif [ $CPU_ARCH_L = "i386" ]; then
780
+ local ARCH="x86:32"
781
+ elif [ $CPU_ARCH_L = "i686" ]; then
716
782
  local ARCH="x86:32"
717
- else
718
- local ARCH=$CPU_ARCH
719
783
  fi
720
784
 
721
- portsnap fetch extract update
722
- cd /usr/ports/ports-mgmt/pkg
723
- make install clean
724
- cd
785
+ fetch http://pkgbeta.freebsd.org/freebsd:9:${ARCH}/latest/Latest/pkg.txz
786
+ tar xf ./pkg.txz -s ",/.*/,,g" "*/pkg-static"
787
+ ./pkg-static add ./pkg.txz
725
788
  /usr/local/sbin/pkg2ng
726
- echo "PACKAGESITE: http://pkgbeta.freebsd.org/freebsd-9-${ARCH}/latest" > /usr/local/etc/pkg.conf
789
+ echo "PACKAGESITE: http://pkgbeta.freebsd.org/freebsd:9:${ARCH}/latest" > /usr/local/etc/pkg.conf
790
+
791
+ /usr/local/sbin/pkg install -y swig
727
792
  }
728
793
 
729
794
  install_freebsd_git_deps() {
730
- if [ "$CPU_VENDOR_ID_L" = "AuthenticAMD" -a $CPU_ARCH_L = "x86_64" ]; then
731
- local ARCH="amd64"
732
- elif [ "$CPU_VENDOR_ID_L" = "GenuineIntel" -a $CPU_ARCH_L = "x86_64" ]; then
795
+ if [ $CPU_ARCH_L = "amd64" ]; then
733
796
  local ARCH="x86:64"
734
- elif [ "$CPU_VENDOR_ID_L" = "GenuineIntel" -a $CPU_ARCH_L = "i386" ]; then
735
- local ARCH="i386"
736
- elif [ "$CPU_VENDOR_ID_L" = "GenuineIntel" -a $CPU_ARCH_L = "i686" ]; then
797
+ elif [ $CPU_ARCH_L = "x86_64" ]; then
798
+ local ARCH="x86:64"
799
+ elif [ $CPU_ARCH_L = "i386" ]; then
800
+ local ARCH="x86:32"
801
+ elif [ $CPU_ARCH_L = "i686" ]; then
737
802
  local ARCH="x86:32"
738
- else
739
- local ARCH=$CPU_ARCH
740
803
  fi
741
804
 
742
- portsnap fetch extract update
743
- cd /usr/ports/ports-mgmt/pkg
744
- make install clean
745
- cd
805
+ fetch http://pkgbeta.freebsd.org/freebsd:9:${ARCH}/latest/Latest/pkg.txz
806
+ tar xf ./pkg.txz -s ",/.*/,,g" "*/pkg-static"
807
+ ./pkg-static add ./pkg.txz
746
808
  /usr/local/sbin/pkg2ng
747
- echo "PACKAGESITE: http://pkgbeta.freebsd.org/freebsd-9-${ARCH}/latest" > /usr/local/etc/pkg.conf
809
+ echo "PACKAGESITE: http://pkgbeta.freebsd.org/freebsd:9:${ARCH}/latest" > /usr/local/etc/pkg.conf
810
+
811
+ /usr/local/sbin/pkg install -y swig
748
812
  }
749
813
 
750
814
  install_freebsd_90_stable() {
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "vagrant-salt"
6
- s.version = "0.2.0"
6
+ s.version = "0.3.1"
7
7
  s.authors = ["Alec Koumjian", "Kiall Mac Innes", "Pedro Algarvio"]
8
8
  s.email = ["akoumjian@gmail.com", "kiall@managedit.ie", "pedro@algarvio.me"]
9
9
  s.homepage = "https://github.com/saltstack/salty-vagrant"
@@ -16,4 +16,28 @@ Gem::Specification.new do |s|
16
16
  s.require_paths = ["lib"]
17
17
 
18
18
  s.add_runtime_dependency "vagrant"
19
+
20
+ # get an array of submodule dirs by executing 'pwd' inside each submodule
21
+ `git submodule --quiet foreach pwd`.split($\).each do |submodule_path|
22
+ # for each submodule, change working directory to that submodule
23
+ Dir.chdir(submodule_path) do
24
+
25
+ # issue git ls-files in submodule's directory
26
+ submodule_files = `git ls-files`.split("\n")
27
+
28
+ # prepend the submodule path to create absolute file paths
29
+ submodule_files_fullpaths = submodule_files.map do |filename|
30
+ "#{submodule_path}/#{filename}"
31
+ end
32
+
33
+ # remove leading path parts to get paths relative to the gem's root dir
34
+ submodule_files_paths = submodule_files_fullpaths.map do |filename|
35
+ filename.gsub "#{File.dirname(File.expand_path(File.dirname(__FILE__)))}/", ""
36
+ end
37
+
38
+ # add relative paths to gem.files
39
+ s.files += submodule_files_paths
40
+ end
41
+ end
42
+
19
43
  end
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 2
8
- - 0
9
- version: 0.2.0
7
+ - 3
8
+ - 1
9
+ version: 0.3.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Alec Koumjian
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2012-11-28 00:00:00 -08:00
19
+ date: 2012-12-20 00:00:00 -08:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
@@ -44,6 +44,7 @@ extra_rdoc_files: []
44
44
 
45
45
  files:
46
46
  - .gitignore
47
+ - .gitmodules
47
48
  - Gemfile
48
49
  - README.rst
49
50
  - Rakefile
@@ -56,8 +57,9 @@ files:
56
57
  - lib/vagrant-salt.rb
57
58
  - lib/vagrant-salt/provisioner.rb
58
59
  - lib/vagrant_init.rb
59
- - scripts/bootstrap-salt-minion.sh
60
60
  - vagrant-salt.gemspec
61
+ - scripts/README.rst
62
+ - scripts/bootstrap-salt-minion.sh
61
63
  has_rdoc: true
62
64
  homepage: https://github.com/saltstack/salty-vagrant
63
65
  licenses: []