kitchen-ansible 0.0.4 → 0.0.5
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.
|
@@ -46,7 +46,7 @@ module Kitchen
|
|
|
46
46
|
default_config :ansible_version, nil
|
|
47
47
|
default_config :require_ansible_repo, true
|
|
48
48
|
default_config :extra_vars, {}
|
|
49
|
-
default_config :ansible_apt_repo, "ppa:
|
|
49
|
+
default_config :ansible_apt_repo, "ppa:ansible/ansible"
|
|
50
50
|
default_config :ansible_yum_repo, "https://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm"
|
|
51
51
|
default_config :chef_bootstrap_url, "https://www.getchef.com/chef/install.sh"
|
|
52
52
|
|
|
@@ -76,6 +76,7 @@ module Kitchen
|
|
|
76
76
|
provisioner.calculate_path('Ansiblefile', :file)
|
|
77
77
|
end
|
|
78
78
|
|
|
79
|
+
default_config :requirements_path, false
|
|
79
80
|
default_config :ansible_verbose, false
|
|
80
81
|
default_config :ansible_verbosity, 1
|
|
81
82
|
default_config :ansible_noop, false # what is ansible equivalent of dry_run???? ##JMC: I think it's [--check mode](http://docs.ansible.com/playbooks_checkmode.html) TODO: Look into this...
|
|
@@ -213,20 +214,33 @@ module Kitchen
|
|
|
213
214
|
end
|
|
214
215
|
|
|
215
216
|
def install_busser
|
|
216
|
-
|
|
217
|
+
install = ''
|
|
218
|
+
install << <<-INSTALL
|
|
217
219
|
#{Util.shell_helpers}
|
|
218
|
-
#
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
then
|
|
224
|
-
echo "-----> Installing Chef Omnibus to install busser to run tests"
|
|
225
|
-
do_download #{chef_url} /tmp/install.sh
|
|
226
|
-
#{sudo('sh')} /tmp/install.sh
|
|
220
|
+
# Fix for https://github.com/test-kitchen/busser/issues/12
|
|
221
|
+
if [ -h /usr/bin/ruby ]; then
|
|
222
|
+
L=$(readlink -f /usr/bin/ruby)
|
|
223
|
+
#{sudo('rm')} /usr/bin/ruby
|
|
224
|
+
#{sudo('ln')} -s $L /usr/bin/ruby
|
|
227
225
|
fi
|
|
228
226
|
INSTALL
|
|
229
|
-
|
|
227
|
+
if chef_url then
|
|
228
|
+
install << <<-INSTALL
|
|
229
|
+
# install chef omnibus so that busser works as this is needed to run tests :(
|
|
230
|
+
# TODO: work out how to install enough ruby
|
|
231
|
+
# and set busser: { :ruby_bindir => '/usr/bin/ruby' } so that we dont need the
|
|
232
|
+
# whole chef client
|
|
233
|
+
if [ ! -d "/opt/chef" ]
|
|
234
|
+
then
|
|
235
|
+
echo "-----> Installing Chef Omnibus to install busser to run tests"
|
|
236
|
+
do_download #{chef_url} /tmp/install.sh
|
|
237
|
+
#{sudo('sh')} /tmp/install.sh
|
|
238
|
+
fi
|
|
239
|
+
INSTALL
|
|
240
|
+
end
|
|
241
|
+
|
|
242
|
+
install
|
|
243
|
+
end
|
|
230
244
|
|
|
231
245
|
def init_command
|
|
232
246
|
dirs = %w{modules roles group_vars host_vars}.
|
|
@@ -275,6 +289,13 @@ module Kitchen
|
|
|
275
289
|
sudo('cp -r'), File.join(config[:root_path],'host_vars'), '/etc/ansible/.',
|
|
276
290
|
].join(' ')
|
|
277
291
|
|
|
292
|
+
if galaxy_requirements
|
|
293
|
+
commands << [
|
|
294
|
+
sudo('ansible-galaxy'), 'install', '--force',
|
|
295
|
+
'-r', File.join(config[:root_path], galaxy_requirements),
|
|
296
|
+
].join(' ')
|
|
297
|
+
end
|
|
298
|
+
|
|
278
299
|
command = commands.join(' && ')
|
|
279
300
|
debug(command)
|
|
280
301
|
command
|
|
@@ -321,6 +342,10 @@ module Kitchen
|
|
|
321
342
|
config[:ansiblefile_path] or ''
|
|
322
343
|
end
|
|
323
344
|
|
|
345
|
+
def galaxy_requirements
|
|
346
|
+
config[:requirements_path] or nil
|
|
347
|
+
end
|
|
348
|
+
|
|
324
349
|
def playbook
|
|
325
350
|
config[:playbook]
|
|
326
351
|
end
|
|
@@ -406,6 +431,10 @@ module Kitchen
|
|
|
406
431
|
debug("Using roles from #{roles}")
|
|
407
432
|
|
|
408
433
|
resolve_with_librarian if File.exists?(ansiblefile)
|
|
434
|
+
|
|
435
|
+
if galaxy_requirements
|
|
436
|
+
FileUtils.cp(galaxy_requirements, File.join(sandbox_path, galaxy_requirements))
|
|
437
|
+
end
|
|
409
438
|
|
|
410
439
|
# Detect whether we are running tests on a role
|
|
411
440
|
# If so, make sure to copy into VM so dir structure is like: /tmp/kitchen/roles/role_name
|
data/provisioner_options.md
CHANGED
|
@@ -22,6 +22,7 @@ ansible_verbosity| 1| Sets the verbosity flag appropriately (e.g.: `1 => '-v', 2
|
|
|
22
22
|
update_package_repos| true| update OS repository metadata
|
|
23
23
|
chef_bootstrap_url |"https://www.getchef.com/chef/install.sh"| the chef (needed for busser to run tests)
|
|
24
24
|
ansiblefile_path | | Path to Ansiblefile
|
|
25
|
+
requirements_path | | Path to ansible-galaxy requirements
|
|
25
26
|
|
|
26
27
|
## Configuring Provisioner Options
|
|
27
28
|
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: kitchen-ansible
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.5
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date:
|
|
12
|
+
date: 2015-01-05 00:00:00.000000000 Z
|
|
13
13
|
dependencies: []
|
|
14
14
|
description: ! '== DESCRIPTION:
|
|
15
15
|
|