vagrant-salt 0.3.2 → 0.4.0
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.
- data/README.rst +131 -170
- data/example/complete/Vagrantfile +67 -0
- data/example/complete/salt/custom-bootstrap-salt.sh +2425 -0
- data/example/complete/salt/key/master.pem +30 -0
- data/example/complete/salt/key/master.pub +14 -0
- data/example/complete/salt/key/minion.pem +30 -0
- data/example/complete/salt/key/minion.pub +14 -0
- data/example/complete/salt/master +459 -0
- data/example/{salt/minion.conf → complete/salt/minion} +1 -2
- data/example/{salt → complete/salt}/roots/pillar/top.sls +0 -0
- data/example/complete/salt/roots/salt/nginx.sls +5 -0
- data/example/complete/salt/roots/salt/top.sls +3 -0
- data/example/masterless/Vagrantfile +18 -0
- data/example/masterless/salt/minion +219 -0
- data/example/{salt/roots/salt → masterless/salt/roots/pillar}/top.sls +0 -0
- data/example/masterless/salt/roots/salt/nginx.sls +5 -0
- data/example/masterless/salt/roots/salt/top.sls +3 -0
- data/lib/vagrant-salt.rb +16 -3
- data/lib/vagrant-salt/config.rb +103 -0
- data/lib/vagrant-salt/errors.rb +11 -0
- data/lib/vagrant-salt/plugin.rb +31 -0
- data/lib/vagrant-salt/provisioner.rb +211 -104
- data/lib/vagrant-salt/version.rb +5 -0
- data/scripts/.travis.yml +16 -0
- data/scripts/ChangeLog +39 -0
- data/scripts/LICENSE +16 -0
- data/scripts/README.rst +124 -35
- data/scripts/bootstrap-salt-minion.sh +1815 -381
- data/scripts/bootstrap-salt.sh +2425 -0
- data/scripts/salt-bootstrap.sh +2425 -0
- data/scripts/tests/README.rst +38 -0
- data/scripts/tests/bootstrap/__init__.py +11 -0
- data/{example/salt/key/KEYPAIR_GOES_HERE → scripts/tests/bootstrap/ext/__init__.py} +0 -0
- data/scripts/tests/bootstrap/ext/console.py +100 -0
- data/scripts/tests/bootstrap/ext/os_data.py +199 -0
- data/scripts/tests/bootstrap/test_install.py +586 -0
- data/scripts/tests/bootstrap/test_lint.py +27 -0
- data/scripts/tests/bootstrap/test_usage.py +28 -0
- data/scripts/tests/bootstrap/unittesting.py +216 -0
- data/scripts/tests/ext/checkbashisms +640 -0
- data/scripts/tests/install-testsuite-deps.py +99 -0
- data/scripts/tests/runtests.py +207 -0
- data/templates/locales/en.yml +14 -0
- data/vagrant-salt.gemspec +2 -2
- metadata +43 -10
- data/example/Vagrantfile +0 -26
- data/lib/vagrant_init.rb +0 -1
@@ -1,134 +1,241 @@
|
|
1
|
-
module
|
2
|
-
|
3
|
-
class
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
def minion_config; @minion_config || "salt/minion.conf"; end
|
13
|
-
def temp_config_dir; @temp_config_dir || "/tmp/"; end
|
14
|
-
def minion_key; @minion_key || false; end
|
15
|
-
def minion_pub; @minion_pub || false; end
|
16
|
-
def run_highstate; @run_highstate || false; end
|
17
|
-
def salt_install_type; @salt_install_type || ''; end
|
18
|
-
def salt_install_args; @salt_install_args || ''; end
|
19
|
-
|
20
|
-
|
21
|
-
def expanded_path(root_path, rel_path)
|
22
|
-
Pathname.new(rel_path).expand_path(root_path)
|
1
|
+
module VagrantPlugins
|
2
|
+
module Salt
|
3
|
+
class Provisioner < Vagrant.plugin("2", :provisioner)
|
4
|
+
|
5
|
+
|
6
|
+
def provision
|
7
|
+
upload_configs
|
8
|
+
upload_keys
|
9
|
+
run_bootstrap_script
|
10
|
+
accept_keys
|
11
|
+
call_highstate
|
23
12
|
end
|
24
13
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
options = options + '-c %s' % temp_config_dir
|
29
|
-
end
|
30
|
-
options = options + ' %s %s' % [salt_install_type, salt_install_args]
|
31
|
-
return options
|
14
|
+
## Utilities
|
15
|
+
def expanded_path(rel_path)
|
16
|
+
Pathname.new(rel_path).expand_path(@machine.env.root_path)
|
32
17
|
end
|
33
|
-
end
|
34
18
|
|
35
|
-
|
36
|
-
|
37
|
-
|
19
|
+
def binaries_found
|
20
|
+
## Determine States, ie: install vs configure
|
21
|
+
desired_binaries = []
|
22
|
+
if !@config.no_minion
|
23
|
+
desired_binaries.push('salt-minion')
|
24
|
+
desired_binaries.push('salt-call')
|
25
|
+
end
|
26
|
+
|
27
|
+
if @config.install_master
|
28
|
+
desired_binaries.push('salt-master')
|
29
|
+
end
|
38
30
|
|
39
|
-
|
40
|
-
|
41
|
-
|
31
|
+
if @config.install_syndic
|
32
|
+
desired_binaries.push('salt-syndic')
|
33
|
+
end
|
34
|
+
|
35
|
+
found = true
|
36
|
+
for binary in desired_binaries
|
37
|
+
@machine.env.ui.info "Checking if %s is installed" % binary
|
38
|
+
if !@machine.communicate.test("which %s" % binary)
|
39
|
+
@machine.env.ui.info "%s was not found." % binary
|
40
|
+
found = false
|
41
|
+
else
|
42
|
+
@machine.env.ui.info "%s found" % binary
|
43
|
+
end
|
44
|
+
end
|
42
45
|
|
43
|
-
|
44
|
-
@expanded_minion_key_path = config.expanded_path(env[:root_path], config.minion_key)
|
45
|
-
@expanded_minion_pub_path = config.expanded_path(env[:root_path], config.minion_pub)
|
46
|
+
return found
|
46
47
|
end
|
47
|
-
end
|
48
48
|
|
49
|
-
|
50
|
-
|
51
|
-
if env[:vm].channel.test("which salt-call") and
|
52
|
-
env[:vm].channel.test("which salt-minion")
|
53
|
-
return true
|
49
|
+
def need_configure
|
50
|
+
@config.minion_config or @config.minion_key
|
54
51
|
end
|
55
|
-
env[:ui].info "Salt binaries not found."
|
56
|
-
return false
|
57
|
-
end
|
58
52
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
if data[0] == "\n"
|
66
|
-
# Remove any leading newline but not whitespace. If we wanted to
|
67
|
-
# remove newlines and whitespace we would have used data.lstrip
|
68
|
-
data = data[1..-1]
|
69
|
-
end
|
70
|
-
env[:ui].info(data.rstrip)
|
53
|
+
def need_install
|
54
|
+
if @config.always_install
|
55
|
+
return true
|
56
|
+
else
|
57
|
+
return !binaries_found()
|
58
|
+
end
|
71
59
|
end
|
72
|
-
|
73
|
-
|
60
|
+
|
61
|
+
def temp_config_dir
|
62
|
+
return @config.temp_config_dir || "/tmp"
|
74
63
|
end
|
75
|
-
env[:ui].info "Salt binaries installed on VM."
|
76
|
-
end
|
77
64
|
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
end
|
65
|
+
# Generates option string for bootstrap script
|
66
|
+
def bootstrap_options(install, configure, config_dir)
|
67
|
+
options = ""
|
82
68
|
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
env[:vm].channel.sudo("salt-call saltutil.sync_all")
|
87
|
-
env[:vm].channel.sudo("salt-call state.highstate") do |type, data|
|
88
|
-
env[:ui].info(data)
|
69
|
+
## Any extra options passed to bootstrap
|
70
|
+
if @config.bootstrap_options
|
71
|
+
options = "%s %s" % [options, @config.bootstrap_options]
|
89
72
|
end
|
90
|
-
|
91
|
-
|
73
|
+
|
74
|
+
if configure
|
75
|
+
options = "%s -c %s" % [options, config_dir]
|
76
|
+
end
|
77
|
+
|
78
|
+
if configure and !install
|
79
|
+
options = "%s -C" % options
|
80
|
+
else
|
81
|
+
|
82
|
+
if @config.install_master
|
83
|
+
options = "%s -M" % options
|
84
|
+
end
|
85
|
+
|
86
|
+
if @config.install_syndic
|
87
|
+
options = "%s -S" % options
|
88
|
+
end
|
89
|
+
|
90
|
+
if @config.no_minion
|
91
|
+
options = "%s -N" % options
|
92
|
+
end
|
93
|
+
|
94
|
+
if @config.install_type
|
95
|
+
options = "%s %s" % [options, @config.install_type]
|
96
|
+
end
|
97
|
+
|
98
|
+
if @config.install_args
|
99
|
+
options = "%s %s" % [options, @config.install_args]
|
100
|
+
end
|
101
|
+
end
|
102
|
+
if @config.verbose
|
103
|
+
@machine.env.ui.info "Using Bootstrap Options: %s" % options
|
104
|
+
end
|
105
|
+
return options
|
92
106
|
end
|
93
|
-
end
|
94
107
|
|
95
|
-
def upload_minion_config
|
96
|
-
env[:ui].info "Copying salt minion config to vm."
|
97
|
-
env[:vm].channel.upload(@expanded_minion_config_path.to_s, config.temp_config_dir + "minion")
|
98
|
-
end
|
99
108
|
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
109
|
+
## Actions
|
110
|
+
# Copy master and minion configs to VM
|
111
|
+
def upload_configs
|
112
|
+
if @config.minion_config
|
113
|
+
@machine.env.ui.info "Copying salt minion config to vm."
|
114
|
+
@machine.communicate.upload(expanded_path(@config.minion_config).to_s, temp_config_dir + "/minion")
|
115
|
+
end
|
105
116
|
|
106
|
-
|
117
|
+
if @config.master_config
|
118
|
+
@machine.env.ui.info "Copying salt master config to vm."
|
119
|
+
@machine.communicate.upload(expanded_path(@config.master_config).to_s, temp_config_dir + "/master")
|
120
|
+
end
|
121
|
+
end
|
107
122
|
|
108
|
-
|
123
|
+
# Copy master and minion keys to VM
|
124
|
+
def upload_keys
|
125
|
+
if @config.minion_key and @config.minion_pub
|
126
|
+
@machine.env.ui.info "Uploading minion keys."
|
127
|
+
@machine.communicate.upload(expanded_path(@config.minion_key).to_s, temp_config_dir + "/minion.pem")
|
128
|
+
@machine.communicate.upload(expanded_path(@config.minion_pub).to_s, temp_config_dir + "/minion.pub")
|
129
|
+
end
|
109
130
|
|
110
|
-
|
111
|
-
|
131
|
+
if @config.master_key and @config.master_pub
|
132
|
+
@machine.env.ui.info "Uploading master keys."
|
133
|
+
@machine.communicate.upload(expanded_path(@config.master_key).to_s, temp_config_dir + "/master.pem")
|
134
|
+
@machine.communicate.upload(expanded_path(@config.master_pub).to_s, temp_config_dir + "/master.pub")
|
135
|
+
end
|
112
136
|
end
|
113
137
|
|
114
|
-
|
115
|
-
|
138
|
+
# Get bootstrap file location, bundled or custom
|
139
|
+
def get_bootstrap
|
140
|
+
if @config.bootstrap_script
|
141
|
+
bootstrap_abs_path = expanded_path(@config.bootstrap_script)
|
142
|
+
else
|
143
|
+
bootstrap_abs_path = Pathname.new("../../../scripts/bootstrap-salt.sh").expand_path(__FILE__)
|
144
|
+
end
|
145
|
+
return bootstrap_abs_path
|
116
146
|
end
|
117
147
|
|
118
|
-
|
119
|
-
|
148
|
+
# Determine if we are configure and/or installing, then do either
|
149
|
+
def run_bootstrap_script
|
150
|
+
install = need_install()
|
151
|
+
configure = need_configure()
|
152
|
+
config_dir = temp_config_dir()
|
153
|
+
options = bootstrap_options(install, configure, config_dir)
|
154
|
+
|
155
|
+
if configure or install
|
156
|
+
|
157
|
+
if configure and !install
|
158
|
+
@machine.env.ui.info "Salt binaries found. Configuring only."
|
159
|
+
else
|
160
|
+
@machine.env.ui.info "Bootstrapping Salt... (this may take a while)"
|
161
|
+
end
|
162
|
+
|
163
|
+
bootstrap_path = get_bootstrap()
|
164
|
+
bootstrap_destination = File.join(config_dir, "bootstrap_salt.sh")
|
165
|
+
@machine.communicate.upload(bootstrap_path.to_s, bootstrap_destination)
|
166
|
+
@machine.communicate.sudo("chmod +x %s" % bootstrap_destination)
|
167
|
+
bootstrap = @machine.communicate.sudo("%s %s" % [bootstrap_destination, options]) do |type, data|
|
168
|
+
if data[0] == "\n"
|
169
|
+
# Remove any leading newline but not whitespace. If we wanted to
|
170
|
+
# remove newlines and whitespace we would have used data.lstrip
|
171
|
+
data = data[1..-1]
|
172
|
+
end
|
173
|
+
if @config.verbose
|
174
|
+
@machine.env.ui.info(data.rstrip)
|
175
|
+
end
|
176
|
+
end
|
177
|
+
if !bootstrap
|
178
|
+
raise Salt::Errors::SaltError, :bootstrap_failed
|
179
|
+
end
|
180
|
+
|
181
|
+
if configure and !install
|
182
|
+
@machine.env.ui.info "Salt successfully configured!"
|
183
|
+
elsif configure and install
|
184
|
+
@machine.env.ui.info "Salt successfully configured and installed!"
|
185
|
+
elsif !configure and install
|
186
|
+
@machine.env.ui.info "Salt successfully installed!"
|
187
|
+
end
|
188
|
+
|
189
|
+
else
|
190
|
+
@machine.env.ui.info "Salt did not need installing or configuring."
|
191
|
+
end
|
192
|
+
end
|
120
193
|
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
194
|
+
def accept_keys
|
195
|
+
if @config.accept_keys
|
196
|
+
if !@machine.communicate.test("which salt-key")
|
197
|
+
@machine.env.ui.info "Salt-key not installed!"
|
198
|
+
else
|
199
|
+
@machine.env.ui.info "Waiting for minion key..."
|
200
|
+
key_staged = false
|
201
|
+
attempts = 0
|
202
|
+
while !key_staged
|
203
|
+
attempts += 1
|
204
|
+
@machine.communicate.sudo("salt-key -l pre | wc -l") do |type, output|
|
205
|
+
begin
|
206
|
+
output = Integer(output)
|
207
|
+
if output > 1
|
208
|
+
key_staged = true
|
209
|
+
end
|
210
|
+
rescue
|
211
|
+
end
|
212
|
+
end
|
213
|
+
sleep 1
|
214
|
+
if attempts > 10
|
215
|
+
raise Salt::Errors::SaltError, :not_received_minion_key
|
216
|
+
end
|
217
|
+
end
|
218
|
+
|
219
|
+
@machine.env.ui.info "Accepting minion key."
|
220
|
+
@machine.communicate.sudo("salt-key -A")
|
221
|
+
end
|
127
222
|
end
|
128
223
|
end
|
129
|
-
end
|
130
|
-
end
|
131
224
|
|
132
|
-
|
225
|
+
def call_highstate
|
226
|
+
if @config.run_highstate
|
227
|
+
@machine.env.ui.info "Calling state.highstate... (this may take a while)"
|
228
|
+
@machine.communicate.sudo("salt-call saltutil.sync_all")
|
229
|
+
@machine.communicate.sudo("salt-call state.highstate -l debug") do |type, data|
|
230
|
+
if @config.verbose
|
231
|
+
@machine.env.ui.info(data)
|
232
|
+
end
|
233
|
+
end
|
234
|
+
else
|
235
|
+
@machine.env.ui.info "run_highstate set to false. Not running state.highstate."
|
236
|
+
end
|
237
|
+
end
|
133
238
|
|
134
|
-
|
239
|
+
end
|
240
|
+
end
|
241
|
+
end
|
data/scripts/.travis.yml
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
before_install:
|
2
|
+
- "if [[ $TRAVIS_PYTHON_VERSION == '2.6' ]]; then sudo pip install unittest2; fi"
|
3
|
+
- sudo pip install unittest-xml-reporting
|
4
|
+
- sudo apt-get remove -y -o DPkg::Options::=--force-confold --purge libzmq3
|
5
|
+
- sudo apt-get autoremove -y -o DPkg::Options::=--force-confold --purge
|
6
|
+
- sudo ls -lah /etc/apt/sources.list.d/
|
7
|
+
- sudo rm -f /etc/apt/sources.list.d/travis_ci_zeromq3-source.list
|
8
|
+
|
9
|
+
script:
|
10
|
+
- BS_ECHO_DEBUG=1 sudo -E python tests/runtests.py -vv
|
11
|
+
|
12
|
+
notifications:
|
13
|
+
irc:
|
14
|
+
channels: "irc.freenode.org#salt-devel"
|
15
|
+
on_success: change
|
16
|
+
on_failure: change
|
data/scripts/ChangeLog
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
Version 1.5.2:
|
2
|
+
* Fix issue with travis testing(it installs it's own ZeroMQ3 lib
|
3
|
+
* Allow setting the debug output from an environment variable
|
4
|
+
* Fix an escape issue in the `printf` calls used in our echo calls
|
5
|
+
* Don't overwrite files(config, init.d, etc). Use a specific flag to
|
6
|
+
force overwrites.
|
7
|
+
* Distro Support Fixed:
|
8
|
+
* Ubuntu daily installs.
|
9
|
+
* Distro Support Added:
|
10
|
+
* Trisquel 6.0 (Ubuntu 12.04)
|
11
|
+
|
12
|
+
Version 1.5.1:
|
13
|
+
* Improved unittesting.
|
14
|
+
* Starting daemons.
|
15
|
+
* Make sure that daemons are really running.
|
16
|
+
* For the users to make the choice if installing from PIP(if required
|
17
|
+
since there aren't system pacakges).
|
18
|
+
* Fixed salt's git cloning when the salt git tree is already present on
|
19
|
+
the system.
|
20
|
+
* Distro Support Fixed:
|
21
|
+
* Debian 6
|
22
|
+
* Ubuntu 12.10
|
23
|
+
* CentOS
|
24
|
+
* Distro Support Added:
|
25
|
+
* SuSE 11 SP1/11 SP2
|
26
|
+
* OpenSUSE 12.x
|
27
|
+
|
28
|
+
Version 1.5:
|
29
|
+
* First stable version of the script
|
30
|
+
* Support for:
|
31
|
+
* Ubuntu 10.x/11.x/12.x
|
32
|
+
* Debian 6.x
|
33
|
+
* CentOS 5/6
|
34
|
+
* Red Hat 5/6
|
35
|
+
* Red Hat Enterprise 5/6
|
36
|
+
* Fedora
|
37
|
+
* Arch
|
38
|
+
* SmartOS
|
39
|
+
* FreeBSD 9.0
|
data/scripts/LICENSE
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
Salt Bootstrap - Generic Salt Bootstrap Script
|
2
|
+
|
3
|
+
Copyright 2012-2013 Salt Stack (saltstack.org)
|
4
|
+
|
5
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
you may not use this file except in compliance with the License.
|
7
|
+
You may obtain a copy of the License at
|
8
|
+
|
9
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
|
11
|
+
Unless required by applicable law or agreed to in writing, software
|
12
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
See the License for the specific language governing permissions and
|
15
|
+
limitations under the License.
|
16
|
+
|
data/scripts/README.rst
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
+
==================
|
1
2
|
Bootstrapping Salt
|
2
3
|
==================
|
3
4
|
|
4
|
-
Before `Salt`_ can be used for provisioning on the desired machine, the
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
version to then install the `Salt`_ binaries using the appropriate methods.
|
5
|
+
Before `Salt`_ can be used for provisioning on the desired machine, the binaries need to be
|
6
|
+
installed. Since `Salt`_ supports many different distributions and versions of operating systems,
|
7
|
+
the `Salt`_ installation process is handled by this shell script ``bootstrap-salt.sh``. This
|
8
|
+
script runs through a series of checks to determine operating system type and version to then
|
9
|
+
install the `Salt`_ binaries using the appropriate methods.
|
10
10
|
|
11
11
|
|
12
12
|
One Line Bootstrap
|
@@ -18,15 +18,24 @@ For example, using ``curl`` to install latest git:
|
|
18
18
|
|
19
19
|
.. code:: console
|
20
20
|
|
21
|
-
curl -L http://bootstrap.saltstack.org | sudo sh -s git develop
|
21
|
+
curl -L http://bootstrap.saltstack.org | sudo sh -s -- git develop
|
22
|
+
|
23
|
+
|
24
|
+
If you have certificate issues using ``curl``, try the following:
|
25
|
+
|
26
|
+
.. code:: console
|
27
|
+
|
28
|
+
curl --insecure -L http://bootstrap.saltstack.org | sudo sh -s -- git develop
|
22
29
|
|
23
30
|
|
24
|
-
|
31
|
+
|
32
|
+
Using ``wget`` to install your distribution's stable packages:
|
25
33
|
|
26
34
|
.. code:: console
|
27
35
|
|
28
36
|
wget -O - http://bootstrap.saltstack.org | sudo sh
|
29
37
|
|
38
|
+
|
30
39
|
If you have certificate issues using ``wget`` try the following:
|
31
40
|
|
32
41
|
.. code:: console
|
@@ -34,11 +43,36 @@ If you have certificate issues using ``wget`` try the following:
|
|
34
43
|
wget --no-check-certificate -O - http://bootstrap.saltstack.org | sudo sh
|
35
44
|
|
36
45
|
|
37
|
-
|
46
|
+
|
47
|
+
If you already have python installed, ``python 2.6``, then it's as easy as:
|
48
|
+
|
49
|
+
.. code:: console
|
50
|
+
|
51
|
+
python -m urllib "http://bootstrap.saltstack.org" | sudo sh -s -- git develop
|
52
|
+
|
53
|
+
|
54
|
+
All python versions should support the following one liner:
|
55
|
+
|
56
|
+
.. code:: console
|
57
|
+
|
58
|
+
python -c 'import urllib; print urllib.urlopen("http://bootstrap.saltstack.org").read()' | \
|
59
|
+
sudo sh -s -- git develop
|
60
|
+
|
61
|
+
|
62
|
+
On a FreeBSD base system you usually don't have either of the above binaries available. You **do**
|
63
|
+
have ``fetch`` available though:
|
64
|
+
|
65
|
+
.. code:: console
|
66
|
+
|
67
|
+
fetch -o - http://bootstrap.saltstack.org | sudo sh
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
If all you want is to install a ``salt-master`` using latest git:
|
38
72
|
|
39
73
|
.. code:: console
|
40
74
|
|
41
|
-
|
75
|
+
curl -L http://bootstrap.saltstack.org | sudo sh -s -- -M -N git develop
|
42
76
|
|
43
77
|
|
44
78
|
|
@@ -50,54 +84,81 @@ In order to install salt for a distribution you need to define:
|
|
50
84
|
|
51
85
|
.. code:: bash
|
52
86
|
|
53
|
-
install_<distro>_<
|
54
|
-
install_<distro>_<
|
87
|
+
install_<distro>_<major_version>_<install_type>_deps
|
88
|
+
install_<distro>_<major_version>_<minor_version>_<install_type>_deps
|
89
|
+
install_<distro>_<major_version>_deps
|
90
|
+
install_<distro>_<major_version>_<minor_version>_deps
|
55
91
|
install_<distro>_<install_type>_deps
|
56
92
|
install_<distro>_deps
|
57
93
|
|
58
94
|
|
59
|
-
2.
|
95
|
+
2. Optionally, define a minion configuration function, which will be called if the
|
96
|
+
``-c|config-dir`` option is passed. One of:
|
60
97
|
|
61
98
|
.. code:: bash
|
62
99
|
|
63
|
-
|
64
|
-
|
100
|
+
config_<distro>_<major_version>_<install_type>_salt
|
101
|
+
config_<distro>_<major_version>_<minor_version>_<install_type>_salt
|
102
|
+
config_<distro>_<major_version>_salt
|
103
|
+
config_<distro>_<major_version>_<minor_version>_salt
|
104
|
+
config_<distro>_<install_type>_salt
|
105
|
+
config_<distro>_salt
|
106
|
+
config_salt [THIS ONE IS ALREADY DEFINED AS THE DEFAULT]
|
65
107
|
|
66
108
|
|
67
|
-
3.
|
68
|
-
the ``-c|config-dir`` option is passed. One of:
|
109
|
+
3. To install salt, which, of course, is required, one of:
|
69
110
|
|
70
111
|
.. code:: bash
|
71
112
|
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
config_<distro>_minion
|
76
|
-
config_minion [THIS ONE IS ALREADY DEFINED AS THE DEFAULT]
|
113
|
+
install_<distro>_<major_version>_<install_type>
|
114
|
+
install_<distro>_<major_version>_<minor_version>_<install_type>
|
115
|
+
install_<distro>_<install_type>
|
77
116
|
|
78
117
|
|
79
|
-
4.
|
118
|
+
4. Optionally, define a post install function, one of:
|
80
119
|
|
81
120
|
.. code:: bash
|
82
121
|
|
83
|
-
install_<distro>_<
|
84
|
-
install_<distro>_<
|
122
|
+
install_<distro>_<major_version>_<install_type>_post
|
123
|
+
install_<distro>_<major_version>_<minor_version>_<install_type>_post
|
124
|
+
install_<distro>_<major_version>_post
|
125
|
+
install_<distro>_<major_version>_<minor_version>_post
|
85
126
|
install_<distro>_<install_type>_post
|
86
127
|
install_<distro>_post
|
87
128
|
|
88
129
|
|
130
|
+
5. Optionally, define a start daemons function, one of:
|
131
|
+
|
132
|
+
.. code:: bash
|
133
|
+
|
134
|
+
install_<distro>_<major_version>_<install_type>_restart_daemons
|
135
|
+
install_<distro>_<major_version>_<minor_version>_<install_type>_restart_daemons
|
136
|
+
install_<distro>_<major_version>_restart_daemons
|
137
|
+
install_<distro>_<major_version>_<minor_version>_restart_daemons
|
138
|
+
install_<distro>_<install_type>_restart_daemons
|
139
|
+
install_<distro>_restart_daemons
|
140
|
+
|
141
|
+
|
142
|
+
.. admonition:: Attention!
|
143
|
+
|
144
|
+
The start daemons function should be able to restart any daemons which are running, or start if
|
145
|
+
they're not running.
|
146
|
+
|
147
|
+
|
148
|
+
----
|
149
|
+
|
89
150
|
Below is an example for Ubuntu Oneiric:
|
90
151
|
|
91
152
|
.. code:: bash
|
92
153
|
|
93
|
-
|
154
|
+
install_ubuntu_11_10_deps() {
|
94
155
|
apt-get update
|
95
156
|
apt-get -y install python-software-properties
|
96
157
|
add-apt-repository -y 'deb http://us.archive.ubuntu.com/ubuntu/ oneiric universe'
|
97
158
|
add-apt-repository -y ppa:saltstack/salt
|
98
159
|
}
|
99
160
|
|
100
|
-
|
161
|
+
install_ubuntu_11_10_post() {
|
101
162
|
add-apt-repository -y --remove 'deb http://us.archive.ubuntu.com/ubuntu/ oneiric universe'
|
102
163
|
}
|
103
164
|
|
@@ -105,24 +166,52 @@ Below is an example for Ubuntu Oneiric:
|
|
105
166
|
apt-get -y install salt-minion
|
106
167
|
}
|
107
168
|
|
169
|
+
install_ubuntu_restart_daemons() {
|
170
|
+
for fname in minion master syndic; do
|
171
|
+
|
172
|
+
# Skip if not meant to be installed
|
173
|
+
[ $fname = "minion" ] && [ $INSTALL_MINION -eq $BS_FALSE ] && continue
|
174
|
+
[ $fname = "master" ] && [ $INSTALL_MASTER -eq $BS_FALSE ] && continue
|
175
|
+
[ $fname = "syndic" ] && [ $INSTALL_SYNDIC -eq $BS_FALSE ] && continue
|
176
|
+
|
177
|
+
if [ -f /sbin/initctl ]; then
|
178
|
+
# We have upstart support
|
179
|
+
/sbin/initctl status salt-$fname > /dev/null 2>&1
|
180
|
+
if [ $? -eq 0 ]; then
|
181
|
+
# upstart knows about this service, let's stop and start it.
|
182
|
+
# We could restart but earlier versions of the upstart script
|
183
|
+
# did not support restart, so, it's safer this way
|
184
|
+
/sbin/initctl stop salt-$fname > /dev/null 2>&1
|
185
|
+
/sbin/initctl start salt-$fname > /dev/null 2>&1
|
186
|
+
[ $? -eq 0 ] && continue
|
187
|
+
# We failed to start the service, let's test the SysV code bellow
|
188
|
+
fi
|
189
|
+
fi
|
190
|
+
/etc/init.d/salt-$fname stop > /dev/null 2>&1
|
191
|
+
/etc/init.d/salt-$fname start &
|
192
|
+
done
|
193
|
+
}
|
194
|
+
|
108
195
|
|
109
|
-
Since there is no ``
|
110
|
-
unspecified version script.
|
196
|
+
Since there is no ``install_ubuntu_11_10_stable()`` it defaults to the unspecified version script.
|
111
197
|
|
112
|
-
The bootstrapping script must be plain POSIX sh only, **not** bash or another
|
113
|
-
|
114
|
-
|
115
|
-
made, to avoid failed or broken installations.
|
198
|
+
The bootstrapping script must be plain POSIX sh only, **not** bash or another shell script. By
|
199
|
+
design the targeting for each operating system and version is very specific. Assumptions of
|
200
|
+
supported versions or variants should not be made, to avoid failed or broken installations.
|
116
201
|
|
117
202
|
Supported Operating Systems
|
118
203
|
---------------------------
|
119
204
|
- Ubuntu 10.x/11.x/12.x
|
120
205
|
- Debian 6.x
|
121
|
-
- CentOS 6
|
206
|
+
- CentOS 5/6
|
207
|
+
- Red Hat 5/6
|
208
|
+
- Red Hat Enterprise 5/6
|
122
209
|
- Fedora
|
123
210
|
- Arch
|
124
211
|
- FreeBSD 9.0
|
125
|
-
|
212
|
+
- SmartOS
|
213
|
+
- SuSE 11 SP1/11 SP2
|
214
|
+
- OpenSUSE 12.x
|
126
215
|
|
127
216
|
|
128
217
|
|