kitchen-ansible 0.0.21 → 0.0.22

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
2
  SHA1:
3
- metadata.gz: 860adafe385371ac59d2ce7a1cde980eac0d7f28
4
- data.tar.gz: 3c2a1ea825b1ba28afeecec39a4c9d928311b666
3
+ metadata.gz: 74e679fe4df9c78f74ed295604bbe568ca442886
4
+ data.tar.gz: 5da1d01055c7f7656eedb5b07ca2ab0ff75a67e7
5
5
  SHA512:
6
- metadata.gz: 0b15ccdadd550c8fa47f8422811e983ba03fed010ec0866eed7ca2dfd3bc353f09817b329609fd76c1fd95683cdd56e093118a5e437b1d7bb6f221d9cf2904af
7
- data.tar.gz: c38efabe0b993bab859dd19ed9da0370f80ab0564add83017a5de10990f5deaa4db630dbc97091b3c302237f79f8288f5abdf9a83b2296745b278dbb5261033f
6
+ metadata.gz: 46c98276669a89b8e9520bc233fac1dbf1b1bc763b1f94c5dc1014ee11d6d122eefe8f2353b7031a511b656e5222e4cfa6c7f922186b3e102a73144c2379ac4f
7
+ data.tar.gz: 19b621bc52217111af748ea94295cd2c04e5afd11502cc950a12798c95e72fc64a73298822b7271f44492d11c10553fe857d6473985d9471afee01d255af7c98
data/README.md CHANGED
@@ -1,195 +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 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
+ # 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