kitchen-ansible 0.0.39 → 0.40.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +38 -44
- data/lib/kitchen-ansible/version.rb +1 -1
- data/lib/kitchen/provisioner/ansible/config.rb +5 -0
- data/lib/kitchen/provisioner/ansible_playbook.rb +53 -1
- data/provisioner_options.md +2 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a1a5c211f01e90eb87b10e9bc43f0cf0a1696568
|
4
|
+
data.tar.gz: 95ce5874130839c5e8e00c0a44164ac7e784a15f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 52b918b73a113f1e390f93f65e7773600625902c983d3e609b1b50b95dba0b293abf405901d50ba6d903fda18f8022ec21fb1762306f6973c0fafc6256ec12c1
|
7
|
+
data.tar.gz: 9858cb18a980bfe9d0381852ee59594ad324e94c148d76a476af0a6a4054a685190cfa6eb5966f2240e6b91b4f37cb2811be61b9e2959752444c4a9705e62579
|
data/README.md
CHANGED
@@ -54,27 +54,50 @@ platforms:
|
|
54
54
|
- [ 'private_network', { ip: '192.168.33.11' } ]
|
55
55
|
```
|
56
56
|
|
57
|
+
## Test-Kitchen Ansible Windows Support
|
58
|
+
|
59
|
+
Windows is supported by created a lunix server to run ansible with software required to support winrm. Then winrm connection is used to configure the windows server.
|
60
|
+
|
61
|
+
In kitchen.yml set
|
62
|
+
|
63
|
+
```
|
64
|
+
ansible_connection: winrm
|
65
|
+
require_windows_support: true
|
66
|
+
require_chef_for_busser: false
|
67
|
+
```
|
68
|
+
|
69
|
+
See example [https://github.com/neillturner/ansible_windows_repo](https://github.com/neillturner/ansible_windows_repo)
|
70
|
+
|
71
|
+
|
57
72
|
## Ruby install to run serverspec verify
|
58
73
|
|
59
74
|
By default test-kitchen installs chef to get a ruby version suitable to run serverspec in the `verify` step.
|
60
75
|
Instead ruby can just be installed by specifying the provisioner option:
|
61
76
|
|
62
77
|
```
|
63
|
-
require_ruby_for_busser:
|
78
|
+
require_ruby_for_busser: true
|
64
79
|
```
|
65
80
|
And set the verifier section:
|
66
81
|
```
|
67
82
|
verifier:
|
68
|
-
name:
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
83
|
+
name: serverspec
|
84
|
+
sudo_path: true
|
85
|
+
|
86
|
+
suites:
|
87
|
+
- name: ansible
|
88
|
+
driver_config:
|
89
|
+
hostname: '54.229.34.169'
|
90
|
+
verifier:
|
91
|
+
patterns:
|
92
|
+
- roles/tomcat/spec/tomcat_spec.rb
|
93
|
+
bundler_path: '/usr/local/bin'
|
94
|
+
rspec_path: '/usr/local/bin'
|
95
|
+
env_vars:
|
96
|
+
TARGET_HOST: 54.229.104.40
|
97
|
+
LOGIN_USER: centos
|
98
|
+
SUDO: true
|
99
|
+
SSH_KEY: spec/test.pem
|
76
100
|
|
77
|
-
gem 'rake'
|
78
101
|
```
|
79
102
|
|
80
103
|
Please see the [Provisioner Options](https://github.com/neillturner/kitchen-ansible/blob/master/provisioner_options.md) for a complete listing.
|
@@ -82,23 +105,17 @@ Please see the [Provisioner Options](https://github.com/neillturner/kitchen-ansi
|
|
82
105
|
|
83
106
|
## Test-Kitchen Ansiblespec
|
84
107
|
|
85
|
-
|
86
|
-
|
87
|
-
* ansiblespec - tests are specified with the roles in the ansible repository. (default)
|
88
|
-
* serverspec - tests are in test-kitchen serverspec format
|
89
|
-
* spec - tests are stored in the spec directory with a directory for each role.
|
108
|
+
By using kitchen-verifier-serverspec and the Runner ansiblespec_runner tests can be against multiple servers with multiple roles in the ansiblespec format.
|
90
109
|
|
91
110
|
Serverspec uses ssh to communicate with the server to be tested and reads the ansible playbook and inventory files to determine the hosts to test and the roles for each host.
|
92
111
|
|
93
|
-
|
94
|
-
|
95
|
-
- Set pattern: 'spec' in the config.yml file (see below) to perform tests in for roles specified in the spec directory.
|
96
|
-
- By default pattern: ansiblespec is set. See example [https://github.com/neillturner/ansible_repo](https://github.com/neillturner/ansible_repo)
|
112
|
+
See example [https://github.com/neillturner/ansible_repo](https://github.com/neillturner/ansible_repo)
|
113
|
+
|
97
114
|
|
98
115
|
|
99
116
|
### Example usage to create tomcat servers:
|
100
117
|
|
101
|
-
![test-kitchen, ansible and
|
118
|
+
![test-kitchen, ansible and ansiblespec](https://github.com/neillturner/ansible_repo/blob/master/kitchen-ansible.png "test-kitchen, ansible and ansiblespec")
|
102
119
|
|
103
120
|
See [ansible-sample-tdd](https://github.com/volanja/ansible-sample-tdd)
|
104
121
|
|
@@ -110,7 +127,6 @@ In the ansible repository specify:
|
|
110
127
|
|
111
128
|
* spec files with the roles.
|
112
129
|
* spec_helper in the spec folder (with code as below).
|
113
|
-
* test/integration/<suite>/ansiblespec containing config.yml and ssh private keys to access the servers.
|
114
130
|
|
115
131
|
```
|
116
132
|
.
|
@@ -136,12 +152,6 @@ In the ansible repository specify:
|
|
136
152
|
+-- spec
|
137
153
|
+-- spec_helper.rb
|
138
154
|
+-- my_private_key.pem
|
139
|
-
+-- test
|
140
|
-
+-- integration
|
141
|
-
+-- default # name of test-kitchen suite
|
142
|
-
+-- ansiblespec
|
143
|
-
+-- config.yml
|
144
|
-
|
145
155
|
```
|
146
156
|
|
147
157
|
|
@@ -167,23 +177,7 @@ RSpec.configure do |config|
|
|
167
177
|
end
|
168
178
|
```
|
169
179
|
|
170
|
-
|
171
|
-
|
172
|
-
This goes in directory test/integration/default/ansiblespec where default is the name of test-kitchen suite.
|
173
|
-
|
174
|
-
```
|
175
|
-
---
|
176
|
-
-
|
177
|
-
playbook: default.yml
|
178
|
-
inventory: hosts
|
179
|
-
kitchen_path: '/tmp/kitchen'
|
180
|
-
pattern: 'ansiblespec' # or spec or serverspec
|
181
|
-
user: root
|
182
|
-
ssh_key: 'spec/my_private_key.pem'
|
183
|
-
login_password: 'myrootpassword'
|
184
|
-
```
|
185
|
-
|
186
|
-
See [busser-ansiblespec](https://github.com/neillturner/busser-ansiblespec)
|
180
|
+
See [kitchen-verifier-serverspec](https://github.com/neillturner/kitchen-verifier-serverspec)
|
187
181
|
|
188
182
|
## Alternative Virtualization/Cloud providers for Vagrant
|
189
183
|
This could be adapted to use alternative virtualization/cloud providers such as Openstack/AWS/VMware Fusion according to whatever is supported by Vagrant.
|
@@ -49,6 +49,7 @@ module Kitchen
|
|
49
49
|
# (Reference: https://github.com/neillturner/kitchen-ansible/issues/66 )
|
50
50
|
default_config :require_chef_for_busser, true
|
51
51
|
default_config :require_ruby_for_busser, false
|
52
|
+
default_config :require_windows_support, false
|
52
53
|
default_config :requirements_path, false
|
53
54
|
default_config :ssh_known_hosts, nil
|
54
55
|
default_config :ansible_verbose, false
|
@@ -120,6 +121,10 @@ module Kitchen
|
|
120
121
|
provisioner.calculate_path('ansible-vault-password', :file)
|
121
122
|
end
|
122
123
|
|
124
|
+
default_config :kerberos_conf_file do |provisioner|
|
125
|
+
provisioner.calculate_path('kerberos_conf', :file)
|
126
|
+
end
|
127
|
+
|
123
128
|
def initialize(config = {})
|
124
129
|
init_config(config)
|
125
130
|
end
|
@@ -97,7 +97,31 @@ module Kitchen
|
|
97
97
|
else
|
98
98
|
return
|
99
99
|
end
|
100
|
-
cmd + install_busser_prereqs
|
100
|
+
result = cmd + install_windows_support + install_busser_prereqs
|
101
|
+
info("Going to install ansible with: #{result}")
|
102
|
+
result
|
103
|
+
end
|
104
|
+
|
105
|
+
def install_windows_support
|
106
|
+
install = ''
|
107
|
+
if require_windows_support
|
108
|
+
install << <<-INSTALL
|
109
|
+
if [ -f /etc/centos-release ] || [ -f /etc/redhat-release ]; then
|
110
|
+
#{sudo_env('yum')} -y install python-devel krb5-devel krb5-libs krb5-workstation gcc
|
111
|
+
else
|
112
|
+
if [ -f /etc/SuSE-release ] || [ -f /etc/SUSE-brand ]; then
|
113
|
+
#{sudo_env('zypper')} ar #{python_sles_repo}
|
114
|
+
#{sudo_env('zypper')} --non-interactive install python python-devel krb5-client pam_krb5
|
115
|
+
else
|
116
|
+
#{sudo_env('apt-get')} install python-dev libkrb5-dev build-essential
|
117
|
+
fi
|
118
|
+
fi
|
119
|
+
#{export_http_proxy}
|
120
|
+
#{sudo_env('easy_install')} pip
|
121
|
+
#{sudo_env('pip')} install pywinrm kerberos
|
122
|
+
INSTALL
|
123
|
+
end
|
124
|
+
install
|
101
125
|
end
|
102
126
|
|
103
127
|
def install_busser_prereqs
|
@@ -221,6 +245,7 @@ module Kitchen
|
|
221
245
|
prepare_filter_plugins
|
222
246
|
prepare_lookup_plugins
|
223
247
|
prepare_ansible_vault_password_file
|
248
|
+
prepare_kerberos_conf_file
|
224
249
|
info('Finished Preparing files for transfer')
|
225
250
|
end
|
226
251
|
|
@@ -289,6 +314,12 @@ module Kitchen
|
|
289
314
|
].join(' ')
|
290
315
|
end
|
291
316
|
|
317
|
+
if kerberos_conf_file
|
318
|
+
commands << [
|
319
|
+
sudo_env('cp -f'), File.join(config[:root_path], 'krb5.conf'), '/etc'
|
320
|
+
].join(' ')
|
321
|
+
end
|
322
|
+
|
292
323
|
command = commands.join(' && ')
|
293
324
|
debug(command)
|
294
325
|
command
|
@@ -458,6 +489,10 @@ module Kitchen
|
|
458
489
|
File.join(sandbox_path, File.basename(ansible_vault_password_file).reverse.chomp('.').reverse)
|
459
490
|
end
|
460
491
|
|
492
|
+
def tmp_kerberos_conf_file_path
|
493
|
+
File.join(sandbox_path, 'krb5.conf')
|
494
|
+
end
|
495
|
+
|
461
496
|
def tmp_inventory_path
|
462
497
|
File.join(sandbox_path, File.basename(ansible_inventory))
|
463
498
|
end
|
@@ -646,6 +681,14 @@ module Kitchen
|
|
646
681
|
config[:require_chef_for_busser]
|
647
682
|
end
|
648
683
|
|
684
|
+
def require_windows_support
|
685
|
+
config[:require_windows_support]
|
686
|
+
end
|
687
|
+
|
688
|
+
def kerberos_conf_file
|
689
|
+
config[:kerberos_conf_file]
|
690
|
+
end
|
691
|
+
|
649
692
|
def install_source_rev
|
650
693
|
config[:ansible_source_rev] ? "--branch #{config[:ansible_source_rev]}" : nil
|
651
694
|
end
|
@@ -892,6 +935,15 @@ module Kitchen
|
|
892
935
|
FileUtils.cp(ansible_vault_password_file, tmp_ansible_vault_password_file_path)
|
893
936
|
end
|
894
937
|
|
938
|
+
def prepare_kerberos_conf_file
|
939
|
+
return unless kerberos_conf_file
|
940
|
+
|
941
|
+
info('Preparing kerberos configuration file')
|
942
|
+
debug("Copying kerberos configuration file from #{kerberos_conf_file} to #{tmp_kerberos_conf_file_path}")
|
943
|
+
|
944
|
+
FileUtils.cp(kerberos_conf_file, tmp_kerberos_conf_file_path)
|
945
|
+
end
|
946
|
+
|
895
947
|
def resolve_with_librarian
|
896
948
|
Kitchen.mutex.synchronize do
|
897
949
|
Ansible::Librarian.new(ansiblefile, tmp_roles_dir, logger).resolve
|
data/provisioner_options.md
CHANGED
@@ -53,6 +53,8 @@ ansible_host_key_checking | true | strict host key checking in ssh
|
|
53
53
|
private_key | | ssh private key file for ssh connection
|
54
54
|
idempotency_test | false | Enable to test ansible playbook idempotency
|
55
55
|
ssh_known_hosts | | List of hosts that should be added to `~/.ssh/known_hosts`
|
56
|
+
kerberos_conf_file| | Path of krb5.conf file using in windows support
|
57
|
+
require_windows_support | false | install windows support: http://docs.ansible.com/ansible/intro_windows.html
|
56
58
|
|
57
59
|
## Configuring Provisioner Options
|
58
60
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.40.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Neill Turner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-03-
|
11
|
+
date: 2016-03-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: test-kitchen
|