kitchen-ansible 0.45.4 → 0.45.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +232 -232
- data/kitchen-ansible.gemspec +39 -39
- data/lib/kitchen-ansible/version.rb +6 -6
- data/lib/kitchen/provisioner/ansible/config.rb +184 -178
- data/lib/kitchen/provisioner/ansible/librarian.rb +78 -78
- data/lib/kitchen/provisioner/ansible/os.rb +78 -72
- data/lib/kitchen/provisioner/ansible/os/alpine.rb +42 -0
- data/lib/kitchen/provisioner/ansible/os/amazon.rb +42 -42
- data/lib/kitchen/provisioner/ansible/os/darwin.rb +37 -0
- data/lib/kitchen/provisioner/ansible/os/debian.rb +69 -69
- data/lib/kitchen/provisioner/ansible/os/fedora.rb +60 -60
- data/lib/kitchen/provisioner/ansible/os/redhat.rb +70 -70
- data/lib/kitchen/provisioner/ansible/os/suse.rb +44 -44
- data/lib/kitchen/provisioner/ansible_playbook.rb +1090 -1073
- data/provisioner_options.md +129 -126
- metadata +18 -16
data/kitchen-ansible.gemspec
CHANGED
@@ -1,39 +1,39 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
$LOAD_PATH.unshift File.expand_path('../lib', __FILE__)
|
4
|
-
require 'kitchen-ansible/version'
|
5
|
-
|
6
|
-
Gem::Specification.new do |s|
|
7
|
-
s.name = 'kitchen-ansible'
|
8
|
-
s.license = 'Apache-2.0'
|
9
|
-
s.version = Kitchen::Ansible::VERSION
|
10
|
-
s.authors = ['Neill Turner']
|
11
|
-
s.email = ['neillwturner@gmail.com']
|
12
|
-
s.homepage = 'https://github.com/neillturner/kitchen-ansible'
|
13
|
-
s.summary = 'ansible provisioner for test-kitchen'
|
14
|
-
candidates = Dir.glob('{lib}/**/*') + ['README.md', 'provisioner_options.md', 'kitchen-ansible.gemspec']
|
15
|
-
s.files = candidates.sort
|
16
|
-
s.platform = Gem::Platform::RUBY
|
17
|
-
s.require_paths = ['lib']
|
18
|
-
s.rubyforge_project = '[none]'
|
19
|
-
s.description = <<-EOF
|
20
|
-
== DESCRIPTION:
|
21
|
-
|
22
|
-
Ansible Provisioner for Test Kitchen
|
23
|
-
|
24
|
-
== FEATURES:
|
25
|
-
|
26
|
-
Supports running ansible-playbook
|
27
|
-
|
28
|
-
EOF
|
29
|
-
s.add_runtime_dependency 'test-kitchen', '~> 1.4'
|
30
|
-
|
31
|
-
s.add_development_dependency 'rspec'
|
32
|
-
s.add_development_dependency 'pry'
|
33
|
-
s.add_development_dependency 'rake'
|
34
|
-
if RUBY_VERSION >= '2.0'
|
35
|
-
s.add_dependency 'net-ssh', '~> 3.0'
|
36
|
-
else
|
37
|
-
s.add_dependency 'net-ssh', '~> 2.9'
|
38
|
-
end
|
39
|
-
end
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
$LOAD_PATH.unshift File.expand_path('../lib', __FILE__)
|
4
|
+
require 'kitchen-ansible/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = 'kitchen-ansible'
|
8
|
+
s.license = 'Apache-2.0'
|
9
|
+
s.version = Kitchen::Ansible::VERSION
|
10
|
+
s.authors = ['Neill Turner']
|
11
|
+
s.email = ['neillwturner@gmail.com']
|
12
|
+
s.homepage = 'https://github.com/neillturner/kitchen-ansible'
|
13
|
+
s.summary = 'ansible provisioner for test-kitchen'
|
14
|
+
candidates = Dir.glob('{lib}/**/*') + ['README.md', 'provisioner_options.md', 'kitchen-ansible.gemspec']
|
15
|
+
s.files = candidates.sort
|
16
|
+
s.platform = Gem::Platform::RUBY
|
17
|
+
s.require_paths = ['lib']
|
18
|
+
s.rubyforge_project = '[none]'
|
19
|
+
s.description = <<-EOF
|
20
|
+
== DESCRIPTION:
|
21
|
+
|
22
|
+
Ansible Provisioner for Test Kitchen
|
23
|
+
|
24
|
+
== FEATURES:
|
25
|
+
|
26
|
+
Supports running ansible-playbook
|
27
|
+
|
28
|
+
EOF
|
29
|
+
s.add_runtime_dependency 'test-kitchen', '~> 1.4'
|
30
|
+
|
31
|
+
s.add_development_dependency 'rspec'
|
32
|
+
s.add_development_dependency 'pry'
|
33
|
+
s.add_development_dependency 'rake'
|
34
|
+
if RUBY_VERSION >= '2.0'
|
35
|
+
s.add_dependency 'net-ssh', '~> 3.0'
|
36
|
+
else
|
37
|
+
s.add_dependency 'net-ssh', '~> 2.9'
|
38
|
+
end
|
39
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
module Kitchen
|
3
|
-
module Ansible
|
4
|
-
VERSION = '0.45.
|
5
|
-
end
|
6
|
-
end
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
module Kitchen
|
3
|
+
module Ansible
|
4
|
+
VERSION = '0.45.5'
|
5
|
+
end
|
6
|
+
end
|
@@ -1,178 +1,184 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
#
|
3
|
-
# Author:: Michael Heap (<m@michaelheap.com>)
|
4
|
-
#
|
5
|
-
# Copyright (C) 2015 Michael Heap
|
6
|
-
#
|
7
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
-
# you may not use this file except in compliance with the License.
|
9
|
-
# You may obtain a copy of the License at
|
10
|
-
#
|
11
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
-
#
|
13
|
-
# Unless required by applicable law or agreed to in writing, software
|
14
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
-
# See the License for the specific language governing permissions and
|
17
|
-
# limitations under the License.
|
18
|
-
#
|
19
|
-
|
20
|
-
require 'json'
|
21
|
-
|
22
|
-
module Kitchen
|
23
|
-
module Provisioner
|
24
|
-
module Ansible
|
25
|
-
#
|
26
|
-
# Ansible Playbook provisioner.
|
27
|
-
#
|
28
|
-
class Config
|
29
|
-
include Kitchen::Configurable
|
30
|
-
|
31
|
-
attr_accessor :instance
|
32
|
-
|
33
|
-
default_config :ansible_sudo, true
|
34
|
-
default_config :ansible_verbose, false
|
35
|
-
default_config :require_ansible_omnibus, false
|
36
|
-
default_config :ansible_omnibus_url, 'https://raw.githubusercontent.com/neillturner/omnibus-ansible/master/ansible_install.sh'
|
37
|
-
default_config :ansible_omnibus_remote_path, '/opt/ansible'
|
38
|
-
default_config :ansible_version, nil
|
39
|
-
default_config :require_ansible_repo, true
|
40
|
-
default_config :enable_yum_epel, false
|
41
|
-
default_config :extra_vars, {}
|
42
|
-
default_config :env_vars, {}
|
43
|
-
default_config :tags, []
|
44
|
-
default_config :ansible_apt_repo, 'ppa:ansible/ansible'
|
45
|
-
default_config :ansible_yum_repo, nil
|
46
|
-
default_config :ansible_sles_repo, 'http://download.opensuse.org/repositories/systemsmanagement/SLE_12/systemsmanagement.repo'
|
47
|
-
default_config :python_sles_repo, 'http://download.opensuse.org/repositories/devel:/languages:/python/SLE_12/devel:languages:python.repo'
|
48
|
-
default_config :chef_bootstrap_url, 'https://www.getchef.com/chef/install.sh'
|
49
|
-
# Providing we have Ruby >= 2.0 we only need Ruby. Leaving default to install Chef Omnibus for backwards compatibility.
|
50
|
-
# Note: if using kitchen-verifer-serverspec your we can avoid needing Ruby too.
|
51
|
-
# (Reference: https://github.com/neillturner/kitchen-ansible/issues/66 )
|
52
|
-
default_config :require_chef_for_busser, true
|
53
|
-
default_config :require_ruby_for_busser, false
|
54
|
-
default_config :require_windows_support, false
|
55
|
-
default_config :require_pip, false
|
56
|
-
default_config :requirements_path, false
|
57
|
-
default_config :ssh_known_hosts, nil
|
58
|
-
default_config :ansible_verbose, false
|
59
|
-
default_config :ansible_verbosity, 1
|
60
|
-
default_config :ansible_check, false
|
61
|
-
default_config :ansible_diff, false
|
62
|
-
default_config :ansible_platform, ''
|
63
|
-
default_config :ansible_connection, 'local'
|
64
|
-
default_config :update_package_repos, true
|
65
|
-
default_config :require_ansible_source, false
|
66
|
-
default_config :ansible_source_rev, nil
|
67
|
-
default_config :http_proxy, nil
|
68
|
-
default_config :https_proxy, nil
|
69
|
-
default_config :no_proxy, nil
|
70
|
-
default_config :ansible_playbook_command, nil
|
71
|
-
default_config :ansible_host_key_checking, true
|
72
|
-
default_config :idempotency_test, nil
|
73
|
-
default_config :ansible_inventory, nil
|
74
|
-
default_config :ansible_inventory_file, nil
|
75
|
-
default_config :ansible_limit, nil
|
76
|
-
default_config :
|
77
|
-
default_config :
|
78
|
-
default_config :
|
79
|
-
|
80
|
-
default_config :
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
candidates.
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
#
|
3
|
+
# Author:: Michael Heap (<m@michaelheap.com>)
|
4
|
+
#
|
5
|
+
# Copyright (C) 2015 Michael Heap
|
6
|
+
#
|
7
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
+
# you may not use this file except in compliance with the License.
|
9
|
+
# You may obtain a copy of the License at
|
10
|
+
#
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
#
|
13
|
+
# Unless required by applicable law or agreed to in writing, software
|
14
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
+
# See the License for the specific language governing permissions and
|
17
|
+
# limitations under the License.
|
18
|
+
#
|
19
|
+
|
20
|
+
require 'json'
|
21
|
+
|
22
|
+
module Kitchen
|
23
|
+
module Provisioner
|
24
|
+
module Ansible
|
25
|
+
#
|
26
|
+
# Ansible Playbook provisioner.
|
27
|
+
#
|
28
|
+
class Config
|
29
|
+
include Kitchen::Configurable
|
30
|
+
|
31
|
+
attr_accessor :instance
|
32
|
+
|
33
|
+
default_config :ansible_sudo, true
|
34
|
+
default_config :ansible_verbose, false
|
35
|
+
default_config :require_ansible_omnibus, false
|
36
|
+
default_config :ansible_omnibus_url, 'https://raw.githubusercontent.com/neillturner/omnibus-ansible/master/ansible_install.sh'
|
37
|
+
default_config :ansible_omnibus_remote_path, '/opt/ansible'
|
38
|
+
default_config :ansible_version, nil
|
39
|
+
default_config :require_ansible_repo, true
|
40
|
+
default_config :enable_yum_epel, false
|
41
|
+
default_config :extra_vars, {}
|
42
|
+
default_config :env_vars, {}
|
43
|
+
default_config :tags, []
|
44
|
+
default_config :ansible_apt_repo, 'ppa:ansible/ansible'
|
45
|
+
default_config :ansible_yum_repo, nil
|
46
|
+
default_config :ansible_sles_repo, 'http://download.opensuse.org/repositories/systemsmanagement/SLE_12/systemsmanagement.repo'
|
47
|
+
default_config :python_sles_repo, 'http://download.opensuse.org/repositories/devel:/languages:/python/SLE_12/devel:languages:python.repo'
|
48
|
+
default_config :chef_bootstrap_url, 'https://www.getchef.com/chef/install.sh'
|
49
|
+
# Providing we have Ruby >= 2.0 we only need Ruby. Leaving default to install Chef Omnibus for backwards compatibility.
|
50
|
+
# Note: if using kitchen-verifer-serverspec your we can avoid needing Ruby too.
|
51
|
+
# (Reference: https://github.com/neillturner/kitchen-ansible/issues/66 )
|
52
|
+
default_config :require_chef_for_busser, true
|
53
|
+
default_config :require_ruby_for_busser, false
|
54
|
+
default_config :require_windows_support, false
|
55
|
+
default_config :require_pip, false
|
56
|
+
default_config :requirements_path, false
|
57
|
+
default_config :ssh_known_hosts, nil
|
58
|
+
default_config :ansible_verbose, false
|
59
|
+
default_config :ansible_verbosity, 1
|
60
|
+
default_config :ansible_check, false
|
61
|
+
default_config :ansible_diff, false
|
62
|
+
default_config :ansible_platform, ''
|
63
|
+
default_config :ansible_connection, 'local'
|
64
|
+
default_config :update_package_repos, true
|
65
|
+
default_config :require_ansible_source, false
|
66
|
+
default_config :ansible_source_rev, nil
|
67
|
+
default_config :http_proxy, nil
|
68
|
+
default_config :https_proxy, nil
|
69
|
+
default_config :no_proxy, nil
|
70
|
+
default_config :ansible_playbook_command, nil
|
71
|
+
default_config :ansible_host_key_checking, true
|
72
|
+
default_config :idempotency_test, nil
|
73
|
+
default_config :ansible_inventory, nil
|
74
|
+
default_config :ansible_inventory_file, nil
|
75
|
+
default_config :ansible_limit, nil
|
76
|
+
default_config :ignore_extensions_from_root, ['.pyc']
|
77
|
+
default_config :ignore_paths_from_root, []
|
78
|
+
default_config :role_name, nil
|
79
|
+
default_config :additional_copy_role_path, false
|
80
|
+
default_config :shell_command, 'sh'
|
81
|
+
|
82
|
+
default_config :playbook do |provisioner|
|
83
|
+
provisioner.calculate_path('default.yml', :file) ||
|
84
|
+
fail('No playbook found or specified! Please either set a playbook in your .kitchen.yml config, or create a default playbook in test/integration/<suite_name>/ansible/default.yml, test/integration/<suite_name>/default.yml, test/integration/default.yml or in default.yml in the top level')
|
85
|
+
end
|
86
|
+
|
87
|
+
default_config :roles_path do |provisioner|
|
88
|
+
provisioner.calculate_path('roles') ||
|
89
|
+
fail('No roles_path detected. Please specify one in .kitchen.yml')
|
90
|
+
end
|
91
|
+
|
92
|
+
default_config :group_vars_path do |provisioner|
|
93
|
+
provisioner.calculate_path('group_vars', :directory)
|
94
|
+
end
|
95
|
+
|
96
|
+
default_config :additional_copy_path do |provisioner|
|
97
|
+
provisioner.calculate_path('additional_copy', :directory)
|
98
|
+
end
|
99
|
+
|
100
|
+
default_config :recursive_additional_copy_path do |provisioner|
|
101
|
+
provisioner.calculate_path('recursive_additional_copy', :directory)
|
102
|
+
end
|
103
|
+
|
104
|
+
default_config :host_vars_path do |provisioner|
|
105
|
+
provisioner.calculate_path('host_vars', :directory)
|
106
|
+
end
|
107
|
+
|
108
|
+
default_config :modules_path do |provisioner|
|
109
|
+
provisioner.calculate_path('modules', :directory)
|
110
|
+
end
|
111
|
+
|
112
|
+
default_config :ansiblefile_path do |provisioner|
|
113
|
+
provisioner.calculate_path('Ansiblefile', :file)
|
114
|
+
end
|
115
|
+
|
116
|
+
default_config :library_plugins_path do |provisioner|
|
117
|
+
provisioner.calculate_path('library', :directory)
|
118
|
+
end
|
119
|
+
|
120
|
+
default_config :callback_plugins_path do |provisioner|
|
121
|
+
provisioner.calculate_path('callback_plugins', :directory)
|
122
|
+
end
|
123
|
+
|
124
|
+
default_config :filter_plugins_path do |provisioner|
|
125
|
+
provisioner.calculate_path('filter_plugins', :directory)
|
126
|
+
end
|
127
|
+
|
128
|
+
default_config :lookup_plugins_path do |provisioner|
|
129
|
+
provisioner.calculate_path('lookup_plugins', :directory)
|
130
|
+
end
|
131
|
+
|
132
|
+
default_config :ansible_vault_password_file do |provisioner|
|
133
|
+
provisioner.calculate_path('ansible-vault-password', :file)
|
134
|
+
end
|
135
|
+
|
136
|
+
default_config :kerberos_conf_file do |provisioner|
|
137
|
+
provisioner.calculate_path('kerberos_conf', :file)
|
138
|
+
end
|
139
|
+
|
140
|
+
default_config :ansible_cfg_path do |provisioner|
|
141
|
+
provisioner.calculate_path('ansible.cfg', :file)
|
142
|
+
end
|
143
|
+
|
144
|
+
def initialize(config = {})
|
145
|
+
init_config(config)
|
146
|
+
end
|
147
|
+
|
148
|
+
def []=(attr, val)
|
149
|
+
config[attr] = val
|
150
|
+
end
|
151
|
+
|
152
|
+
def [](attr)
|
153
|
+
config[attr]
|
154
|
+
end
|
155
|
+
|
156
|
+
def key?(k)
|
157
|
+
config.key?(k)
|
158
|
+
end
|
159
|
+
|
160
|
+
def keys
|
161
|
+
config.keys
|
162
|
+
end
|
163
|
+
|
164
|
+
def calculate_path(path, type = :directory)
|
165
|
+
unless instance
|
166
|
+
fail 'Please ensure that an instance is provided before calling calculate_path'
|
167
|
+
end
|
168
|
+
|
169
|
+
base = config[:test_base_path]
|
170
|
+
candidates = []
|
171
|
+
candidates << File.join(base, instance.suite.name, 'ansible', path)
|
172
|
+
candidates << File.join(base, instance.suite.name, path)
|
173
|
+
candidates << File.join(base, path)
|
174
|
+
candidates << File.join(Dir.pwd, path)
|
175
|
+
candidates << File.join(Dir.pwd) if path == 'roles'
|
176
|
+
|
177
|
+
candidates.find do |c|
|
178
|
+
type == :directory ? File.directory?(c) : File.file?(c)
|
179
|
+
end
|
180
|
+
end
|
181
|
+
end
|
182
|
+
end
|
183
|
+
end
|
184
|
+
end
|