kitchen-ansible 0.0.13 → 0.0.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +1 -0
- data/lib/kitchen-ansible/version.rb +1 -1
- data/lib/kitchen/provisioner/ansible_playbook.rb +57 -12
- data/provisioner_options.md +5 -3
- metadata +16 -28
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 7c76809e1ae3af15a1af70c8e2a3506592a5a3fa
|
4
|
+
data.tar.gz: ead9e832b47e8509069250df3b4c76f073894205
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c618628de49ae2e74afbce52a93c09b45f125174fb743e79e009d442d515899cab1ce6ebe71600a1198317a52a5fce9d62d47bc3914203a328b3f277e2e68537
|
7
|
+
data.tar.gz: da7d1fd5f358c495f082bef1d0c0d0f372123a97c73a69dc686bba5d8d5e499e7e04a5e747af22883eb57ea086c77fa0538246225eef03528f6bca3f63517eef
|
data/README.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# kitchen-ansible
|
2
2
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/kitchen-ansible.svg)](http://badge.fury.io/rb/kitchen-ansible)
|
4
|
+
[![Gem Downloads](http://ruby-gem-downloads-badge.herokuapp.com/kitchen-ansible?type=total&color=brightgreen)](https://rubygems.org/gems/kitchen-ansible)
|
4
5
|
|
5
6
|
A Test Kitchen Provisioner for Ansible
|
6
7
|
|
@@ -85,6 +85,10 @@ module Kitchen
|
|
85
85
|
provisioner.calculate_path('filter_plugins', :directory)
|
86
86
|
end
|
87
87
|
|
88
|
+
default_config :ansible_vault_password_file do |provisioner|
|
89
|
+
provisioner.calculate_path('ansible-vault-password', :file)
|
90
|
+
end
|
91
|
+
|
88
92
|
default_config :requirements_path, false
|
89
93
|
default_config :ansible_verbose, false
|
90
94
|
default_config :ansible_verbosity, 1
|
@@ -149,7 +153,7 @@ module Kitchen
|
|
149
153
|
if [ ! $(which ansible) ]; then
|
150
154
|
#{update_packages_debian_cmd}
|
151
155
|
## Install apt-utils to silence debconf warning: http://serverfault.com/q/358943/77156
|
152
|
-
#{sudo('apt-get')} -y install apt-utils
|
156
|
+
#{sudo('apt-get')} -y install apt-utils git
|
153
157
|
## Fix debconf tty warning messages
|
154
158
|
export DEBIAN_FRONTEND=noninteractive
|
155
159
|
## 13.10, 14.04 include add-apt-repository in software-properties-common
|
@@ -276,6 +280,7 @@ module Kitchen
|
|
276
280
|
prepare_host_vars
|
277
281
|
prepare_hosts
|
278
282
|
prepare_filter_plugins
|
283
|
+
prepare_ansible_vault_password_file
|
279
284
|
info('Finished Preparing files for transfer')
|
280
285
|
|
281
286
|
end
|
@@ -327,6 +332,7 @@ module Kitchen
|
|
327
332
|
ansible_verbose_flag,
|
328
333
|
ansible_check_flag,
|
329
334
|
ansible_diff_flag,
|
335
|
+
ansible_vault_flag,
|
330
336
|
extra_vars,
|
331
337
|
tags,
|
332
338
|
"#{File.join(config[:root_path], File.basename(config[:playbook]))}",
|
@@ -362,6 +368,10 @@ module Kitchen
|
|
362
368
|
File.join(sandbox_path, 'filter_plugins')
|
363
369
|
end
|
364
370
|
|
371
|
+
def tmp_ansible_vault_password_file_path
|
372
|
+
File.join(sandbox_path, File.basename(ansible_vault_password_file))
|
373
|
+
end
|
374
|
+
|
365
375
|
def ansiblefile
|
366
376
|
config[:ansiblefile_path] || ''
|
367
377
|
end
|
@@ -395,7 +405,7 @@ module Kitchen
|
|
395
405
|
end
|
396
406
|
|
397
407
|
def addt_dir
|
398
|
-
config[:additional_copy_path]
|
408
|
+
config[:additional_copy_path]
|
399
409
|
end
|
400
410
|
|
401
411
|
def host_vars
|
@@ -406,6 +416,9 @@ module Kitchen
|
|
406
416
|
config[:filter_plugins_path].to_s
|
407
417
|
end
|
408
418
|
|
419
|
+
def ansible_vault_password_file
|
420
|
+
config[:ansible_vault_password_file]
|
421
|
+
end
|
409
422
|
|
410
423
|
def ansible_debian_version
|
411
424
|
config[:ansible_version] ? "=#{config[:ansible_version]}" : nil
|
@@ -427,6 +440,11 @@ module Kitchen
|
|
427
440
|
config[:ansible_diff] ? '--diff' : nil
|
428
441
|
end
|
429
442
|
|
443
|
+
def ansible_vault_flag
|
444
|
+
debug(config[:ansible_vault_password_file])
|
445
|
+
config[:ansible_vault_password_file] ? "--vault-password-file=#{File.join(config[:root_path], File.basename(config[:ansible_vault_password_file]))}" : nil
|
446
|
+
end
|
447
|
+
|
430
448
|
def ansible_platform
|
431
449
|
config[:ansible_platform].to_s.downcase
|
432
450
|
end
|
@@ -500,15 +518,22 @@ module Kitchen
|
|
500
518
|
def prepare_ansible_cfg
|
501
519
|
info('Preparing ansible.cfg file')
|
502
520
|
ansible_config_file = "#{File.join(sandbox_path, 'ansible.cfg')}"
|
503
|
-
|
521
|
+
|
522
|
+
roles_paths = []
|
523
|
+
roles_paths << File.join(config[:root_path], 'roles') unless config[:roles_path].nil?
|
524
|
+
additional_dirs.each do |additional_dir|
|
525
|
+
roles_paths << File.join(config[:root_path], File.basename(additional_dir))
|
526
|
+
end
|
527
|
+
|
528
|
+
if roles_paths.empty?
|
504
529
|
info('No roles have been set. empty ansible.cfg generated')
|
505
530
|
File.open(ansible_config_file, "wb") do |file|
|
506
531
|
file.write("#no roles path specified\n")
|
507
532
|
end
|
508
533
|
else
|
509
|
-
debug("Setting roles_path inside VM to #{
|
534
|
+
debug("Setting roles_path inside VM to #{ roles_paths.join(':') }")
|
510
535
|
File.open( ansible_config_file, "wb") do |file|
|
511
|
-
file.write("[defaults]\nroles_path = #{
|
536
|
+
file.write("[defaults]\nroles_path = #{ roles_paths.join(':') }\n")
|
512
537
|
end
|
513
538
|
end
|
514
539
|
end
|
@@ -553,16 +578,30 @@ module Kitchen
|
|
553
578
|
|
554
579
|
def prepare_addt_dir
|
555
580
|
info('Preparing additional_copy_path')
|
556
|
-
tmp_addt_dir = File.join(sandbox_path, File.basename(addt_dir))
|
557
|
-
FileUtils.mkdir_p(tmp_addt_dir)
|
558
581
|
|
559
|
-
|
560
|
-
|
561
|
-
|
582
|
+
additional_dirs.each do |additional_dir|
|
583
|
+
|
584
|
+
tmp_addt_dir = File.join(sandbox_path, File.basename(additional_dir))
|
585
|
+
FileUtils.mkdir_p(tmp_addt_dir)
|
586
|
+
|
587
|
+
unless File.directory?(additional_dir)
|
588
|
+
info "invalid value #{additional_dir} in additional_copy_path"
|
589
|
+
return
|
590
|
+
end
|
591
|
+
|
592
|
+
debug("Using additional_copy_path from #{additional_dir}")
|
593
|
+
FileUtils.cp_r(Dir.glob("#{additional_dir}/*"), tmp_addt_dir)
|
562
594
|
end
|
595
|
+
end
|
563
596
|
|
564
|
-
|
565
|
-
|
597
|
+
def additional_dirs
|
598
|
+
additional_dirs = []
|
599
|
+
|
600
|
+
if ( addt_dir )
|
601
|
+
additional_dirs = addt_dir.kind_of?(Array) ? addt_dir : [addt_dir]
|
602
|
+
end
|
603
|
+
|
604
|
+
additional_dirs.map { |additional_dir| additional_dir.to_s }
|
566
605
|
end
|
567
606
|
|
568
607
|
def prepare_host_vars
|
@@ -603,6 +642,12 @@ module Kitchen
|
|
603
642
|
end
|
604
643
|
end
|
605
644
|
|
645
|
+
def prepare_ansible_vault_password_file
|
646
|
+
info('Preparing ansible vault password')
|
647
|
+
debug("Copying ansible vault password file from #{ansible_vault_password_file} to #{tmp_ansible_vault_password_file_path}")
|
648
|
+
FileUtils.cp(ansible_vault_password_file, tmp_ansible_vault_password_file_path)
|
649
|
+
end
|
650
|
+
|
606
651
|
def resolve_with_librarian
|
607
652
|
Kitchen.mutex.synchronize do
|
608
653
|
Ansible::Librarian.new(ansiblefile, tmp_roles_dir, logger).resolve
|
data/provisioner_options.md
CHANGED
@@ -6,8 +6,9 @@ key | default value | Notes
|
|
6
6
|
ansible_version | "latest"| desired version, affects apt installs
|
7
7
|
ansible_platform | naively tries to determine | OS platform of server
|
8
8
|
require_ansible_repo | true | Set if using a ansible install from yum or apt repo
|
9
|
-
ansible_apt_repo | "ppa:ansible/ansible"| apt repo
|
10
|
-
ansible_yum_repo | "https://download.fedoraproject.org
|
9
|
+
ansible_apt_repo | "ppa:ansible/ansible" | apt repo
|
10
|
+
ansible_yum_repo | "https://download.fedoraproject.org | yum repo
|
11
|
+
| /pub/epel/6/i386/epel-release-6-8.noarch.rpm" |
|
11
12
|
require_ansible_omnibus | false | Set if using omnibus ansible install
|
12
13
|
ansible_omnibus_url | | omnibus ansible install location.
|
13
14
|
ansible_omnibus_remote_path | "/opt/ansible" | Server Installation location of an omnibus ansible install.
|
@@ -15,7 +16,7 @@ roles_path | roles | ansible repo roles directory
|
|
15
16
|
group_vars_path | group_vars | ansible repo group_vars directory
|
16
17
|
host_vars_path | host_vars | ansible repo hosts directory
|
17
18
|
filter_plugins | filter_plugins | ansible repo filter_plugins directory
|
18
|
-
additional_copy_path | | arbitrary
|
19
|
+
additional_copy_path | | arbitrary array of directories to copy into test environment, relative to CWD. (eg, vars)
|
19
20
|
extra_vars | Hash.new | Hash to set the extra_vars passed to ansibile-playbook command
|
20
21
|
playbook | 'site.yml' | playbook for ansible-playbook to run
|
21
22
|
modules_path | | ansible repo manifests directory
|
@@ -27,6 +28,7 @@ update_package_repos| true| update OS repository metadata
|
|
27
28
|
chef_bootstrap_url |"https://www.getchef.com/chef/install.sh"| the chef (needed for busser to run tests)
|
28
29
|
ansiblefile_path | | Path to Ansiblefile
|
29
30
|
requirements_path | | Path to ansible-galaxy requirements
|
31
|
+
ansible_vault_password_file| | Path of Ansible Vault Password File
|
30
32
|
|
31
33
|
## Configuring Provisioner Options
|
32
34
|
|
metadata
CHANGED
@@ -1,77 +1,66 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kitchen-ansible
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.0.14
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Neill Turner
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2015-
|
11
|
+
date: 2015-05-08 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: test-kitchen
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - ">="
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '0'
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - ">="
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '0'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: rspec
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - ">="
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: '0'
|
38
34
|
type: :development
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - ">="
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: '0'
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: pry
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- -
|
45
|
+
- - ">="
|
52
46
|
- !ruby/object:Gem::Version
|
53
47
|
version: '0'
|
54
48
|
type: :development
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
|
-
- -
|
52
|
+
- - ">="
|
60
53
|
- !ruby/object:Gem::Version
|
61
54
|
version: '0'
|
62
|
-
description:
|
63
|
-
|
55
|
+
description: |+
|
56
|
+
== DESCRIPTION:
|
64
57
|
|
65
58
|
Ansible Provisioner for Test Kitchen
|
66
59
|
|
67
|
-
|
68
60
|
== FEATURES:
|
69
61
|
|
70
|
-
|
71
62
|
Supports running ansible-playbook
|
72
63
|
|
73
|
-
|
74
|
-
'
|
75
64
|
email:
|
76
65
|
- neillwturner@gmail.com
|
77
66
|
executables: []
|
@@ -86,26 +75,25 @@ files:
|
|
86
75
|
- provisioner_options.md
|
87
76
|
homepage: https://github.com/neillturner/kitchen-ansible
|
88
77
|
licenses: []
|
78
|
+
metadata: {}
|
89
79
|
post_install_message:
|
90
80
|
rdoc_options: []
|
91
81
|
require_paths:
|
92
82
|
- lib
|
93
83
|
required_ruby_version: !ruby/object:Gem::Requirement
|
94
|
-
none: false
|
95
84
|
requirements:
|
96
|
-
- -
|
85
|
+
- - ">="
|
97
86
|
- !ruby/object:Gem::Version
|
98
87
|
version: '0'
|
99
88
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
100
|
-
none: false
|
101
89
|
requirements:
|
102
|
-
- -
|
90
|
+
- - ">="
|
103
91
|
- !ruby/object:Gem::Version
|
104
92
|
version: '0'
|
105
93
|
requirements: []
|
106
|
-
rubyforge_project:
|
107
|
-
rubygems_version:
|
94
|
+
rubyforge_project: "[none]"
|
95
|
+
rubygems_version: 2.2.2
|
108
96
|
signing_key:
|
109
|
-
specification_version:
|
97
|
+
specification_version: 4
|
110
98
|
summary: ansible provisioner for test-kitchen
|
111
99
|
test_files: []
|