kitchen-ansible 0.0.17 → 0.0.19

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7e743c9802fe1bd941d329f712d7e7f8ddbb9d6c
4
- data.tar.gz: a8191edb41ddd5114262b301f397c149cff74a21
3
+ metadata.gz: a3518b7a91eb4d4bcdbf4d17e130a2996749c0db
4
+ data.tar.gz: 28b8664e3f61106ffd755cd0daf103e2d5ee6454
5
5
  SHA512:
6
- metadata.gz: 4987150939c35f900f03d315fba877e5cfa930bb4c2a2f5e57e4887d3e00a74bed4876bbc5a881cc951c3b119b38075e543aaa2108350a28b58bc2b0f31acf21
7
- data.tar.gz: a28d0b4f9c54f216113eb1a3af8948a1b5aa6af13533a04db01854377151272e659858b4bef72403cac98d9939fb25ca36210de861fe80606e72ccbc7ecfc66f
6
+ metadata.gz: 49e12a7fe4c7380ff40c8b4fe693e081d9bd2663a25f07c2ce79adfd0e56875c78adf12e7ace774fae0eaa9070278c3bcba80f8ebfa71e9538fa3179e4c5c630
7
+ data.tar.gz: a29a978db1784b9d3f98de4e7d86a99b823736a809fc591c021f7fb7dda238487a45151f513ccc3b93ac9b64ee5c641b55bf6200012eecbbeefc4a2bb9c92c9b
data/README.md CHANGED
@@ -1,172 +1,195 @@
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 provider works by passing the ansible repository based on attributes in .kitchen.yml & calling ansible-playbook.
10
-
11
- It install ansible on the server and runs ansible-playbook using host localhost.
12
-
13
- Has been tested against the Ubuntu 1204 and Centos 6.5 boxes running in vagrant/virtualbox.
14
-
15
- ## Requirements
16
- You'll need a driver box without a chef installation so ansible can be installed.
17
-
18
- ## Installation & Setup
19
- You'll need the test-kitchen & kitchen-ansible gem's installed in your system, along with kitchen-vagrant or some other suitable driver for test-kitchen.
20
-
21
- Please see the Provisioner Options (https://github.com/neillturner/kitchen-ansible/blob/master/provisioner_options.md).
22
-
23
- ## Example kitchen.yml file
24
-
25
- based on the example ansible setup for tomcat at https://github.com/ansible/ansible-examples/tree/master/tomcat-standalone
26
-
27
- ```yaml
28
- ---
29
- driver:
30
- name: vagrant
31
-
32
- provisioner:
33
- name: ansible_playbook
34
- roles_path: roles
35
- hosts: tomcat-servers
36
- require_ansible_repo: true
37
- ansible_verbose: true
38
- ansible_version: 1.6.2-1.el6
39
- extra_vars:
40
- a: b
41
-
42
- platforms:
43
- - name: nocm_centos-6.5
44
- driver_plugin: vagrant
45
- driver_config:
46
- box: nocm_centos-6.5
47
- box_url: http://puppet-vagrant-boxes.puppetlabs.com/centos-65-x64-virtualbox-nocm.box
48
- network:
49
- - ['forwarded_port', {guest: 8080, host: 8080}]
50
- - [ 'private_network', { ip: '192.168.33.11' } ]
51
- ```
52
-
53
- ## Test-Kitchen/Ansible/Serverspec
54
-
55
- In the root directory for your Ansible role:
56
-
57
- Create a `.kitchen.yml`, much like one the described above:
58
-
59
- ```yaml
60
- ---
61
- driver:
62
- name: vagrant
63
-
64
- provisioner:
65
- name: ansible_playbook
66
- playbook: default.yml
67
- ansible_yum_repo: "https://download.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm"
68
- ansible_verbose: true
69
- ansible_verbosity: 3
70
- hosts: all
71
-
72
- platforms:
73
- - name: ubuntu-12.04
74
- driver_config:
75
- box: ubuntu/precise32
76
- - name: centos-7
77
- driver_config:
78
- box: chef/centos-7.0
79
-
80
- suites:
81
- - name: default
82
- ```
83
-
84
- **NOTE:** With Test-Kitchen 1.4 you not longer need chef install to run the tests. You just need ruby installed version 1.9 or higher and also add to the .kitchen.yml file
85
-
86
- ```yaml
87
- verifier:
88
- ruby_bindir: '/usr/bin'
89
- ```
90
- where /usr/bin is the location of the ruby command.
91
-
92
-
93
- Then for serverspec:
94
-
95
- ```bash
96
- mkdir -p test/integration/default/serverspec/localhost
97
- echo "require 'serverspec'" >> test/integration/default/serverspec/spec_helper.rb
98
- echo "set :backend, :exec" >> test/integration/default/serverspec/spec_helper.rb
99
- ```
100
-
101
- Create a basic playbook `test/integration/default.yml` so that kitchen can use your role (this should include any dependencies for your role):
102
-
103
- ```yaml
104
- ---
105
- - name: wrapper playbook for kitchen testing "my_role"
106
- hosts: localhost
107
- roles:
108
- - my_role
109
- ```
110
-
111
- Create your serverspec tests in `test/integration/default/serverspec/localhost/my_roles_spec.rb`:
112
-
113
- ```ruby
114
- require 'spec_helper'
115
-
116
- if os[:family] == 'ubuntu'
117
- describe '/etc/lsb-release' do
118
- it "exists" do
119
- expect(file('/etc/lsb-release').to be_file
120
- end
121
- end
122
- end
123
-
124
- if os[:family] == 'redhat'
125
- describe '/etc/redhat-release' do
126
- it "exists" do
127
- expect(file('/etc/redhat-release')).to be_file
128
- end
129
- end
130
- end
131
- ```
132
-
133
- ### Testing multiple playbooks
134
- To test different playbooks in different suites you can easily overwrite the provisioner settings in each suite seperately.
135
- ```yaml
136
- ---
137
- driver:
138
- name: vagrant
139
-
140
- provisioner:
141
- name: ansible_playbook
142
-
143
- platforms:
144
- - name: ubuntu-12.04
145
- driver_config:
146
- box: ubuntu/precise32
147
- - name: centos-7
148
- driver_config:
149
- box: chef/centos-7.0
150
-
151
- suites:
152
- - name: database
153
- provisioner:
154
- playbook: postgres.yml
155
- hosts: database
156
- - name: application
157
- provisioner:
158
- playbook: web_app.yml
159
- hosts: web_application
160
- ```
161
-
162
- *Notes*
163
-
164
- * 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 suite of tests or change the name, you'll need to adapt my example accordingly.
165
- * serverspec test files *must* be named `_spec.rb`
166
- * Since I'm using Vagrant, my `box` definitions refer to Vagrant boxes, either standard, published boxes available from <http://atlas.hashicorp.com/boxes> or custom-created boxes (perhaps using [Packer][packer] and [bento][bento]), in which case you'll need to provide the url in `box_url`.
167
- * This could be adapted to using Openstack/AWS/whatever VMs as supported by Vagrant.
168
-
169
- [Serverspec]: http://serverspec.org
170
- [packer]: https://packer.io
171
- [bento]: https://github.com/chef/bento
172
-
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
+ Has been tested against the Ubuntu 1204 and Centos 6.5 boxes running in vagrant/virtualbox.
14
+
15
+ ## Requirements
16
+ You'll need a driver box without a chef installation so ansible can be installed.
17
+
18
+ ## Installation & Setup
19
+ You'll need the test-kitchen & kitchen-ansible gem's installed in your system, along with kitchen-vagrant or some other suitable driver for test-kitchen.
20
+
21
+ Please see the Provisioner Options (https://github.com/neillturner/kitchen-ansible/blob/master/provisioner_options.md).
22
+
23
+ ## Example kitchen.yml file
24
+
25
+ based on the example ansible setup for tomcat at https://github.com/ansible/ansible-examples/tree/master/tomcat-standalone
26
+
27
+ ```yaml
28
+ ---
29
+ driver:
30
+ name: vagrant
31
+
32
+ provisioner:
33
+ name: ansible_playbook
34
+ roles_path: roles
35
+ hosts: tomcat-servers
36
+ require_ansible_repo: true
37
+ ansible_verbose: true
38
+ ansible_version: 1.6.2-1.el6
39
+ extra_vars:
40
+ a: b
41
+
42
+ platforms:
43
+ - name: nocm_centos-6.5
44
+ driver_plugin: vagrant
45
+ driver_config:
46
+ box: nocm_centos-6.5
47
+ box_url: http://puppet-vagrant-boxes.puppetlabs.com/centos-65-x64-virtualbox-nocm.box
48
+ network:
49
+ - ['forwarded_port', {guest: 8080, host: 8080}]
50
+ - [ 'private_network', { ip: '192.168.33.11' } ]
51
+
52
+ verifier:
53
+ ruby_bindir: '/usr/bin'
54
+ ```
55
+ **NOTE:** With Test-Kitchen 1.4 you no longer need chef install to run the tests. You just need ruby installed version 1.9 or higher and also add to the .kitchen.yml file
56
+
57
+ ```yaml
58
+ verifier:
59
+ ruby_bindir: '/usr/bin'
60
+ ```
61
+ where /usr/bin is the location of the ruby command.
62
+
63
+
64
+ ## Test-Kitchen/Ansible/Serverspec
65
+
66
+ In the root directory for your Ansible role:
67
+
68
+ Create a `.kitchen.yml`, much like one the described above:
69
+
70
+ ```yaml
71
+ ---
72
+ driver:
73
+ name: vagrant
74
+
75
+ provisioner:
76
+ name: ansible_playbook
77
+ playbook: default.yml
78
+ ansible_yum_repo: "https://download.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm"
79
+ ansible_verbose: true
80
+ ansible_verbosity: 3
81
+ hosts: all
82
+
83
+ platforms:
84
+ - name: ubuntu-12.04
85
+ driver_config:
86
+ box: ubuntu/precise32
87
+ - name: centos-7
88
+ driver_config:
89
+ box: chef/centos-7.0
90
+
91
+ verifier:
92
+ ruby_bindir: '/usr/bin'
93
+
94
+ suites:
95
+ - name: default
96
+ ```
97
+
98
+ Then for serverspec:
99
+
100
+ ```bash
101
+ mkdir -p test/integration/default/serverspec/localhost
102
+ echo "require 'serverspec'" >> test/integration/default/serverspec/spec_helper.rb
103
+ echo "set :backend, :exec" >> test/integration/default/serverspec/spec_helper.rb
104
+ ```
105
+
106
+ Create a basic playbook `test/integration/default.yml` so that kitchen can use your role (this should include any dependencies for your role):
107
+
108
+ ```yaml
109
+ ---
110
+ - name: wrapper playbook for kitchen testing "my_role"
111
+ hosts: localhost
112
+ roles:
113
+ - my_role
114
+ ```
115
+
116
+ Create your serverspec tests in `test/integration/default/serverspec/localhost/my_roles_spec.rb`:
117
+
118
+ ```ruby
119
+ require 'spec_helper'
120
+
121
+ if os[:family] == 'ubuntu'
122
+ describe '/etc/lsb-release' do
123
+ it "exists" do
124
+ expect(file('/etc/lsb-release')).to be_file
125
+ end
126
+ end
127
+ end
128
+
129
+ if os[:family] == 'redhat'
130
+ describe '/etc/redhat-release' do
131
+ it "exists" do
132
+ expect(file('/etc/redhat-release')).to be_file
133
+ end
134
+ end
135
+ end
136
+ ```
137
+
138
+ ### Testing multiple playbooks
139
+ To test different playbooks in different suites you can easily overwrite the provisioner settings in each suite seperately.
140
+ ```yaml
141
+ ---
142
+ driver:
143
+ name: vagrant
144
+
145
+ provisioner:
146
+ name: ansible_playbook
147
+
148
+ platforms:
149
+ - name: ubuntu-12.04
150
+ driver_config:
151
+ box: ubuntu/precise32
152
+ - name: centos-7
153
+ driver_config:
154
+ box: chef/centos-7.0
155
+
156
+ suites:
157
+ - name: database
158
+ provisioner:
159
+ playbook: postgres.yml
160
+ hosts: database
161
+ - name: application
162
+ provisioner:
163
+ playbook: web_app.yml
164
+ hosts: web_application
165
+ ```
166
+
167
+ ### Alternative Virtualization/Cloud providers for Vagrant
168
+ This could be adapted to use alternative virtualization/cloud providers such as Openstack/AWS/VMware Fusion according to whatever is supported by Vagrant.
169
+ ```yaml
170
+ platforms:
171
+ - name: ubuntu-12.04
172
+ driver_config:
173
+ provider: aws
174
+ box: my_base_box
175
+ # username is based on what is configured in your box/ami
176
+ username: ubuntu
177
+ customize:
178
+ access_key_id: "AKKJHG659868LHGLH"
179
+ secret_access_key: "G8t7o+6HLG876JGF/58"
180
+ ami: ami-7865ab765d
181
+ instance_type: t2.micro
182
+ # more customisation can go here, based on what the vagrant provider supports
183
+ #security-groups: []
184
+ ```
185
+
186
+ *Notes*
187
+
188
+ * 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 suite of tests or change the name, you'll need to adapt my example accordingly.
189
+ * serverspec test files *must* be named `_spec.rb`
190
+ * Since I'm using Vagrant, my `box` definitions refer to Vagrant boxes, either standard, published boxes available from <http://atlas.hashicorp.com/boxes> or custom-created boxes (perhaps using [Packer][packer] and [bento][bento]), in which case you'll need to provide the url in `box_url`.
191
+
192
+ [Serverspec]: http://serverspec.org
193
+ [packer]: https://packer.io
194
+ [bento]: https://github.com/chef/bento
195
+
@@ -1,35 +1,35 @@
1
- # encoding: utf-8
2
-
3
- $:.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'
30
-
31
- s.add_development_dependency 'rspec'
32
- s.add_development_dependency 'pry'
33
- s.add_development_dependency 'rake'
34
- s.add_runtime_dependency 'librarian-ansible'
35
- end
1
+ # encoding: utf-8
2
+
3
+ $:.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'
30
+
31
+ s.add_development_dependency 'rspec'
32
+ s.add_development_dependency 'pry'
33
+ s.add_development_dependency 'rake'
34
+ s.add_runtime_dependency 'librarian-ansible'
35
+ end
@@ -1,5 +1,5 @@
1
- module Kitchen
2
- module Ansible
3
- VERSION = "0.0.17"
4
- end
5
- end
1
+ module Kitchen
2
+ module Ansible
3
+ VERSION = "0.0.19"
4
+ end
5
+ end