kitchen-ansible 0.48.5 → 0.49.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 8ae64a9bf60c79cd925b28a1feeaab6b9e157aaa
4
- data.tar.gz: 519f333100157d297faea9d93cb755dfd941ff7a
2
+ SHA256:
3
+ metadata.gz: 8a3a081e05d3e114eee73aabc00ba27a7a23d5811ae2a7fec5795dd9caeaeff4
4
+ data.tar.gz: 7de303e363b104022de49f799bf289d9c834df47843430e15c48fc2dfac02e45
5
5
  SHA512:
6
- metadata.gz: b26ed031d8e00da5ce1bf347987e638a15bab942e848b350be59478c6d3d838147424187315331bca4415a3713845c11ab0a32c2ae221126eb3c7b85e89b1415
7
- data.tar.gz: 7de899411d95bb8aec8cac0025a02a0c2ba0bdd3ba04278d98eaca21b9b4370c9d7948bfdf0dc8dce3f120ede9d82cf5af6e5aaffb72441e481fdf80cf4e9ceb
6
+ metadata.gz: fbba53a30ad0afbde098f019544777e94a0a323bfa04a33612671a623f26cd137c180c7bbe6b4acd929ee3cb4c7d1daa15b866f1bc87a2bbdad92172e8954155
7
+ data.tar.gz: f764da95bd4668f28ef81d57e240ad60181cf9c14ca0006af737d5b90f35deb77ee7dfd0ad4cb6b7dcf1584cf74dfe36eb1b79dfce6936cd6a1c6b2b4f769a38
data/README.md CHANGED
@@ -1,269 +1,270 @@
1
- # kitchen-ansible
2
-
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)
5
- [![Build Status](https://travis-ci.org/neillturner/kitchen-ansible.png)](https://travis-ci.org/neillturner/kitchen-ansible)
6
-
7
- A Test Kitchen Provisioner for Ansible.
8
-
9
- The provisioner works by passing the Ansible repository based on attributes in `.kitchen.yml` & calling `ansible-playbook`.
10
-
11
- It installs Ansible on the server and runs `ansible-playbook` using host localhost.
12
-
13
- It has been tested against the Ubuntu 12.04/14.04/16.04, Centos 6/7 and Debian 6/7/8 boxes running in vagrant/virtualbox.
14
-
15
- ## Requirements
16
- - [Test Kitchen](https://github.com/test-kitchen/test-kitchen).
17
- - a driver box without a Chef installation so Ansible can be installed.
18
-
19
- ## Installation & Setup
20
-
21
- 1. install the latest Ruby on your workstation (for windows see https://rubyinstaller.org/downloads/)
22
-
23
- 2. If using Ruby version less than 2.3 first install earlier version of test-kitchen
24
- ```
25
- gem install test-kitchen -v 1.16.0
26
- ```
27
- 3. Install the `kitchen-ansible` gem in your system, along with [kitchen-vagrant](https://github.com/test-kitchen/kitchen-vagrant) or [kitchen-docker](https://github.com/test-kitchen/kitchen-docker) or any other suitable driver or the exec driver to run from your workstation:
28
-
29
- ```
30
- gem install kitchen-ansible
31
- gem install kitchen-vagrant
32
- ```
33
-
34
-
35
-
36
- ## Resources
37
- * https://blog.superk.org/home/ansible-role-development
38
- * http://razorconsulting.com.au/integration-testing-using-ansible-and-test-kitchen.html
39
- * https://github.com/MattHodge/ansible-testkitchen-windows
40
- * https://readme.fr/continuous-integration-for-ansible/
41
- * https://dantehranian.wordpress.com/2015/06/18/testing-ansible-roles-with-test-kitchen
42
- * http://www.slideshare.net/MartinEtmajer/testing-ansible-roles-with-test-kitchen-serverspec-and-rspec-48185017
43
- * http://blog.el-chavez.me/2016/02/16/ansible-galaxy-test-kitchen
44
- * https://werner-dijkerman.nl/2015/08/20/using-test-kitchen-with-docker-and-serverspec-to-test-ansible-roles
45
- * https://books.google.co.uk/books?id=D-wmDQAAQBAJ&pg=PA129&lpg
46
-
47
- ## Example .kitchen.yml file
48
-
49
- Based on the [Tomcat Standalone](https://github.com/ansible/ansible-examples/tree/master/tomcat-standalone) example:
50
-
51
- ```yaml
52
- ---
53
- driver:
54
- name: vagrant
55
-
56
- provisioner:
57
- name: ansible_playbook
58
- roles_path: roles
59
- hosts: tomcat-servers
60
- require_ansible_repo: true
61
- ansible_verbose: true
62
- ansible_version: latest
63
- require_chef_for_busser: false
64
- additional_ssh_private_keys:
65
- - /mykey/id_rsa
66
-
67
- platforms:
68
- - name: nocm_centos-6.5
69
- driver_plugin: vagrant
70
- driver_config:
71
- box: nocm_centos-6.5
72
- box_url: http://puppet-vagrant-boxes.puppetlabs.com/centos-65-x64-virtualbox-nocm.box
73
- network:
74
- - ['forwarded_port', {guest: 8080, host: 8080}]
75
- - ['private_network', {ip: '192.168.33.11'}]
76
- ```
77
-
78
- See example [https://github.com/neillturner/ansible_repo](https://github.com/neillturner/ansible_repo)
79
-
80
- ## Windows Support
81
-
82
- Windows is supported by creating a linux server to run Ansible with software required to support winrm. Then the winrm connection is used to configure the windows server.
83
-
84
- In `.kitchen.yml` set:
85
-
86
- ```yaml
87
- ansible_connection: winrm
88
- require_windows_support: true
89
- require_chef_for_busser: false
90
- ```
91
-
92
- See the [Ansible Windows repo](https://github.com/neillturner/ansible_windows_repo) example.
93
-
94
- ## Test Kitchen Exec Driver
95
-
96
- By using the test-kitchen exec driver ansible can be driven from your workstation. This provides similar functionality to [kitchen-ansiblepush](https://github.com/ahelal/kitchen-ansiblepush). Remote servers, as specified in the ansible inventory, can be built with ansible automatically installed and run from your workstation.
97
-
98
- See example [https://github.com/neillturner/ansible_exec_repo](https://github.com/neillturner/ansible_exec_repo)
99
-
100
- ## Ansible AWX
101
-
102
- Kitchen ansible supports installing and using the open source version of Ansible Tower [Ansible AWX](https://github.com/ansible/awx) on a Centos 7. In future it will support the tower-cli for testing.
103
-
104
- See example [https://github.com/neillturner/ansible_awx_repo](https://github.com/neillturner/ansible_awx_repo)
105
-
106
- ## Using Roles from Ansible Galaxy
107
-
108
- Roles can be used from the Ansible Galaxy using two methods:
109
-
110
- 1. Specify a `requirements.yml` file in your Ansible repository. For more details see [here](http://docs.ansible.com/ansible/galaxy.html).
111
-
112
- 2. Use `librarian-ansible` by creating an `Ansiblefile` in the top level of the repository and `kitchen-ansible` will automatically call `librarian-ansible` during convergence. For a description of setting up an `Ansiblefile` see [here](https://werner-dijkerman.nl/2015/08/15/using-librarian-ansible-to-install-ansible-roles-from-gitlab/).
113
-
114
- ## Tips
115
-
116
- To use a single ~/.kitchen/config.yml file with multiple reposities by setting the WORKSPACE environment variable:
117
-
118
- ```yaml
119
- role_path: <%= ENV['WORKSPACE'] %>/roles
120
- ```
121
-
122
- You can easily skip previous instructions and jump directly to the broken statement you just fixed by passing an environment variable. Add the following to your `.kitchen.yml`:
123
-
124
- ```yaml
125
- provisioner:
126
- name: ansible_playbook
127
- ansible_extra_flags: <%= ENV['ANSIBLE_EXTRA_FLAGS'] %>
128
- ```
129
-
130
- Then run:
131
-
132
- ```
133
- $ ANSIBLE_EXTRA_FLAGS='--start-at-task="myrole | name of last working instruction"' kitchen converge
134
- ```
135
-
136
- You save a lot of time not running working instructions.
137
-
138
-
139
- ## Ruby install to run Serverspec verify
140
-
141
- By default test-kitchen installs Chef to get a Ruby version suitable to run Serverspec in the `verify` step.
142
- kitchen-verifier-serverspec installs its own ruby version so chef or ruby is not required to verify with serverspec :
143
-
144
- ```yaml
145
- require_chef_for_busser: false
146
- ```
147
- And set the verifier section:
148
- ```yaml
149
- verifier:
150
- name: serverspec
151
- sudo_path: true
152
-
153
- suites:
154
- - name: ansible
155
- driver_config:
156
- hostname: '54.229.34.169'
157
- verifier:
158
- patterns:
159
- - roles/tomcat/spec/tomcat_spec.rb
160
- bundler_path: '/usr/local/bin'
161
- rspec_path: '/usr/local/bin'
162
- env_vars:
163
- TARGET_HOST: 54.229.104.40
164
- LOGIN_USER: centos
165
- SUDO: true
166
- SSH_KEY: spec/test.pem
167
- ```
168
-
169
- Please see the [Provisioner Options](https://github.com/neillturner/kitchen-ansible/blob/master/provisioner_options.md) for a complete listing.
170
-
171
- ## Test-Kitchen Ansiblespec
172
-
173
- By using kitchen-verifier-serverspec and the Runner ansiblespec_runner tests can be run against multiple servers with multiple roles in the ansiblespec format.
174
-
175
- 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.
176
-
177
- See example [https://github.com/neillturner/ansible_ansiblespec_repo](https://github.com/neillturner/ansible_ansiblespec_repo)
178
-
179
- ### Example usage to create Tomcat servers:
180
-
181
- ![test-kitchen, Ansible and ansiblespec](https://github.com/neillturner/ansible_repo/blob/master/kitchen-ansible.png "test-kitchen, ansible and ansiblespec")
182
-
183
- See [ansible-sample-tdd](https://github.com/volanja/ansible-sample-tdd).
184
-
185
- ### Usage
186
-
187
- #### Directory
188
-
189
- In the Ansible repository specify:
190
-
191
- * spec files with the roles.
192
- * spec_helper in the spec folder (with code as below).
193
-
194
- ```
195
- .
196
- +-- roles
197
- ¦   +-- mariadb
198
- ¦   ¦   +-- spec
199
- ¦   ¦   ¦   +-- mariadb_spec.rb
200
- ¦   ¦   +-- tasks
201
- ¦   ¦   ¦   +-- main.yml
202
- ¦   ¦   +-- templates
203
- ¦   ¦   +-- mariadb.repo
204
- ¦   +-- nginx
205
- ¦   +-- handlers
206
- ¦   ¦   +-- main.yml
207
- ¦   +-- spec
208
- ¦   ¦   +-- nginx_spec.rb
209
- ¦   +-- tasks
210
- ¦   ¦   +-- main.yml
211
- ¦   +-- templates
212
- ¦   ¦   +-- nginx.repo
213
- ¦   +-- vars
214
- ¦   +-- main.yml
215
- +-- spec
216
- +-- spec_helper.rb
217
- +-- my_private_key.pem
218
- ```
219
-
220
-
221
- #### spec_helper
222
-
223
- ```ruby
224
- require 'rubygems'
225
- require 'bundler/setup'
226
-
227
- require 'serverspec'
228
- require 'pathname'
229
- require 'net/ssh'
230
-
231
- RSpec.configure do |config|
232
- set :host, ENV['TARGET_HOST']
233
- # ssh options at http://net-ssh.github.io/ssh/v1/chapter-2.html
234
- # ssh via password
235
- set :ssh_options, :user => ENV['LOGIN_USER'], :paranoid => false, :verbose => :error, :password => ENV['LOGIN_PASSWORD'] if ENV['LOGIN_PASSWORD']
236
- # ssh via ssh key
237
- set :ssh_options, :user => ENV['LOGIN_USER'], :paranoid => false, :verbose => :error, :host_key => 'ssh-rsa', :keys => [ ENV['SSH_KEY'] ] if ENV['SSH_KEY']
238
- set :backend, :ssh
239
- set :request_pty, true
240
- end
241
- ```
242
-
243
- See [kitchen-verifier-serverspec](https://github.com/neillturner/kitchen-verifier-serverspec).
244
-
245
- ## Alternative Virtualization/Cloud providers for Vagrant
246
- This could be adapted to use alternative virtualization/cloud providers such as Openstack/AWS/VMware Fusion according to whatever is supported by Vagrant.
247
- ```yaml
248
- platforms:
249
- - name: ubuntu-12.04
250
- driver_config:
251
- provider: aws
252
- box: my_base_box
253
- # username is based on what is configured in your box/ami
254
- username: ubuntu
255
- customize:
256
- access_key_id: 'AKKJHG659868LHGLH'
257
- secret_access_key: 'G8t7o+6HLG876JGF/58'
258
- ami: ami-7865ab765d
259
- instance_type: t2.micro
260
- # more customisation can go here, based on what the vagrant provider supports
261
- #security-groups: []
262
- ```
263
-
264
- ## Notes
265
-
266
- * The `default` in all of the above is the name of the test suite defined in the `suites` section of your `.kitchen.yml`, so if you have more than one suite of tests or change the name, you'll need to adapt the example accordingly.
267
- * Serverspec test files *must* be named `_spec.rb`
268
- * Since I'm using Vagrant, my `box` definitions refer to Vagrant boxes, either standard, published boxes available from [Atlas](http://atlas.hashicorp.com/boxes) or custom-created boxes (perhaps using [Packer](http://packer.io) and [bento](https://github.com/chef/bento), in which case you'll need to provide the URL in `box_url`.
269
-
1
+ # kitchen-ansible
2
+
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)
5
+ [![Build Status](https://travis-ci.org/neillturner/kitchen-ansible.png)](https://travis-ci.org/neillturner/kitchen-ansible)
6
+
7
+ A Test Kitchen Provisioner for Ansible.
8
+
9
+ The provisioner works by passing the Ansible repository based on attributes in `.kitchen.yml` & calling `ansible-playbook`.
10
+
11
+ It installs Ansible on the server and runs `ansible-playbook` using host localhost.
12
+
13
+ It has been tested against the Ubuntu 12.04/14.04/16.04, Centos 6/7 and Debian 6/7/8 boxes running in vagrant/virtualbox.
14
+
15
+ ## Requirements
16
+ - [Test Kitchen](https://github.com/test-kitchen/test-kitchen).
17
+ - a driver box without a Chef installation so Ansible can be installed.
18
+
19
+ ## Installation & Setup
20
+
21
+ 1. install the latest Ruby on your workstation (for windows see https://rubyinstaller.org/downloads/)
22
+
23
+ 2. If using Ruby version less than 2.3 first install earlier version of test-kitchen
24
+ ```
25
+ gem install test-kitchen -v 1.16.0
26
+ ```
27
+ 3. Install the `kitchen-ansible` gem in your system, along with [kitchen-vagrant](https://github.com/test-kitchen/kitchen-vagrant) or [kitchen-docker](https://github.com/test-kitchen/kitchen-docker) or any other suitable driver or the exec driver to run from your workstation:
28
+
29
+ ```
30
+ gem install kitchen-ansible
31
+ gem install kitchen-vagrant
32
+ ```
33
+
34
+
35
+
36
+ ## Resources
37
+ * https://blog.superk.org/home/ansible-role-development
38
+ * https://alexharv074.github.io/2016/05/25/testing-an-ansible-role-using-test-kitchen.html
39
+ * https://alexharv074.github.io/2016/06/13/integration-testing-using-ansible-and-test-kitchen.html
40
+ * https://github.com/MattHodge/ansible-testkitchen-windows
41
+ * https://readme.fr/continuous-integration-for-ansible/
42
+ * https://dantehranian.wordpress.com/2015/06/18/testing-ansible-roles-with-test-kitchen
43
+ * http://www.slideshare.net/MartinEtmajer/testing-ansible-roles-with-test-kitchen-serverspec-and-rspec-48185017
44
+ * http://blog.el-chavez.me/2016/02/16/ansible-galaxy-test-kitchen
45
+ * https://werner-dijkerman.nl/2015/08/20/using-test-kitchen-with-docker-and-serverspec-to-test-ansible-roles
46
+ * https://books.google.co.uk/books?id=D-wmDQAAQBAJ&pg=PA129&lpg
47
+
48
+ ## Example .kitchen.yml file
49
+
50
+ Based on the [Tomcat Standalone](https://github.com/ansible/ansible-examples/tree/master/tomcat-standalone) example:
51
+
52
+ ```yaml
53
+ ---
54
+ driver:
55
+ name: vagrant
56
+
57
+ provisioner:
58
+ name: ansible_playbook
59
+ roles_path: roles
60
+ hosts: tomcat-servers
61
+ require_ansible_repo: true
62
+ ansible_verbose: true
63
+ ansible_version: latest
64
+ require_chef_for_busser: false
65
+ additional_ssh_private_keys:
66
+ - /mykey/id_rsa
67
+
68
+ platforms:
69
+ - name: nocm_centos-6.5
70
+ driver_plugin: vagrant
71
+ driver_config:
72
+ box: nocm_centos-6.5
73
+ box_url: http://puppet-vagrant-boxes.puppetlabs.com/centos-65-x64-virtualbox-nocm.box
74
+ network:
75
+ - ['forwarded_port', {guest: 8080, host: 8080}]
76
+ - ['private_network', {ip: '192.168.33.11'}]
77
+ ```
78
+
79
+ See example [https://github.com/neillturner/ansible_repo](https://github.com/neillturner/ansible_repo)
80
+
81
+ ## Windows Support
82
+
83
+ Windows is supported by creating a linux server to run Ansible with software required to support winrm. Then the winrm connection is used to configure the windows server.
84
+
85
+ In `.kitchen.yml` set:
86
+
87
+ ```yaml
88
+ ansible_connection: winrm
89
+ require_windows_support: true
90
+ require_chef_for_busser: false
91
+ ```
92
+
93
+ See the [Ansible Windows repo](https://github.com/neillturner/ansible_windows_repo) example.
94
+
95
+ ## Test Kitchen Exec Driver
96
+
97
+ By using the test-kitchen exec driver ansible can be driven from your workstation. This provides similar functionality to [kitchen-ansiblepush](https://github.com/ahelal/kitchen-ansiblepush). Remote servers, as specified in the ansible inventory, can be built with ansible automatically installed and run from your workstation.
98
+
99
+ See example [https://github.com/neillturner/ansible_exec_repo](https://github.com/neillturner/ansible_exec_repo)
100
+
101
+ ## Ansible AWX
102
+
103
+ Kitchen ansible supports installing and using the open source version of Ansible Tower [Ansible AWX](https://github.com/ansible/awx) on a Centos 7. In future it will support the tower-cli for testing.
104
+
105
+ See example [https://github.com/neillturner/ansible_awx_repo](https://github.com/neillturner/ansible_awx_repo)
106
+
107
+ ## Using Roles from Ansible Galaxy
108
+
109
+ Roles can be used from the Ansible Galaxy using two methods:
110
+
111
+ 1. Specify a `requirements.yml` file in your Ansible repository. For more details see [here](http://docs.ansible.com/ansible/galaxy.html).
112
+
113
+ 2. Use `librarian-ansible` by creating an `Ansiblefile` in the top level of the repository and `kitchen-ansible` will automatically call `librarian-ansible` during convergence. For a description of setting up an `Ansiblefile` see [here](https://werner-dijkerman.nl/2015/08/15/using-librarian-ansible-to-install-ansible-roles-from-gitlab/).
114
+
115
+ ## Tips
116
+
117
+ To use a single ~/.kitchen/config.yml file with multiple reposities by setting the WORKSPACE environment variable:
118
+
119
+ ```yaml
120
+ role_path: <%= ENV['WORKSPACE'] %>/roles
121
+ ```
122
+
123
+ You can easily skip previous instructions and jump directly to the broken statement you just fixed by passing an environment variable. Add the following to your `.kitchen.yml`:
124
+
125
+ ```yaml
126
+ provisioner:
127
+ name: ansible_playbook
128
+ ansible_extra_flags: <%= ENV['ANSIBLE_EXTRA_FLAGS'] %>
129
+ ```
130
+
131
+ Then run:
132
+
133
+ ```
134
+ $ ANSIBLE_EXTRA_FLAGS='--start-at-task="myrole | name of last working instruction"' kitchen converge
135
+ ```
136
+
137
+ You save a lot of time not running working instructions.
138
+
139
+
140
+ ## Ruby install to run Serverspec verify
141
+
142
+ By default test-kitchen installs Chef to get a Ruby version suitable to run Serverspec in the `verify` step.
143
+ kitchen-verifier-serverspec installs its own ruby version so chef or ruby is not required to verify with serverspec :
144
+
145
+ ```yaml
146
+ require_chef_for_busser: false
147
+ ```
148
+ And set the verifier section:
149
+ ```yaml
150
+ verifier:
151
+ name: serverspec
152
+ sudo_path: true
153
+
154
+ suites:
155
+ - name: ansible
156
+ driver_config:
157
+ hostname: '54.229.34.169'
158
+ verifier:
159
+ patterns:
160
+ - roles/tomcat/spec/tomcat_spec.rb
161
+ bundler_path: '/usr/local/bin'
162
+ rspec_path: '/usr/local/bin'
163
+ env_vars:
164
+ TARGET_HOST: 54.229.104.40
165
+ LOGIN_USER: centos
166
+ SUDO: true
167
+ SSH_KEY: spec/test.pem
168
+ ```
169
+
170
+ Please see the [Provisioner Options](https://github.com/neillturner/kitchen-ansible/blob/master/provisioner_options.md) for a complete listing.
171
+
172
+ ## Test-Kitchen Ansiblespec
173
+
174
+ By using kitchen-verifier-serverspec and the Runner ansiblespec_runner tests can be run against multiple servers with multiple roles in the ansiblespec format.
175
+
176
+ 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.
177
+
178
+ See example [https://github.com/neillturner/ansible_ansiblespec_repo](https://github.com/neillturner/ansible_ansiblespec_repo)
179
+
180
+ ### Example usage to create Tomcat servers:
181
+
182
+ ![test-kitchen, Ansible and ansiblespec](https://github.com/neillturner/ansible_repo/blob/master/kitchen-ansible.png "test-kitchen, ansible and ansiblespec")
183
+
184
+ See [ansible-sample-tdd](https://github.com/volanja/ansible-sample-tdd).
185
+
186
+ ### Usage
187
+
188
+ #### Directory
189
+
190
+ In the Ansible repository specify:
191
+
192
+ * spec files with the roles.
193
+ * spec_helper in the spec folder (with code as below).
194
+
195
+ ```
196
+ .
197
+ +-- roles
198
+ ¦   +-- mariadb
199
+ ¦   ¦   +-- spec
200
+ ¦   ¦   ¦   +-- mariadb_spec.rb
201
+ ¦   ¦   +-- tasks
202
+ ¦   ¦   ¦   +-- main.yml
203
+ ¦   ¦   +-- templates
204
+ ¦   ¦   +-- mariadb.repo
205
+ ¦   +-- nginx
206
+ ¦   +-- handlers
207
+ ¦   ¦   +-- main.yml
208
+ ¦   +-- spec
209
+ ¦   ¦   +-- nginx_spec.rb
210
+ ¦   +-- tasks
211
+ ¦   ¦   +-- main.yml
212
+ ¦   +-- templates
213
+ ¦   ¦   +-- nginx.repo
214
+ ¦   +-- vars
215
+ ¦   +-- main.yml
216
+ +-- spec
217
+ +-- spec_helper.rb
218
+ +-- my_private_key.pem
219
+ ```
220
+
221
+
222
+ #### spec_helper
223
+
224
+ ```ruby
225
+ require 'rubygems'
226
+ require 'bundler/setup'
227
+
228
+ require 'serverspec'
229
+ require 'pathname'
230
+ require 'net/ssh'
231
+
232
+ RSpec.configure do |config|
233
+ set :host, ENV['TARGET_HOST']
234
+ # ssh options at http://net-ssh.github.io/ssh/v1/chapter-2.html
235
+ # ssh via password
236
+ set :ssh_options, :user => ENV['LOGIN_USER'], :paranoid => false, :verbose => :error, :password => ENV['LOGIN_PASSWORD'] if ENV['LOGIN_PASSWORD']
237
+ # ssh via ssh key
238
+ set :ssh_options, :user => ENV['LOGIN_USER'], :paranoid => false, :verbose => :error, :host_key => 'ssh-rsa', :keys => [ ENV['SSH_KEY'] ] if ENV['SSH_KEY']
239
+ set :backend, :ssh
240
+ set :request_pty, true
241
+ end
242
+ ```
243
+
244
+ See [kitchen-verifier-serverspec](https://github.com/neillturner/kitchen-verifier-serverspec).
245
+
246
+ ## Alternative Virtualization/Cloud providers for Vagrant
247
+ This could be adapted to use alternative virtualization/cloud providers such as Openstack/AWS/VMware Fusion according to whatever is supported by Vagrant.
248
+ ```yaml
249
+ platforms:
250
+ - name: ubuntu-12.04
251
+ driver_config:
252
+ provider: aws
253
+ box: my_base_box
254
+ # username is based on what is configured in your box/ami
255
+ username: ubuntu
256
+ customize:
257
+ access_key_id: 'AKKJHG659868LHGLH'
258
+ secret_access_key: 'G8t7o+6HLG876JGF/58'
259
+ ami: ami-7865ab765d
260
+ instance_type: t2.micro
261
+ # more customisation can go here, based on what the vagrant provider supports
262
+ #security-groups: []
263
+ ```
264
+
265
+ ## Notes
266
+
267
+ * The `default` in all of the above is the name of the test suite defined in the `suites` section of your `.kitchen.yml`, so if you have more than one suite of tests or change the name, you'll need to adapt the example accordingly.
268
+ * Serverspec test files *must* be named `_spec.rb`
269
+ * Since I'm using Vagrant, my `box` definitions refer to Vagrant boxes, either standard, published boxes available from [Atlas](http://atlas.hashicorp.com/boxes) or custom-created boxes (perhaps using [Packer](http://packer.io) and [bento](https://github.com/chef/bento), in which case you'll need to provide the URL in `box_url`.
270
+
@@ -1,35 +1,35 @@
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_development_dependency 'rspec'
30
- s.add_development_dependency 'pry'
31
- s.add_development_dependency 'rake'
32
- s.required_ruby_version = '>= 2.0'
33
- s.add_dependency 'test-kitchen', '~> 1.4'
34
- s.add_dependency 'net-ssh', '>= 3'
35
- 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_development_dependency 'rspec'
30
+ s.add_development_dependency 'pry'
31
+ s.add_development_dependency 'rake'
32
+ s.required_ruby_version = '>= 2.0'
33
+ s.add_dependency 'test-kitchen', '~> 1.4'
34
+ s.add_dependency 'net-ssh', '>= 3'
35
+ end