kitchen-ansible 0.0.10 → 0.0.11

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -18,7 +18,8 @@ Please see the Provisioner Options (https://github.com/neillturner/kitchen-ansib
18
18
  ## Example kitchen.yml file
19
19
 
20
20
  based on the example ansible setup for tomcat at https://github.com/ansible/ansible-examples/tree/master/tomcat-standalone
21
- ```
21
+
22
+ ```yaml
22
23
  ---
23
24
  driver:
24
25
  name: vagrant
@@ -49,63 +50,100 @@ platforms:
49
50
  In the root directory for your Ansible role:
50
51
 
51
52
  Create a `.kitchen.yml`, much like one the described above:
53
+
54
+ ```yaml
55
+ ---
56
+ driver:
57
+ name: vagrant
52
58
 
53
- ---
54
- driver:
55
- name: vagrant
56
-
57
- provisioner:
58
- name: ansible_playbook
59
- playbook: default.yml
60
- ansible_yum_repo: "https://download.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm"
61
- ansible_verbose: true
62
- ansible_verbosity: 3
63
- hosts: all
64
-
65
- platforms:
66
- - name: ubuntu-12.04
67
- driver_config:
68
- box: ubuntu/precise32
69
- - name: centos-7
70
- driver_config:
71
- box: chef/centos-7.0
72
-
73
- suites:
74
- - name: default
59
+ provisioner:
60
+ name: ansible_playbook
61
+ playbook: default.yml
62
+ ansible_yum_repo: "https://download.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm"
63
+ ansible_verbose: true
64
+ ansible_verbosity: 3
65
+ hosts: all
66
+
67
+ platforms:
68
+ - name: ubuntu-12.04
69
+ driver_config:
70
+ box: ubuntu/precise32
71
+ - name: centos-7
72
+ driver_config:
73
+ box: chef/centos-7.0
74
+
75
+ suites:
76
+ - name: default
77
+ ```
75
78
 
76
79
  Then for serverspec:
77
-
78
- mkdir -p test/integration/default/serverspec/localhost
79
- echo "require 'serverspec'" >> test/integration/default/serverspec/spec_helper.rb
80
- echo "set :backend, :exec" >> test/integration/default/serverspec/spec_helper.rb
80
+
81
+ ```bash
82
+ mkdir -p test/integration/default/serverspec/localhost
83
+ echo "require 'serverspec'" >> test/integration/default/serverspec/spec_helper.rb
84
+ echo "set :backend, :exec" >> test/integration/default/serverspec/spec_helper.rb
85
+ ```
81
86
 
82
87
  Create a basic playbook `test/integration/default.yml` so that kitchen can use your role (this should include any dependencies for your role):
83
-
84
- ---
85
- - name: wrapper playbook for kitchen testing "my_role"
86
- hosts: localhost
87
- roles:
88
- - my_role
88
+
89
+ ```yaml
90
+ ---
91
+ - name: wrapper playbook for kitchen testing "my_role"
92
+ hosts: localhost
93
+ roles:
94
+ - my_role
95
+ ```
89
96
 
90
97
  Create your serverspec tests in `test/integration/default/serverspec/localhost/my_roles_spec.rb`:
98
+
99
+ ```ruby
100
+ require 'spec_helper'
91
101
 
92
- require 'spec_helper'
93
-
94
- if os[:family] == 'ubuntu'
95
- describe '/etc/lsb-release' do
96
- it "exists" do
97
- expect(file('/etc/lsb-release').to be_file
98
- end
99
- end
100
- end
101
-
102
- if os[:family] == 'redhat'
103
- describe '/etc/redhat-release' do
102
+ if os[:family] == 'ubuntu'
103
+ describe '/etc/lsb-release' do
104
104
  it "exists" do
105
- expect(file('/etc/redhat-release')).to be_file
105
+ expect(file('/etc/lsb-release').to be_file
106
106
  end
107
107
  end
108
+ end
109
+
110
+ if os[:family] == 'redhat'
111
+ describe '/etc/redhat-release' do
112
+ it "exists" do
113
+ expect(file('/etc/redhat-release')).to be_file
108
114
  end
115
+ end
116
+ end
117
+ ```
118
+
119
+ ### Testing multiple playbooks
120
+ To test different playbooks in different suites you can easily overwrite the provisioner settings in each suite seperately.
121
+ ```yaml
122
+ ---
123
+ driver:
124
+ name: vagrant
125
+
126
+ provisioner:
127
+ name: ansible_playbook
128
+
129
+ platforms:
130
+ - name: ubuntu-12.04
131
+ driver_config:
132
+ box: ubuntu/precise32
133
+ - name: centos-7
134
+ driver_config:
135
+ box: chef/centos-7.0
136
+
137
+ suites:
138
+ - name: database
139
+ provisioner:
140
+ playbook: postgres.yml
141
+ hosts: database
142
+ - name: application
143
+ provisioner:
144
+ playbook: web_app.yml
145
+ hosts: web_application
146
+ ```
109
147
 
110
148
  *Notes*
111
149
 
@@ -1,5 +1,5 @@
1
1
  module Kitchen
2
2
  module Ansible
3
- VERSION = "0.0.10"
3
+ VERSION = "0.0.11"
4
4
  end
5
5
  end
@@ -303,7 +303,8 @@ module Kitchen
303
303
 
304
304
  if galaxy_requirements
305
305
  commands << [
306
- sudo('ansible-galaxy'), 'install', '--force',
306
+ 'ansible-galaxy', 'install', '--force',
307
+ '-p', File.join(config[:root_path], 'roles'),
307
308
  '-r', File.join(config[:root_path], galaxy_requirements),
308
309
  ].join(' ')
309
310
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kitchen-ansible
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.11
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-02-12 00:00:00.000000000 Z
12
+ date: 2015-04-13 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: ! '== DESCRIPTION:
15
15