kitchen-ansible 0.0.23 → 0.0.24

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: 7bd5d03676603db05fb892388318d229f975c887
4
- data.tar.gz: 467e3c95ed635db2fbf3c335a07ab4c9c448e2bb
3
+ metadata.gz: b22d9ccb55f5b7a341b8166c386f31b5bdc81fe2
4
+ data.tar.gz: 3da3534b7db8ebdf6dd51686ff1d46dd3c7154b3
5
5
  SHA512:
6
- metadata.gz: c5df42d3b62176caebc820e2fb27ec5a1f4851d6c5905409b72d09a5d779fda9bbc8c3e2236f1d99a4a5f03980969b51d0dcdb7fdc621a0837cb1cf86273fe83
7
- data.tar.gz: eb0c56c645a1f84d583c65c47db0f4bd66bc1458bfc2a52b2c9de402e0d294a07eec8707f647ec67ebba3dcdd6fc5f275d54750686ca491aabeb11fad1f163e0
6
+ metadata.gz: 7868d6b52bff14fd8970b71a7e66f3fd68c486f6cbaa40236c41c942cb6d76b8cacfc83d2d5709b27458afa8b732af5e18bb6247a2058a814c038021ccc0c304
7
+ data.tar.gz: db29b77c120e14b557a0368e9ccc5870e9a7795bdf8e45b9fb4d937e21b44a3d2261be4f8b96ea2ca83cc46ddfdb7bd18b27916f35af30edba1be58e90062d9e
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