kitchen-ansible 0.42.5 → 0.43.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 +47 -55
- data/lib/kitchen-ansible/version.rb +1 -1
- data/lib/kitchen/provisioner/ansible/config.rb +2 -1
- data/lib/kitchen/provisioner/ansible_playbook.rb +41 -11
- data/provisioner_options.md +79 -113
- 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: 7af6d938b0b846fc446f5a7e9ab9fbc43547491e
|
4
|
+
data.tar.gz: 075abcd0d5ca3220e8a8394c17e6272eef9b928f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9d24f83915e3e451171d49a013990ae88957b373ae0569ddf9d38a4eaf66e5b528fed6da91e0bcc04f29328fc423bf465e4d89e563a8a090eb3c86d40ed2806a
|
7
|
+
data.tar.gz: 89dc690449cdc55e55f50f4f6ed0aeff7cb54d2cc60825c8ec8bb9da8a94cfa637dd245da8d3376703aca480f34e07292648ef3b3a67c30ad3f08003f3d426d2
|
data/README.md
CHANGED
@@ -6,32 +6,32 @@
|
|
6
6
|
|
7
7
|
A Test Kitchen Provisioner for Ansible.
|
8
8
|
|
9
|
-
The provisioner works by passing the
|
9
|
+
The provisioner works by passing the Ansible repository based on attributes in `.kitchen.yml` & calling `ansible-playbook`.
|
10
10
|
|
11
11
|
It installs Ansible on the server and runs `ansible-playbook` using host localhost.
|
12
12
|
|
13
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
14
|
|
15
15
|
## Requirements
|
16
|
-
- [
|
17
|
-
- a driver box without a
|
16
|
+
- [Test Kitchen](https://github.com/test-kitchen/test-kitchen).
|
17
|
+
- a driver box without a Chef installation so Ansible can be installed.
|
18
18
|
|
19
19
|
## Installation & Setup
|
20
|
-
Install the kitchen-ansible gem in your system, along with [kitchen-vagrant](https://github.com/test-kitchen/kitchen-vagrant) or
|
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
21
|
|
22
22
|
```
|
23
23
|
gem install kitchen-ansible
|
24
24
|
gem install kitchen-vagrant
|
25
25
|
```
|
26
26
|
|
27
|
-
## Example kitchen.yml file
|
27
|
+
## Example .kitchen.yml file
|
28
28
|
|
29
|
-
Based on the
|
29
|
+
Based on the [Tomcat Standalone](https://github.com/ansible/ansible-examples/tree/master/tomcat-standalone) example:
|
30
30
|
|
31
31
|
```yaml
|
32
32
|
---
|
33
33
|
driver:
|
34
|
-
|
34
|
+
name: vagrant
|
35
35
|
|
36
36
|
provisioner:
|
37
37
|
name: ansible_playbook
|
@@ -40,8 +40,6 @@ provisioner:
|
|
40
40
|
require_ansible_repo: true
|
41
41
|
ansible_verbose: true
|
42
42
|
ansible_version: latest
|
43
|
-
extra_vars:
|
44
|
-
a: b
|
45
43
|
|
46
44
|
platforms:
|
47
45
|
- name: nocm_centos-6.5
|
@@ -51,41 +49,41 @@ platforms:
|
|
51
49
|
box_url: http://puppet-vagrant-boxes.puppetlabs.com/centos-65-x64-virtualbox-nocm.box
|
52
50
|
network:
|
53
51
|
- ['forwarded_port', {guest: 8080, host: 8080}]
|
54
|
-
- [
|
52
|
+
- ['private_network', {ip: '192.168.33.11'}]
|
55
53
|
```
|
56
54
|
|
57
55
|
## Test-Kitchen Ansible Windows Support
|
58
56
|
|
59
|
-
Windows is supported by creating a linux server to run
|
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.
|
60
58
|
|
61
|
-
In kitchen.yml set
|
59
|
+
In `.kitchen.yml` set:
|
62
60
|
|
63
|
-
```
|
61
|
+
```yaml
|
64
62
|
ansible_connection: winrm
|
65
63
|
require_windows_support: true
|
66
64
|
require_chef_for_busser: false
|
67
65
|
```
|
68
66
|
|
69
|
-
See
|
67
|
+
See the [Ansible Windows repo](https://github.com/neillturner/ansible_windows_repo) example.
|
70
68
|
|
71
69
|
## Using Roles from Ansible Galaxy
|
72
70
|
|
73
|
-
Roles can be used from the Ansible Galaxy using
|
71
|
+
Roles can be used from the Ansible Galaxy using two methods:
|
74
72
|
|
75
|
-
1. Specify a requirements.yml file in your
|
73
|
+
1. Specify a `requirements.yml` file in your Ansible repository. For more details see [here](http://docs.ansible.com/ansible/galaxy.html).
|
76
74
|
|
77
|
-
2. Use librarian-ansible by creating an
|
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/).
|
78
76
|
|
79
|
-
## Ruby install to run
|
77
|
+
## Ruby install to run Serverspec verify
|
80
78
|
|
81
|
-
By default test-kitchen installs
|
82
|
-
Instead
|
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:
|
83
81
|
|
84
|
-
```
|
82
|
+
```yaml
|
85
83
|
require_ruby_for_busser: true
|
86
84
|
```
|
87
85
|
And set the verifier section:
|
88
|
-
```
|
86
|
+
```yaml
|
89
87
|
verifier:
|
90
88
|
name: serverspec
|
91
89
|
sudo_path: true
|
@@ -104,31 +102,29 @@ suites:
|
|
104
102
|
LOGIN_USER: centos
|
105
103
|
SUDO: true
|
106
104
|
SSH_KEY: spec/test.pem
|
107
|
-
|
108
105
|
```
|
109
106
|
|
110
107
|
Please see the [Provisioner Options](https://github.com/neillturner/kitchen-ansible/blob/master/provisioner_options.md) for a complete listing.
|
111
108
|
|
112
|
-
|
113
109
|
## Test-Kitchen Ansiblespec
|
114
110
|
|
115
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.
|
116
112
|
|
117
|
-
Serverspec uses ssh to communicate with the server to be tested and reads the
|
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.
|
118
114
|
|
119
115
|
See example [https://github.com/neillturner/ansible_repo](https://github.com/neillturner/ansible_repo)
|
120
116
|
|
121
|
-
### Example usage to create
|
117
|
+
### Example usage to create Tomcat servers:
|
122
118
|
|
123
|
-
![test-kitchen,
|
119
|
+
![test-kitchen, Ansible and ansiblespec](https://github.com/neillturner/ansible_repo/blob/master/kitchen-ansible.png "test-kitchen, ansible and ansiblespec")
|
124
120
|
|
125
|
-
See [ansible-sample-tdd](https://github.com/volanja/ansible-sample-tdd)
|
121
|
+
See [ansible-sample-tdd](https://github.com/volanja/ansible-sample-tdd).
|
126
122
|
|
127
123
|
### Usage
|
128
124
|
|
129
125
|
#### Directory
|
130
126
|
|
131
|
-
In the
|
127
|
+
In the Ansible repository specify:
|
132
128
|
|
133
129
|
* spec files with the roles.
|
134
130
|
* spec_helper in the spec folder (with code as below).
|
@@ -162,7 +158,7 @@ In the ansible repository specify:
|
|
162
158
|
|
163
159
|
#### spec_helper
|
164
160
|
|
165
|
-
```
|
161
|
+
```ruby
|
166
162
|
require 'rubygems'
|
167
163
|
require 'bundler/setup'
|
168
164
|
|
@@ -182,42 +178,36 @@ RSpec.configure do |config|
|
|
182
178
|
end
|
183
179
|
```
|
184
180
|
|
185
|
-
See [kitchen-verifier-serverspec](https://github.com/neillturner/kitchen-verifier-serverspec)
|
181
|
+
See [kitchen-verifier-serverspec](https://github.com/neillturner/kitchen-verifier-serverspec).
|
186
182
|
|
187
183
|
## Alternative Virtualization/Cloud providers for Vagrant
|
188
184
|
This could be adapted to use alternative virtualization/cloud providers such as Openstack/AWS/VMware Fusion according to whatever is supported by Vagrant.
|
189
185
|
```yaml
|
190
186
|
platforms:
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
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: []
|
204
200
|
```
|
205
201
|
|
206
202
|
## Notes
|
207
203
|
|
208
|
-
* The `default` in all of the above is the name of the test suite defined in the
|
209
|
-
*
|
210
|
-
* Since I'm using Vagrant, my `box` definitions refer to Vagrant boxes, either standard, published boxes available from
|
211
|
-
|
212
|
-
[Serverspec]: http://serverspec.org
|
213
|
-
[packer]: https://packer.io
|
214
|
-
[bento]: https://github.com/chef/bento
|
215
|
-
|
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`.
|
216
207
|
|
217
208
|
## Tips
|
218
209
|
|
219
|
-
You can easily skip previous instructions and jump directly to the broken statement you just fixed by passing
|
220
|
-
an environment variable. Add the following to your `.kitchen.yml`:
|
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`:
|
221
211
|
|
222
212
|
```yaml
|
223
213
|
provisioner:
|
@@ -227,6 +217,8 @@ provisioner:
|
|
227
217
|
|
228
218
|
Then run:
|
229
219
|
|
230
|
-
|
220
|
+
```
|
221
|
+
$ ANSIBLE_EXTRA_FLAGS='--start-at-task="myrole | name of last working instruction"' kitchen converge
|
222
|
+
```
|
231
223
|
|
232
224
|
You save a lot of time not running working instructions.
|
@@ -45,7 +45,8 @@ module Kitchen
|
|
45
45
|
default_config :ansible_sles_repo, 'http://download.opensuse.org/repositories/systemsmanagement/SLE_12/systemsmanagement.repo'
|
46
46
|
default_config :python_sles_repo, 'http://download.opensuse.org/repositories/devel:/languages:/python/SLE_12/devel:languages:python.repo'
|
47
47
|
default_config :chef_bootstrap_url, 'https://www.getchef.com/chef/install.sh'
|
48
|
-
#
|
48
|
+
# Providing we have Ruby >= 2.0 we only need Ruby. Leaving default to install Chef Omnibus for backwards compatibility.
|
49
|
+
# Note: if using kitchen-verifer-serverspec your we can avoid needing Ruby too.
|
49
50
|
# (Reference: https://github.com/neillturner/kitchen-ansible/issues/66 )
|
50
51
|
default_config :require_chef_for_busser, true
|
51
52
|
default_config :require_ruby_for_busser, false
|
@@ -72,6 +72,9 @@ module Kitchen
|
|
72
72
|
elsif config[:require_ansible_source]
|
73
73
|
info('Installing ansible from source')
|
74
74
|
cmd = install_ansible_from_source_command
|
75
|
+
elsif config[:require_pip]
|
76
|
+
info('Installing ansible through pip')
|
77
|
+
cmd = install_ansible_from_pip_command
|
75
78
|
elsif config[:require_ansible_repo]
|
76
79
|
if !@os.nil?
|
77
80
|
info("Installing ansible on #{@os.name}")
|
@@ -99,7 +102,7 @@ module Kitchen
|
|
99
102
|
return
|
100
103
|
end
|
101
104
|
result = cmd + install_windows_support + install_busser_prereqs
|
102
|
-
|
105
|
+
debug("Going to install ansible with: #{result}")
|
103
106
|
result
|
104
107
|
end
|
105
108
|
|
@@ -334,14 +337,13 @@ module Kitchen
|
|
334
337
|
return config[:ansible_playbook_command]
|
335
338
|
else
|
336
339
|
|
337
|
-
|
338
|
-
if config[:require_ansible_source]
|
340
|
+
if config[:require_ansible_source] && !config[:ansible_binary_path]
|
339
341
|
# this is an ugly hack to get around the fact that extra vars uses ' and "
|
340
|
-
cmd = ansible_command("PATH=#{config[:root_path]}/ansible/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games PYTHONPATH=#{config[:root_path]}/ansible/lib MANPATH=#{config[:root_path]}/ansible/docs/man
|
341
|
-
|
342
|
-
|
343
|
-
if config[:ansible_binary_path]
|
342
|
+
cmd = ansible_command("PATH=#{config[:root_path]}/ansible/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games PYTHONPATH=#{config[:root_path]}/ansible/lib MANPATH=#{config[:root_path]}/ansible/docs/man ansible-playbook")
|
343
|
+
elsif config[:ansible_binary_path]
|
344
344
|
cmd = ansible_command("#{config[:ansible_binary_path]}/ansible-playbook")
|
345
|
+
else
|
346
|
+
cmd = ansible_command('ansible-playbook')
|
345
347
|
end
|
346
348
|
|
347
349
|
cmd = "HTTPS_PROXY=#{https_proxy} #{cmd}" if https_proxy
|
@@ -369,7 +371,7 @@ module Kitchen
|
|
369
371
|
ansible_extra_flags,
|
370
372
|
"#{File.join(config[:root_path], File.basename(config[:playbook]))}"
|
371
373
|
].join(' ')
|
372
|
-
|
374
|
+
debug("Going to invoke ansible-playbook with: #{result}")
|
373
375
|
if config[:idempotency_test]
|
374
376
|
result = "#{result} && (echo 'Going to invoke ansible-playbook second time:'; #{result} | tee /tmp/idempotency_test.txt; grep -q 'changed=0.*failed=0' /tmp/idempotency_test.txt && (echo 'Idempotence test: PASS' && exit 0) || (echo 'Idempotence test: FAIL' && exit 1))"
|
375
377
|
debug("Full cmd with idempotency test: #{result}")
|
@@ -423,15 +425,15 @@ module Kitchen
|
|
423
425
|
if [ -f /etc/centos-release ] || [ -f /etc/redhat-release ]; then
|
424
426
|
#{Kitchen::Provisioner::Ansible::Os::Redhat.new('redhat', config).install_epel_repo}
|
425
427
|
#{update_packages_redhat_cmd}
|
426
|
-
#{sudo_env('yum')} -y install libselinux-python python2-devel git python-setuptools python-setuptools-dev
|
428
|
+
#{sudo_env('yum')} -y install libselinux-python python2-devel git python-setuptools python-setuptools-dev libffi-devel libssl-devel
|
427
429
|
else
|
428
430
|
if [ -f /etc/SUSE-brand ] || [ -f /etc/SuSE-release ]; then
|
429
431
|
#{sudo_env('zypper')} ar #{python_sles_repo}
|
430
432
|
#{update_packages_suse_cmd}
|
431
|
-
#{sudo_env('zypper')} --non-interactive install python python-devel git python-setuptools python-pip python-six libyaml-devel
|
433
|
+
#{sudo_env('zypper')} --non-interactive install python python-devel git python-setuptools python-pip python-six libyaml-devel libffi-devel libopenssl-devel
|
432
434
|
else
|
433
435
|
#{update_packages_debian_cmd}
|
434
|
-
#{sudo_env('apt-get')} -y install git python python-setuptools build-essential python-dev
|
436
|
+
#{sudo_env('apt-get')} -y install git python python-setuptools build-essential python-dev libffi-dev libssl-dev
|
435
437
|
fi
|
436
438
|
fi
|
437
439
|
|
@@ -443,6 +445,34 @@ module Kitchen
|
|
443
445
|
INSTALL
|
444
446
|
end
|
445
447
|
|
448
|
+
def install_ansible_from_pip_command
|
449
|
+
ansible_version = ''
|
450
|
+
ansible_version = "==#{config[:ansible_version]}" unless config[:ansible_version] == 'latest'
|
451
|
+
|
452
|
+
<<-INSTALL
|
453
|
+
if [ ! -d #{config[:root_path]}/ansible ]; then
|
454
|
+
if [ -f /etc/centos-release ] || [ -f /etc/redhat-release ]; then
|
455
|
+
#{Kitchen::Provisioner::Ansible::Os::Redhat.new('redhat', config).install_epel_repo}
|
456
|
+
#{update_packages_redhat_cmd}
|
457
|
+
#{sudo_env('yum')} -y install libselinux-python python2-devel git python-setuptools python-setuptools-dev libffi-devel libssl-devel
|
458
|
+
else
|
459
|
+
if [ -f /etc/SUSE-brand ] || [ -f /etc/SuSE-release ]; then
|
460
|
+
#{sudo_env('zypper')} ar #{python_sles_repo}
|
461
|
+
#{update_packages_suse_cmd}
|
462
|
+
#{sudo_env('zypper')} --non-interactive install python python-devel git python-setuptools python-pip python-six libyaml-devel libffi-devel libopenssl-devel
|
463
|
+
else
|
464
|
+
#{update_packages_debian_cmd}
|
465
|
+
#{sudo_env('apt-get')} -y install git python python-setuptools build-essential python-dev libffi-dev libssl-dev
|
466
|
+
fi
|
467
|
+
fi
|
468
|
+
|
469
|
+
#{export_http_proxy}
|
470
|
+
#{sudo_env('easy_install')} pip
|
471
|
+
#{sudo_env('pip')} install ansible#{ansible_version}
|
472
|
+
fi
|
473
|
+
INSTALL
|
474
|
+
end
|
475
|
+
|
446
476
|
def install_omnibus_command
|
447
477
|
info('Installing ansible using ansible omnibus')
|
448
478
|
|
data/provisioner_options.md
CHANGED
@@ -3,130 +3,96 @@
|
|
3
3
|
|
4
4
|
key | default value | Notes
|
5
5
|
----|---------------|--------
|
6
|
-
ansible_version |
|
7
|
-
ansible_sudo | true |
|
8
|
-
sudo_command | sudo -E | sudo command change to
|
9
|
-
ansible_platform |
|
10
|
-
require_ansible_repo | true | Set if
|
11
|
-
ansible_apt_repo |
|
12
|
-
ansible_yum_repo | nil | yum repo
|
13
|
-
ansible_binary_path | NULL | If specified this will override the location where kitchen tries to run ansible-playbook from.
|
14
|
-
enable_yum_epel
|
15
|
-
ansible_sles_repo | http://download.opensuse.org/repositories
|
16
|
-
python_sles_repo | http://download.opensuse.org/repositories
|
17
|
-
require_ansible_omnibus | false | Set if using
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
6
|
+
ansible_version | latest | Desired version, only affects `apt-get` installs
|
7
|
+
ansible_sudo | true | Determines whether `ansible-playbook` is executed as root or as the current authenticated user
|
8
|
+
sudo_command | sudo -E | `sudo` command; change to `sudo -E -H` to be consistent with Ansible
|
9
|
+
ansible_platform | Naively tries to determine | OS platform of server
|
10
|
+
require_ansible_repo | true | Set if installing Ansible from a `yum` or `apt` repo
|
11
|
+
ansible_apt_repo | ppa:ansible/ansible | `apt` repo; see `https://launchpad.net` `/~ansible/+archive/ubuntu/ansible` or `rquillo/ansible`
|
12
|
+
ansible_yum_repo | nil | `yum` repo for EL platforms
|
13
|
+
ansible_binary_path | NULL | If specified this will override the location where `kitchen` tries to run `ansible-playbook` from, i.e. `ansible_binary_path: /usr/local/bin`
|
14
|
+
enable_yum_epel | false | Enable the `yum` EPEL repo
|
15
|
+
ansible_sles_repo | `http://download.opensuse.org/repositories` `/systemsmanagement/SLE_12` `/systemsmanagement.repo` | Zypper SuSE Ansible repo
|
16
|
+
python_sles_repo | `http://download.opensuse.org/repositories` `/devel:/languages:/python/SLE_12` `/devel:languages:python.repo` | Zypper SuSE python repo
|
17
|
+
require_ansible_omnibus | false | Set to `true` if using Omnibus Ansible `pip` install
|
18
|
+
require_pip | false | Set to `true` if Ansible is to be installed through `pip`).
|
19
|
+
ansible_omnibus_url | `https://raw.githubusercontent.com` `/neillturner/omnibus-ansible` `/master/ansible_install.sh` | Omnibus Ansible install location
|
20
|
+
ansible_omnibus_remote_path | /opt/ansible | Server installation location of an Omnibus Ansible install
|
21
|
+
http_proxy | nil | Use HTTP proxy when installing Ansible, packages and running Ansible
|
22
|
+
https_proxy | nil | Use HTTPS proxy when installing Ansible, packages and running Ansible
|
23
|
+
no_proxy | nil | List of URLs or IPs that should be excluded from proxying
|
24
|
+
roles_path | roles | Ansible repo roles directory
|
25
|
+
group_vars_path | group_vars | Ansible repo group_vars directory
|
26
|
+
host_vars_path | host_vars | Ansible repo hosts directory
|
27
|
+
library_plugins_path | library | Ansible repo library plugins directory
|
28
|
+
callback_plugins_path | callback_plugins | Ansible repo `callback_plugins` directory
|
29
|
+
filter_plugins_path | filter_plugins | Ansible repo `filter_plugins` directory
|
30
|
+
lookup_plugins_path | lookup_plugins | Ansible repo `lookup_plugins` directory
|
31
|
+
additional_copy_path | | Arbitrary array of files and directories to copy into test environment, relative to the current dir, e.g. vars or included playbooks
|
32
|
+
extra_vars | Hash.new | Hash to set the `extra_vars` passed to `ansible-playbook` command
|
33
|
+
playbook | default.yml | Playbook for `ansible-playbook` to run
|
34
|
+
modules_path | | Ansible repo manifests directory
|
35
|
+
ansible_verbose | false | Extra information logging
|
36
|
+
ansible_verbosity | 1 | Sets the verbosity flag appropriately, e.g.: `1 => '-v', 2 => '-vv', 3 => '-vvv' ...`. Valid values are: `1, 2, 3, 4` or `:info, :warn, :debug, :trace`
|
37
|
+
ansible_check | false | Sets the `--check` flag when running Ansible
|
38
|
+
ansible_diff | false | Sets the `--diff` flag when running Ansible
|
39
|
+
update_package_repos | true | Update OS repository metadata
|
39
40
|
ansiblefile_path | | Path to Ansiblefile
|
40
|
-
requirements_path | | Path to
|
41
|
-
ansible_vault_password_file| | Path
|
42
|
-
ansible_connection | local | use
|
43
|
-
hosts | |
|
44
|
-
ansible_inventory | | Static or dynamic inventory file or directory or
|
45
|
-
ansible_limit | | Further limits the selected host/group patterns
|
46
|
-
ansible_extra_flags | | Additional options to pass to
|
47
|
-
ansible_playbook_command | | Override the
|
48
|
-
require_ruby_for_busser|false|
|
49
|
-
require_chef_for_busser|true|
|
50
|
-
chef_bootstrap_url |https://www.getchef.com
|
51
|
-
require_ansible_source | false | Install Ansible from source using method described here
|
52
|
-
ansible_source_rev | | Branch or
|
53
|
-
ansible_host_key_checking | true |
|
41
|
+
requirements_path | | Path to Ansible Galaxy requirements
|
42
|
+
ansible_vault_password_file | | Path to Ansible Vault password file
|
43
|
+
ansible_connection | local | use `ssh` if the host is not `localhost` (Linux) or `winrm` (Windows) or `none` if defined in inventory
|
44
|
+
hosts | | Create Ansible hosts file for localhost with this server group
|
45
|
+
ansible_inventory | | Static or dynamic inventory file or directory or none if defined in `ansible.cfg`
|
46
|
+
ansible_limit | | Further limits the selected host/group patterns
|
47
|
+
ansible_extra_flags | | Additional options to pass to ansible-playbook, e.g. `'--skip-tags=redis'`
|
48
|
+
ansible_playbook_command | | Override the Ansible playbook command
|
49
|
+
require_ruby_for_busser | false | Install Ruby to run Busser for tests
|
50
|
+
require_chef_for_busser | true | Install Chef to run Busser for tests. NOTE: kitchen 1.4 only requires Ruby to run Busser so this is not required.
|
51
|
+
chef_bootstrap_url | `https://www.getchef.com/chef/install.sh` | The Chef install
|
52
|
+
require_ansible_source | false | Install Ansible from source using method described [here](http://docs.ansible.com/intro_installation.html#running-from-source). Only works on Debian/Ubuntu at present
|
53
|
+
ansible_source_rev | | Branch or tag to install Ansible source
|
54
|
+
ansible_host_key_checking | true | Strict host key checking in ssh
|
54
55
|
private_key | | ssh private key file for ssh connection
|
55
|
-
idempotency_test | false | Enable to test
|
56
|
-
ssh_known_hosts | | List of hosts that should be added to
|
57
|
-
kerberos_conf_file| | Path of krb5.conf file using in
|
58
|
-
require_windows_support | false |
|
56
|
+
idempotency_test | false | Enable to test Ansible playbook idempotency
|
57
|
+
ssh_known_hosts | | List of hosts that should be added to ~/.ssh/known_hosts
|
58
|
+
kerberos_conf_file | | Path of krb5.conf file using in Windows support
|
59
|
+
require_windows_support | false | Install [Windows support](http://docs.ansible.com/ansible/intro_windows.html)
|
59
60
|
|
60
61
|
## Configuring Provisioner Options
|
61
62
|
|
62
63
|
The provisioner can be configured globally or per suite, global settings act as defaults for all suites, you can then customise per suite, for example:
|
63
64
|
|
64
65
|
```yaml
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
```
|
88
|
-
|
89
|
-
## Ruby install to run serverspec verify
|
90
|
-
|
91
|
-
By default test-kitchen installs chef to get a ruby version sutable for run serverspec in the Verify step.
|
92
|
-
|
93
|
-
Instead ruby can just be installed by specifing the provisioner option:
|
94
|
-
```
|
95
|
-
require_ruby_for_busser false
|
96
|
-
```
|
97
|
-
And set the verifer section:
|
98
|
-
```
|
99
|
-
verifier:
|
100
|
-
name: Busser
|
101
|
-
plugin:
|
102
|
-
- Ansiblespec
|
103
|
-
ruby_bindir: '/usr/bin'
|
104
|
-
```
|
105
|
-
and create a Gemfile to add additionl ruby gems in directory test/integration/default/ansiblespec
|
106
|
-
```
|
107
|
-
source 'https://rubygems.org'
|
108
|
-
|
109
|
-
gem 'rake'
|
110
|
-
```
|
111
|
-
|
112
|
-
in this example, vagrant will download a box for ubuntu 1204 with no configuration management installed, then install the latest ansible and ansible playbook against a ansible repo from the /repository/ansible_repo directory using the default manifest site.yml
|
113
|
-
|
114
|
-
To override a setting at the suite-level, specify the setting name under the suite's attributes:
|
115
|
-
|
116
|
-
```yaml
|
117
|
-
suites:
|
118
|
-
- name: server
|
119
|
-
attributes:
|
120
|
-
extra_vars:
|
121
|
-
server_installer_url: http://downloads.app.com/v1.0
|
122
|
-
tags:
|
123
|
-
- server
|
66
|
+
---
|
67
|
+
driver:
|
68
|
+
name: vagrant
|
69
|
+
|
70
|
+
provisioner:
|
71
|
+
name: ansible_playbook
|
72
|
+
roles_path: roles
|
73
|
+
hosts: tomcat-servers
|
74
|
+
require_ansible_repo: true
|
75
|
+
ansible_verbose: true
|
76
|
+
ansible_verbosity: 2
|
77
|
+
ansible_diff: true
|
78
|
+
|
79
|
+
platforms:
|
80
|
+
- name: nocm_ubuntu-12.04
|
81
|
+
driver_plugin: vagrant
|
82
|
+
driver_config:
|
83
|
+
box: nocm_ubuntu-12.04
|
84
|
+
box_url: http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-server-12042-x64-vbox4210-nocm.box
|
85
|
+
|
86
|
+
suites:
|
87
|
+
- name: default
|
124
88
|
```
|
125
89
|
|
126
90
|
### Per-suite Structure
|
127
91
|
|
128
92
|
It can be beneficial to keep different Ansible layouts for different suites. Rather than having to specify the roles, modules, etc for each suite, you can create the following directory structure and they will automatically be found:
|
129
93
|
|
130
|
-
|
131
|
-
|
132
|
-
|
94
|
+
```
|
95
|
+
$kitchen_root/ansible/$suite_name/roles
|
96
|
+
$kitchen_root/ansible/$suite_name/modules
|
97
|
+
$kitchen_root/ansible/$suite_name/Ansiblefile
|
98
|
+
```
|
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.
|
4
|
+
version: 0.43.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-
|
11
|
+
date: 2016-06-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: test-kitchen
|