kitchen-ansible 0.44.4 → 0.44.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 +224 -224
- data/kitchen-ansible.gemspec +39 -39
- data/lib/kitchen-ansible/version.rb +6 -6
- data/lib/kitchen/provisioner/ansible/config.rb +172 -171
- data/lib/kitchen/provisioner/ansible/librarian.rb +78 -78
- data/lib/kitchen/provisioner/ansible/os.rb +69 -69
- data/lib/kitchen/provisioner/ansible/os/amazon.rb +42 -42
- data/lib/kitchen/provisioner/ansible/os/debian.rb +69 -69
- 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 +1040 -1039
- data/provisioner_options.md +100 -100
- metadata +16 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a2ae94568dfbde9ddc1ffc0842ab25d29e89f5bd
|
4
|
+
data.tar.gz: 5fab05dd26b8e44e49ffd5e1aff8f82a6ddaa3c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 00196e338c949de05e2cbc065247f13ecda8f6d17f77764b18a8b313c8ff485be876cdf6154c7d01e6fa0bf4c3e72589193ad9bf2155de570a07e0eba5184bbf
|
7
|
+
data.tar.gz: e31a591ba021a2474458627f0ff5039818207fcb0e28db2b10df30385b332652c0eccb20113001557009fddb991456d0da37134cdf3b60247931e7f27862e3c3
|
data/README.md
CHANGED
@@ -1,224 +1,224 @@
|
|
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, Ubuntu 14.04, Centos 6.5 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
|
-
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:
|
21
|
-
|
22
|
-
```
|
23
|
-
gem install kitchen-ansible
|
24
|
-
gem install kitchen-vagrant
|
25
|
-
```
|
26
|
-
|
27
|
-
## Example .kitchen.yml file
|
28
|
-
|
29
|
-
Based on the [Tomcat Standalone](https://github.com/ansible/ansible-examples/tree/master/tomcat-standalone) example:
|
30
|
-
|
31
|
-
```yaml
|
32
|
-
---
|
33
|
-
driver:
|
34
|
-
name: vagrant
|
35
|
-
|
36
|
-
provisioner:
|
37
|
-
name: ansible_playbook
|
38
|
-
roles_path: roles
|
39
|
-
hosts: tomcat-servers
|
40
|
-
require_ansible_repo: true
|
41
|
-
ansible_verbose: true
|
42
|
-
ansible_version: latest
|
43
|
-
|
44
|
-
platforms:
|
45
|
-
- name: nocm_centos-6.5
|
46
|
-
driver_plugin: vagrant
|
47
|
-
driver_config:
|
48
|
-
box: nocm_centos-6.5
|
49
|
-
box_url: http://puppet-vagrant-boxes.puppetlabs.com/centos-65-x64-virtualbox-nocm.box
|
50
|
-
network:
|
51
|
-
- ['forwarded_port', {guest: 8080, host: 8080}]
|
52
|
-
- ['private_network', {ip: '192.168.33.11'}]
|
53
|
-
```
|
54
|
-
|
55
|
-
## Test-Kitchen Ansible Windows Support
|
56
|
-
|
57
|
-
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.
|
58
|
-
|
59
|
-
In `.kitchen.yml` set:
|
60
|
-
|
61
|
-
```yaml
|
62
|
-
ansible_connection: winrm
|
63
|
-
require_windows_support: true
|
64
|
-
require_chef_for_busser: false
|
65
|
-
```
|
66
|
-
|
67
|
-
See the [Ansible Windows repo](https://github.com/neillturner/ansible_windows_repo) example.
|
68
|
-
|
69
|
-
## Using Roles from Ansible Galaxy
|
70
|
-
|
71
|
-
Roles can be used from the Ansible Galaxy using two methods:
|
72
|
-
|
73
|
-
1. Specify a `requirements.yml` file in your Ansible repository. For more details see [here](http://docs.ansible.com/ansible/galaxy.html).
|
74
|
-
|
75
|
-
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/).
|
76
|
-
|
77
|
-
## Ruby install to run Serverspec verify
|
78
|
-
|
79
|
-
By default test-kitchen installs Chef to get a Ruby version suitable to run Serverspec in the `verify` step.
|
80
|
-
Instead Ruby can just be installed by specifying the provisioner option:
|
81
|
-
|
82
|
-
```yaml
|
83
|
-
require_ruby_for_busser: true
|
84
|
-
```
|
85
|
-
And set the verifier section:
|
86
|
-
```yaml
|
87
|
-
verifier:
|
88
|
-
name: serverspec
|
89
|
-
sudo_path: true
|
90
|
-
|
91
|
-
suites:
|
92
|
-
- name: ansible
|
93
|
-
driver_config:
|
94
|
-
hostname: '54.229.34.169'
|
95
|
-
verifier:
|
96
|
-
patterns:
|
97
|
-
- roles/tomcat/spec/tomcat_spec.rb
|
98
|
-
bundler_path: '/usr/local/bin'
|
99
|
-
rspec_path: '/usr/local/bin'
|
100
|
-
env_vars:
|
101
|
-
TARGET_HOST: 54.229.104.40
|
102
|
-
LOGIN_USER: centos
|
103
|
-
SUDO: true
|
104
|
-
SSH_KEY: spec/test.pem
|
105
|
-
```
|
106
|
-
|
107
|
-
Please see the [Provisioner Options](https://github.com/neillturner/kitchen-ansible/blob/master/provisioner_options.md) for a complete listing.
|
108
|
-
|
109
|
-
## Test-Kitchen Ansiblespec
|
110
|
-
|
111
|
-
By using kitchen-verifier-serverspec and the Runner ansiblespec_runner tests can be run against multiple servers with multiple roles in the ansiblespec format.
|
112
|
-
|
113
|
-
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.
|
114
|
-
|
115
|
-
See example [https://github.com/neillturner/ansible_repo](https://github.com/neillturner/ansible_repo)
|
116
|
-
|
117
|
-
### Example usage to create Tomcat servers:
|
118
|
-
|
119
|
-
![test-kitchen, Ansible and ansiblespec](https://github.com/neillturner/ansible_repo/blob/master/kitchen-ansible.png "test-kitchen, ansible and ansiblespec")
|
120
|
-
|
121
|
-
See [ansible-sample-tdd](https://github.com/volanja/ansible-sample-tdd).
|
122
|
-
|
123
|
-
### Usage
|
124
|
-
|
125
|
-
#### Directory
|
126
|
-
|
127
|
-
In the Ansible repository specify:
|
128
|
-
|
129
|
-
* spec files with the roles.
|
130
|
-
* spec_helper in the spec folder (with code as below).
|
131
|
-
|
132
|
-
```
|
133
|
-
.
|
134
|
-
+-- roles
|
135
|
-
¦ +-- mariadb
|
136
|
-
¦ ¦ +-- spec
|
137
|
-
¦ ¦ ¦ +-- mariadb_spec.rb
|
138
|
-
¦ ¦ +-- tasks
|
139
|
-
¦ ¦ ¦ +-- main.yml
|
140
|
-
¦ ¦ +-- templates
|
141
|
-
¦ ¦ +-- mariadb.repo
|
142
|
-
¦ +-- nginx
|
143
|
-
¦ +-- handlers
|
144
|
-
¦ ¦ +-- main.yml
|
145
|
-
¦ +-- spec
|
146
|
-
¦ ¦ +-- nginx_spec.rb
|
147
|
-
¦ +-- tasks
|
148
|
-
¦ ¦ +-- main.yml
|
149
|
-
¦ +-- templates
|
150
|
-
¦ ¦ +-- nginx.repo
|
151
|
-
¦ +-- vars
|
152
|
-
¦ +-- main.yml
|
153
|
-
+-- spec
|
154
|
-
+-- spec_helper.rb
|
155
|
-
+-- my_private_key.pem
|
156
|
-
```
|
157
|
-
|
158
|
-
|
159
|
-
#### spec_helper
|
160
|
-
|
161
|
-
```ruby
|
162
|
-
require 'rubygems'
|
163
|
-
require 'bundler/setup'
|
164
|
-
|
165
|
-
require 'serverspec'
|
166
|
-
require 'pathname'
|
167
|
-
require 'net/ssh'
|
168
|
-
|
169
|
-
RSpec.configure do |config|
|
170
|
-
set :host, ENV['TARGET_HOST']
|
171
|
-
# ssh options at http://net-ssh.github.io/ssh/v1/chapter-2.html
|
172
|
-
# ssh via password
|
173
|
-
set :ssh_options, :user => ENV['LOGIN_USER'], :paranoid => false, :verbose => :error, :password => ENV['LOGIN_PASSWORD'] if ENV['LOGIN_PASSWORD']
|
174
|
-
# ssh via ssh key
|
175
|
-
set :ssh_options, :user => ENV['LOGIN_USER'], :paranoid => false, :verbose => :error, :host_key => 'ssh-rsa', :keys => [ ENV['SSH_KEY'] ] if ENV['SSH_KEY']
|
176
|
-
set :backend, :ssh
|
177
|
-
set :request_pty, true
|
178
|
-
end
|
179
|
-
```
|
180
|
-
|
181
|
-
See [kitchen-verifier-serverspec](https://github.com/neillturner/kitchen-verifier-serverspec).
|
182
|
-
|
183
|
-
## Alternative Virtualization/Cloud providers for Vagrant
|
184
|
-
This could be adapted to use alternative virtualization/cloud providers such as Openstack/AWS/VMware Fusion according to whatever is supported by Vagrant.
|
185
|
-
```yaml
|
186
|
-
platforms:
|
187
|
-
- name: ubuntu-12.04
|
188
|
-
driver_config:
|
189
|
-
provider: aws
|
190
|
-
box: my_base_box
|
191
|
-
# username is based on what is configured in your box/ami
|
192
|
-
username: ubuntu
|
193
|
-
customize:
|
194
|
-
access_key_id: 'AKKJHG659868LHGLH'
|
195
|
-
secret_access_key: 'G8t7o+6HLG876JGF/58'
|
196
|
-
ami: ami-7865ab765d
|
197
|
-
instance_type: t2.micro
|
198
|
-
# more customisation can go here, based on what the vagrant provider supports
|
199
|
-
#security-groups: []
|
200
|
-
```
|
201
|
-
|
202
|
-
## Notes
|
203
|
-
|
204
|
-
* 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.
|
205
|
-
* Serverspec test files *must* be named `_spec.rb`
|
206
|
-
* 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`.
|
207
|
-
|
208
|
-
## Tips
|
209
|
-
|
210
|
-
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`:
|
211
|
-
|
212
|
-
```yaml
|
213
|
-
provisioner:
|
214
|
-
name: ansible_playbook
|
215
|
-
ansible_extra_flags: <%= ENV['ANSIBLE_EXTRA_FLAGS'] %>
|
216
|
-
```
|
217
|
-
|
218
|
-
Then run:
|
219
|
-
|
220
|
-
```
|
221
|
-
$ ANSIBLE_EXTRA_FLAGS='--start-at-task="myrole | name of last working instruction"' kitchen converge
|
222
|
-
```
|
223
|
-
|
224
|
-
You save a lot of time not running working instructions.
|
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, Ubuntu 14.04, Centos 6.5 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
|
+
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:
|
21
|
+
|
22
|
+
```
|
23
|
+
gem install kitchen-ansible
|
24
|
+
gem install kitchen-vagrant
|
25
|
+
```
|
26
|
+
|
27
|
+
## Example .kitchen.yml file
|
28
|
+
|
29
|
+
Based on the [Tomcat Standalone](https://github.com/ansible/ansible-examples/tree/master/tomcat-standalone) example:
|
30
|
+
|
31
|
+
```yaml
|
32
|
+
---
|
33
|
+
driver:
|
34
|
+
name: vagrant
|
35
|
+
|
36
|
+
provisioner:
|
37
|
+
name: ansible_playbook
|
38
|
+
roles_path: roles
|
39
|
+
hosts: tomcat-servers
|
40
|
+
require_ansible_repo: true
|
41
|
+
ansible_verbose: true
|
42
|
+
ansible_version: latest
|
43
|
+
|
44
|
+
platforms:
|
45
|
+
- name: nocm_centos-6.5
|
46
|
+
driver_plugin: vagrant
|
47
|
+
driver_config:
|
48
|
+
box: nocm_centos-6.5
|
49
|
+
box_url: http://puppet-vagrant-boxes.puppetlabs.com/centos-65-x64-virtualbox-nocm.box
|
50
|
+
network:
|
51
|
+
- ['forwarded_port', {guest: 8080, host: 8080}]
|
52
|
+
- ['private_network', {ip: '192.168.33.11'}]
|
53
|
+
```
|
54
|
+
|
55
|
+
## Test-Kitchen Ansible Windows Support
|
56
|
+
|
57
|
+
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.
|
58
|
+
|
59
|
+
In `.kitchen.yml` set:
|
60
|
+
|
61
|
+
```yaml
|
62
|
+
ansible_connection: winrm
|
63
|
+
require_windows_support: true
|
64
|
+
require_chef_for_busser: false
|
65
|
+
```
|
66
|
+
|
67
|
+
See the [Ansible Windows repo](https://github.com/neillturner/ansible_windows_repo) example.
|
68
|
+
|
69
|
+
## Using Roles from Ansible Galaxy
|
70
|
+
|
71
|
+
Roles can be used from the Ansible Galaxy using two methods:
|
72
|
+
|
73
|
+
1. Specify a `requirements.yml` file in your Ansible repository. For more details see [here](http://docs.ansible.com/ansible/galaxy.html).
|
74
|
+
|
75
|
+
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/).
|
76
|
+
|
77
|
+
## Ruby install to run Serverspec verify
|
78
|
+
|
79
|
+
By default test-kitchen installs Chef to get a Ruby version suitable to run Serverspec in the `verify` step.
|
80
|
+
Instead Ruby can just be installed by specifying the provisioner option:
|
81
|
+
|
82
|
+
```yaml
|
83
|
+
require_ruby_for_busser: true
|
84
|
+
```
|
85
|
+
And set the verifier section:
|
86
|
+
```yaml
|
87
|
+
verifier:
|
88
|
+
name: serverspec
|
89
|
+
sudo_path: true
|
90
|
+
|
91
|
+
suites:
|
92
|
+
- name: ansible
|
93
|
+
driver_config:
|
94
|
+
hostname: '54.229.34.169'
|
95
|
+
verifier:
|
96
|
+
patterns:
|
97
|
+
- roles/tomcat/spec/tomcat_spec.rb
|
98
|
+
bundler_path: '/usr/local/bin'
|
99
|
+
rspec_path: '/usr/local/bin'
|
100
|
+
env_vars:
|
101
|
+
TARGET_HOST: 54.229.104.40
|
102
|
+
LOGIN_USER: centos
|
103
|
+
SUDO: true
|
104
|
+
SSH_KEY: spec/test.pem
|
105
|
+
```
|
106
|
+
|
107
|
+
Please see the [Provisioner Options](https://github.com/neillturner/kitchen-ansible/blob/master/provisioner_options.md) for a complete listing.
|
108
|
+
|
109
|
+
## Test-Kitchen Ansiblespec
|
110
|
+
|
111
|
+
By using kitchen-verifier-serverspec and the Runner ansiblespec_runner tests can be run against multiple servers with multiple roles in the ansiblespec format.
|
112
|
+
|
113
|
+
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.
|
114
|
+
|
115
|
+
See example [https://github.com/neillturner/ansible_repo](https://github.com/neillturner/ansible_repo)
|
116
|
+
|
117
|
+
### Example usage to create Tomcat servers:
|
118
|
+
|
119
|
+
![test-kitchen, Ansible and ansiblespec](https://github.com/neillturner/ansible_repo/blob/master/kitchen-ansible.png "test-kitchen, ansible and ansiblespec")
|
120
|
+
|
121
|
+
See [ansible-sample-tdd](https://github.com/volanja/ansible-sample-tdd).
|
122
|
+
|
123
|
+
### Usage
|
124
|
+
|
125
|
+
#### Directory
|
126
|
+
|
127
|
+
In the Ansible repository specify:
|
128
|
+
|
129
|
+
* spec files with the roles.
|
130
|
+
* spec_helper in the spec folder (with code as below).
|
131
|
+
|
132
|
+
```
|
133
|
+
.
|
134
|
+
+-- roles
|
135
|
+
¦ +-- mariadb
|
136
|
+
¦ ¦ +-- spec
|
137
|
+
¦ ¦ ¦ +-- mariadb_spec.rb
|
138
|
+
¦ ¦ +-- tasks
|
139
|
+
¦ ¦ ¦ +-- main.yml
|
140
|
+
¦ ¦ +-- templates
|
141
|
+
¦ ¦ +-- mariadb.repo
|
142
|
+
¦ +-- nginx
|
143
|
+
¦ +-- handlers
|
144
|
+
¦ ¦ +-- main.yml
|
145
|
+
¦ +-- spec
|
146
|
+
¦ ¦ +-- nginx_spec.rb
|
147
|
+
¦ +-- tasks
|
148
|
+
¦ ¦ +-- main.yml
|
149
|
+
¦ +-- templates
|
150
|
+
¦ ¦ +-- nginx.repo
|
151
|
+
¦ +-- vars
|
152
|
+
¦ +-- main.yml
|
153
|
+
+-- spec
|
154
|
+
+-- spec_helper.rb
|
155
|
+
+-- my_private_key.pem
|
156
|
+
```
|
157
|
+
|
158
|
+
|
159
|
+
#### spec_helper
|
160
|
+
|
161
|
+
```ruby
|
162
|
+
require 'rubygems'
|
163
|
+
require 'bundler/setup'
|
164
|
+
|
165
|
+
require 'serverspec'
|
166
|
+
require 'pathname'
|
167
|
+
require 'net/ssh'
|
168
|
+
|
169
|
+
RSpec.configure do |config|
|
170
|
+
set :host, ENV['TARGET_HOST']
|
171
|
+
# ssh options at http://net-ssh.github.io/ssh/v1/chapter-2.html
|
172
|
+
# ssh via password
|
173
|
+
set :ssh_options, :user => ENV['LOGIN_USER'], :paranoid => false, :verbose => :error, :password => ENV['LOGIN_PASSWORD'] if ENV['LOGIN_PASSWORD']
|
174
|
+
# ssh via ssh key
|
175
|
+
set :ssh_options, :user => ENV['LOGIN_USER'], :paranoid => false, :verbose => :error, :host_key => 'ssh-rsa', :keys => [ ENV['SSH_KEY'] ] if ENV['SSH_KEY']
|
176
|
+
set :backend, :ssh
|
177
|
+
set :request_pty, true
|
178
|
+
end
|
179
|
+
```
|
180
|
+
|
181
|
+
See [kitchen-verifier-serverspec](https://github.com/neillturner/kitchen-verifier-serverspec).
|
182
|
+
|
183
|
+
## Alternative Virtualization/Cloud providers for Vagrant
|
184
|
+
This could be adapted to use alternative virtualization/cloud providers such as Openstack/AWS/VMware Fusion according to whatever is supported by Vagrant.
|
185
|
+
```yaml
|
186
|
+
platforms:
|
187
|
+
- name: ubuntu-12.04
|
188
|
+
driver_config:
|
189
|
+
provider: aws
|
190
|
+
box: my_base_box
|
191
|
+
# username is based on what is configured in your box/ami
|
192
|
+
username: ubuntu
|
193
|
+
customize:
|
194
|
+
access_key_id: 'AKKJHG659868LHGLH'
|
195
|
+
secret_access_key: 'G8t7o+6HLG876JGF/58'
|
196
|
+
ami: ami-7865ab765d
|
197
|
+
instance_type: t2.micro
|
198
|
+
# more customisation can go here, based on what the vagrant provider supports
|
199
|
+
#security-groups: []
|
200
|
+
```
|
201
|
+
|
202
|
+
## Notes
|
203
|
+
|
204
|
+
* 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.
|
205
|
+
* Serverspec test files *must* be named `_spec.rb`
|
206
|
+
* 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`.
|
207
|
+
|
208
|
+
## Tips
|
209
|
+
|
210
|
+
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`:
|
211
|
+
|
212
|
+
```yaml
|
213
|
+
provisioner:
|
214
|
+
name: ansible_playbook
|
215
|
+
ansible_extra_flags: <%= ENV['ANSIBLE_EXTRA_FLAGS'] %>
|
216
|
+
```
|
217
|
+
|
218
|
+
Then run:
|
219
|
+
|
220
|
+
```
|
221
|
+
$ ANSIBLE_EXTRA_FLAGS='--start-at-task="myrole | name of last working instruction"' kitchen converge
|
222
|
+
```
|
223
|
+
|
224
|
+
You save a lot of time not running working instructions.
|