kitchen-ansible 0.0.24 → 0.0.25

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: b22d9ccb55f5b7a341b8166c386f31b5bdc81fe2
4
- data.tar.gz: 3da3534b7db8ebdf6dd51686ff1d46dd3c7154b3
3
+ metadata.gz: af76ad1d53e2725db485d77039beccdf264108e5
4
+ data.tar.gz: 356995b840f894a20d0df368de43e21efce72145
5
5
  SHA512:
6
- metadata.gz: 7868d6b52bff14fd8970b71a7e66f3fd68c486f6cbaa40236c41c942cb6d76b8cacfc83d2d5709b27458afa8b732af5e18bb6247a2058a814c038021ccc0c304
7
- data.tar.gz: db29b77c120e14b557a0368e9ccc5870e9a7795bdf8e45b9fb4d937e21b44a3d2261be4f8b96ea2ca83cc46ddfdb7bd18b27916f35af30edba1be58e90062d9e
6
+ metadata.gz: cc0da3987c93366e79074e77c9ec1a9867208504c896b43c4399cb6cf00094390c448dfa3bbef52b748f09156041aae73f4abd3f59dd6d8ae265fb1eb86de647
7
+ data.tar.gz: 8c71159c8ad439d92e40b5a61e1dd5cddefc581e2c21d14bf7bb651dc007395ee4a016ee7a652822afad1f7f193b0c97688111a34c0e847b4f69ddebabc282d4
data/README.md CHANGED
@@ -193,3 +193,30 @@ platforms:
193
193
  [packer]: https://packer.io
194
194
  [bento]: https://github.com/chef/bento
195
195
 
196
+ ## Custom ServerSpec or AnsibleSpec Invocation
197
+
198
+ Instead of using the busser use a custom serverspec invocation using [shell verifier](https://github.com/higanworks/kitchen-verifier-shell) to call it.
199
+ With such setup there is no dependency on busser and any other chef library.
200
+
201
+ Also you can specify you tests in a different directory structure or even call [ansible spec](https://github.com/volanja/ansible_spec) instead of server spec and have tests in ansible_spec structure
202
+
203
+ Using a structure like
204
+ ```yaml
205
+ verifier:
206
+ name: shell
207
+ remote_exec: true
208
+ command: |
209
+ sudo -s <<SERVERSPEC
210
+ cd /opt/gdc/serverspec-core
211
+ export SERVERSPEC_ENV=$EC2DATA_ENVIRONMENT
212
+ export SERVERSPEC_BACKEND=exec
213
+ serverspec junit=true tag=~skip_in_kitchen check:role:$EC2DATA_TYPE
214
+ SERVERSPEC
215
+ ```
216
+
217
+ where `serverspec` is a wrapper around `rake` invocation.
218
+ Use a `Rakefile` similar to one in https://github.com/vincentbernat/serverspec-example.
219
+
220
+ With such approach we can achieve flexibility of running same test suite both in test kitchen and actual, even production, instances.
221
+
222
+ Beware: kitchen-shell-verifier is not yet merged into test-kitchen upstream so using separate gem is unavoidable so far
@@ -39,6 +39,7 @@ module Kitchen
39
39
  default_config :ansible_omnibus_remote_path, '/opt/ansible'
40
40
  default_config :ansible_version, nil
41
41
  default_config :require_ansible_repo, true
42
+ default_config :enable_yum_epel, false
42
43
  default_config :extra_vars, {}
43
44
  default_config :tags, []
44
45
  default_config :ansible_apt_repo, "ppa:ansible/ansible"
@@ -59,6 +60,8 @@ module Kitchen
59
60
  default_config :ansible_connection, 'local'
60
61
  default_config :update_package_repos, true
61
62
  default_config :require_ansible_source, false
63
+ default_config :http_proxy, nil
64
+ default_config :https_proxy, nil
62
65
 
63
66
  default_config :playbook do |provisioner|
64
67
  provisioner.calculate_path('default.yml', :file) or
@@ -116,8 +116,8 @@ module Kitchen
116
116
  # Fix for https://github.com/test-kitchen/busser/issues/12
117
117
  if [ -h /usr/bin/ruby ]; then
118
118
  L=$(readlink -f /usr/bin/ruby)
119
- #{sudo('rm')} /usr/bin/ruby
120
- #{sudo('ln')} -s $L /usr/bin/ruby
119
+ #{sudo_env('rm')} /usr/bin/ruby
120
+ #{sudo_env('ln')} -s $L /usr/bin/ruby
121
121
  fi
122
122
  INSTALL
123
123
 
@@ -130,30 +130,30 @@ module Kitchen
130
130
  if [ -n "$rhelversion" ]; then
131
131
  if [ ! -d "/opt/rh/ruby193" ]; then
132
132
  echo "-----> Installing ruby SCL in CentOS6/RHEL6 to install busser to run tests"
133
- #{sudo('yum')} install -y centos-release-SCL
134
- #{sudo('yum')} install -y ruby193
135
- #{sudo('yum')} install -y ruby193-ruby-devel
133
+ #{sudo_env('yum')} install -y centos-release-SCL
134
+ #{sudo_env('yum')} install -y ruby193
135
+ #{sudo_env('yum')} install -y ruby193-ruby-devel
136
136
  echo "-----> Enabling ruby193"
137
137
  source /opt/rh/ruby193/enable
138
138
  echo "/opt/rh/ruby193/root/usr/lib64" | sudo tee -a /etc/ld.so.conf
139
- #{sudo('ldconfig')}
140
- #{sudo('ln')} -s /opt/rh/ruby193/root/usr/bin/ruby /usr/bin/ruby
141
- #{sudo('ln')} -s /opt/rh/ruby193/root/usr/bin/gem /usr/bin/gem
139
+ #{sudo_env('ldconfig')}
140
+ #{sudo_env('ln')} -s /opt/rh/ruby193/root/usr/bin/ruby /usr/bin/ruby
141
+ #{sudo_env('ln')} -s /opt/rh/ruby193/root/usr/bin/gem /usr/bin/gem
142
142
  fi
143
143
  else
144
144
  if [ ! $(which ruby) ]; then
145
145
  #{update_packages_redhat_cmd}
146
- #{sudo('yum')} -y install ruby ruby-devel
146
+ #{sudo_env('yum')} -y install ruby ruby-devel
147
147
  fi
148
148
  fi
149
149
  else
150
150
  #{update_packages_redhat_cmd}
151
- #{sudo('yum')} -y install ruby ruby-devel gcc
151
+ #{sudo_env('yum')} -y install ruby ruby-devel gcc
152
152
  fi
153
153
  elif [ -f /etc/SuSE-release ] || [ -f /etc/SUSE-brand ]; then
154
154
  #{update_packages_suse_cmd}
155
- #{sudo('zypper')} --non-interactive install ruby ruby-devel ca-certificates ca-certificates-cacert ca-certificates-mozilla
156
- #{sudo('gem')} sources --add https://rubygems.org/
155
+ #{sudo_env('zypper')} --non-interactive install ruby ruby-devel ca-certificates ca-certificates-cacert ca-certificates-mozilla
156
+ #{sudo_env('gem')} sources --add https://rubygems.org/
157
157
  else
158
158
  if [ ! $(which ruby) ]; then
159
159
  #{update_packages_debian_cmd}
@@ -167,7 +167,7 @@ module Kitchen
167
167
  PACKAGES="ruby ruby-dev ruby2.1 ruby2.1-dev"
168
168
  fi
169
169
  fi
170
- #{sudo('apt-get')} -y install $PACKAGES
170
+ #{sudo_env('apt-get')} -y install $PACKAGES
171
171
  fi
172
172
  fi
173
173
  INSTALL
@@ -178,8 +178,9 @@ module Kitchen
178
178
  if [ ! -d "/opt/chef" ]
179
179
  then
180
180
  echo "-----> Installing Chef Omnibus to install busser to run tests"
181
+ #{export_http_proxy}
181
182
  do_download #{chef_url} /tmp/install.sh
182
- #{sudo('sh')} /tmp/install.sh
183
+ #{sudo_env('sh')} /tmp/install.sh
183
184
  fi
184
185
  INSTALL
185
186
  end
@@ -190,7 +191,7 @@ module Kitchen
190
191
  def init_command
191
192
  dirs = %w{modules roles group_vars host_vars}.
192
193
  map { |dir| File.join(config[:root_path], dir) }.join(" ")
193
- cmd = "#{sudo('rm')} -rf #{dirs};"
194
+ cmd = "#{sudo_env('rm')} -rf #{dirs};"
194
195
  cmd = cmd+" mkdir -p #{config[:root_path]}"
195
196
  debug(cmd)
196
197
  cmd
@@ -229,19 +230,19 @@ module Kitchen
229
230
 
230
231
  # Prevent failure when ansible package installation doesn't contain /etc/ansible
231
232
  commands << [
232
- sudo("bash -c '[ -d /etc/ansible ] || mkdir /etc/ansible'")
233
+ sudo_env("bash -c '[ -d /etc/ansible ] || mkdir /etc/ansible'")
233
234
  ]
234
235
 
235
236
  commands << [
236
- sudo('cp'),File.join(config[:root_path], 'ansible.cfg'),'/etc/ansible',
237
+ sudo_env('cp'),File.join(config[:root_path], 'ansible.cfg'),'/etc/ansible',
237
238
  ].join(' ')
238
239
 
239
240
  commands << [
240
- sudo('cp -r'), File.join(config[:root_path],'group_vars'), '/etc/ansible/.',
241
+ sudo_env('cp -r'), File.join(config[:root_path],'group_vars'), '/etc/ansible/.',
241
242
  ].join(' ')
242
243
 
243
244
  commands << [
244
- sudo('cp -r'), File.join(config[:root_path],'host_vars'), '/etc/ansible/.',
245
+ sudo_env('cp -r'), File.join(config[:root_path],'host_vars'), '/etc/ansible/.',
245
246
  ].join(' ')
246
247
 
247
248
  if galaxy_requirements
@@ -267,6 +268,12 @@ module Kitchen
267
268
  else
268
269
  cmd = ansible_command("ansible-playbook")
269
270
  end
271
+ if https_proxy
272
+ cmd = "HTTPS_PROXY=#{https_proxy} #{cmd}"
273
+ end
274
+ if http_proxy
275
+ cmd = "HTTP_PROXY=#{http_proxy} #{cmd}"
276
+ end
270
277
  [
271
278
  cmd,
272
279
  ansible_inventory_flag,
@@ -283,7 +290,7 @@ module Kitchen
283
290
  end
284
291
 
285
292
  def ansible_command(script)
286
- config[:ansible_sudo].nil? || config[:ansible_sudo] == true ? sudo(script) : script
293
+ config[:ansible_sudo].nil? || config[:ansible_sudo] == true ? sudo_env(script) : script
287
294
  end
288
295
 
289
296
  protected
@@ -299,22 +306,24 @@ module Kitchen
299
306
  <<-INSTALL
300
307
  if [ ! -d #{config[:root_path]}/ansible ]; then
301
308
  if [ -f /etc/centos-release ] || [ -f /etc/redhat-release ]; then
309
+ #{install_epel_repo}
302
310
  #{update_packages_redhat_cmd}
303
- #{sudo('yum')} -y install libselinux-python python2-devel git python-setuptools python-setuptools-dev
311
+ #{sudo_env('yum')} -y install libselinux-python python2-devel git python-setuptools python-setuptools-dev
304
312
  else
305
- if [ -f /etc/SUSE-brand ] || [ -f /etc/SuSE-release ]; then
306
- #{sudo('zypper')} ar #{python_sles_repo}
313
+ if [ -f /etc/SUSE-brand ] || [ -f /etc/SuSE-release ]; then
314
+ #{sudo_env('zypper')} ar #{python_sles_repo}
307
315
  #{update_packages_suse_cmd}
308
- #{sudo('zypper')} --non-interactive install python python-devel git python-setuptools python-pip python-six libyaml-devel
316
+ #{sudo_env('zypper')} --non-interactive install python python-devel git python-setuptools python-pip python-six libyaml-devel
309
317
  else
310
318
  #{update_packages_debian_cmd}
311
- #{sudo('apt-get')} -y install git python python-setuptools build-essential python-dev
319
+ #{sudo_env('apt-get')} -y install git python python-setuptools build-essential python-dev
312
320
  fi
313
321
  fi
314
322
 
323
+ #{export_http_proxy}
315
324
  git clone git://github.com/ansible/ansible.git --recursive #{config[:root_path]}/ansible
316
- #{sudo('easy_install')} pip
317
- #{sudo('pip')} install paramiko PyYAML Jinja2 httplib2
325
+ #{sudo_env('easy_install')} pip
326
+ #{sudo_env('pip')} install paramiko PyYAML Jinja2 httplib2
318
327
  fi
319
328
  INSTALL
320
329
  end
@@ -326,13 +335,16 @@ module Kitchen
326
335
  else
327
336
  ""
328
337
  end
338
+
329
339
  <<-INSTALL
330
340
  #{Util.shell_helpers}
331
341
 
332
342
  if [ ! -d "#{config[:ansible_omnibus_remote_path]}" ]; then
333
343
  echo "-----> Installing Ansible Omnibus"
344
+ #{export_http_proxy}
345
+ #{install_epel_repo}
334
346
  do_download #{config[:ansible_omnibus_url]} /tmp/ansible_install.sh
335
- #{sudo('sh')} /tmp/ansible_install.sh #{version}
347
+ #{sudo_env('sh')} /tmp/ansible_install.sh #{version}
336
348
  fi
337
349
  INSTALL
338
350
  end
@@ -343,24 +355,24 @@ module Kitchen
343
355
  #{update_packages_debian_cmd}
344
356
 
345
357
  ## Install apt-utils to silence debconf warning: http://serverfault.com/q/358943/77156
346
- #{sudo('apt-get')} -y install apt-utils git
358
+ #{sudo_env('apt-get')} -y install apt-utils git
347
359
 
348
360
  ## Fix debconf tty warning messages
349
361
  export DEBIAN_FRONTEND=noninteractive
350
362
 
351
363
  ## 13.10, 14.04 include add-apt-repository in software-properties-common
352
- #{sudo('apt-get')} -y install software-properties-common
364
+ #{sudo_env('apt-get')} -y install software-properties-common
353
365
 
354
366
  ## 10.04, 12.04 include add-apt-repository in
355
- #{sudo('apt-get')} -y install python-software-properties
367
+ #{sudo_env('apt-get')} -y install python-software-properties
356
368
 
357
369
  ## 10.04 version of add-apt-repository doesn't accept --yes
358
370
  ## later versions require interaction from user, so we must specify --yes
359
371
  ## First try with -y flag, else if it fails, try without.
360
372
  ## "add-apt-repository: error: no such option: -y" is returned but is ok to ignore, we just retry
361
- #{sudo('add-apt-repository')} -y #{ansible_apt_repo} || #{sudo('add-apt-repository')} #{ansible_apt_repo}
362
- #{sudo('apt-get')} update
363
- #{sudo('apt-get')} -y install ansible
373
+ #{sudo_env('add-apt-repository')} -y #{ansible_apt_repo} || #{sudo_env('add-apt-repository')} #{ansible_apt_repo}
374
+ #{sudo_env('apt-get')} update
375
+ #{sudo_env('apt-get')} -y install ansible
364
376
  fi
365
377
  INSTALL
366
378
  end
@@ -368,10 +380,10 @@ module Kitchen
368
380
  def install_suse_command
369
381
  <<-INSTALL
370
382
  if [ ! $(which ansible) ]; then
371
- #{sudo('zypper')} ar #{python_sles_repo}
372
- #{sudo('zypper')} ar #{ansible_sles_repo}
383
+ #{sudo_env('zypper')} ar #{python_sles_repo}
384
+ #{sudo_env('zypper')} ar #{ansible_sles_repo}
373
385
  #{update_packages_suse_cmd}
374
- #{sudo('zypper')} --non-interactive install ansible
386
+ #{sudo_env('zypper')} --non-interactive install ansible
375
387
  fi
376
388
  INSTALL
377
389
  end
@@ -379,9 +391,10 @@ module Kitchen
379
391
  def install_redhat_command
380
392
  <<-INSTALL
381
393
  if [ ! $(which ansible) ]; then
382
- #{sudo('rpm')} -ivh #{ansible_yum_repo}
394
+ #{install_epel_repo}
395
+ #{sudo_env('rpm')} -ivh #{ansible_yum_repo}
383
396
  #{update_packages_redhat_cmd}
384
- #{sudo('yum')} -y install ansible#{ansible_redhat_version} libselinux-python git
397
+ #{sudo_env('yum')} -y install ansible#{ansible_redhat_version} libselinux-python git
385
398
  fi
386
399
  INSTALL
387
400
  end
@@ -389,11 +402,12 @@ module Kitchen
389
402
  def install_amazon_linux_command
390
403
  <<-INSTALL
391
404
  if [ ! $(which ansible) ]; then
392
- #{sudo('yum-config-manager')} --enable epel/x86_64
393
- #{sudo('yum')} -y install ansible#{ansible_redhat_version} git
394
- #{sudo('alternatives')} --set python /usr/bin/python2.6
395
- #{sudo('yum')} clean all
396
- #{sudo('yum')} install yum-python26 -y
405
+ #{install_epel_repo}
406
+ #{sudo_env('yum-config-manager')} --enable epel/x86_64
407
+ #{sudo_env('yum')} -y install ansible#{ansible_redhat_version} git
408
+ #{sudo_env('alternatives')} --set python /usr/bin/python2.6
409
+ #{sudo_env('yum')} clean all
410
+ #{sudo_env('yum')} install yum-python26 -y
397
411
  fi
398
412
  INSTALL
399
413
  end
@@ -524,15 +538,15 @@ module Kitchen
524
538
  end
525
539
 
526
540
  def update_packages_debian_cmd
527
- config[:update_package_repos] ? "#{sudo('apt-get')} update" : nil
541
+ config[:update_package_repos] ? "#{sudo_env('apt-get')} update" : nil
528
542
  end
529
543
 
530
544
  def update_packages_suse_cmd
531
- config[:update_package_repos] ? "#{sudo('zypper')} --gpg-auto-import-keys ref" : nil
545
+ config[:update_package_repos] ? "#{sudo_env('zypper')} --gpg-auto-import-keys ref" : nil
532
546
  end
533
547
 
534
548
  def update_packages_redhat_cmd
535
- config[:update_package_repos] ? "#{sudo('yum')} makecache" : nil
549
+ config[:update_package_repos] ? "#{sudo_env('yum')} makecache" : nil
536
550
  end
537
551
 
538
552
  def extra_vars
@@ -571,7 +585,7 @@ module Kitchen
571
585
  end
572
586
 
573
587
  def ansible_sles_repo
574
- config[:ansible_sles_repo]
588
+ config[:ansible_sles_repo]
575
589
  end
576
590
 
577
591
  def python_sles_repo
@@ -589,6 +603,32 @@ module Kitchen
589
603
  def require_chef_for_busser
590
604
  config[:require_chef_for_busser]
591
605
  end
606
+
607
+ def install_epel_repo
608
+ config[:enable_yum_epel] ? sudo_env('yum install epel-release -y') : nil
609
+ end
610
+
611
+ def http_proxy
612
+ config[:http_proxy]
613
+ end
614
+
615
+ def https_proxy
616
+ config[:https_proxy]
617
+ end
618
+
619
+ def sudo_env(pm)
620
+ s = https_proxy ? "https_proxy=#{https_proxy}" : nil
621
+ p = http_proxy ? "http_proxy=#{http_proxy}" : nil
622
+ p || s ? "#{sudo('env')} #{p} #{s} #{pm}" : "#{sudo(pm)}"
623
+ end
624
+
625
+ def export_http_proxy
626
+ cmd = ""
627
+ cmd = " HTTP_PROXY=#{http_proxy}" if http_proxy
628
+ cmd = "#{cmd} HTTPS_PROXY=#{https_proxy}" if https_proxy
629
+ cmd = "export #{cmd}" if cmd != ""
630
+ cmd
631
+ end
592
632
 
593
633
  def prepare_roles
594
634
  info('Preparing roles')
@@ -1,5 +1,5 @@
1
1
  module Kitchen
2
2
  module Ansible
3
- VERSION = "0.0.24"
3
+ VERSION = "0.0.25"
4
4
  end
5
5
  end
@@ -1,99 +1,102 @@
1
-
2
- # Provisioner Options
3
-
4
- key | default value | Notes
5
- ----|---------------|--------
6
- ansible_version | "latest"| desired version, affects apt installs
7
- ansible_sudo | true | drives whether ansible-playbook is executed as root or as the current authenticated user
8
- ansible_platform | naively tries to determine | OS platform of server
9
- require_ansible_repo | true | Set if using a ansible install from yum or apt repo
10
- ansible_apt_repo | "ppa:ansible/ansible" | apt repo. see https://launchpad.net /~ansible/+archive/ubuntu/ansible or rquillo/ansible
11
- ansible_yum_repo | https://download.fedoraproject.org /pub/epel/6/i386/epel-release-6-8.noarch.rpm | yum repo
12
- ansible_sles_repo | http://download.opensuse.org /repositories/systemsmanagement/SLE_12/systemsmanagement.repo | zypper suse ansible repo
13
- python_sles_repo | http://download.opensuse.org /repositories/devel:/languages:/python/SLE_12/devel:languages:python.repo | zypper suse python repo
14
- roles_path | roles | ansible repo roles directory
15
- group_vars_path | group_vars | ansible repo group_vars directory
16
- host_vars_path | host_vars | ansible repo hosts directory
17
- filter_plugins | filter_plugins | ansible repo filter_plugins directory
18
- lookup_plugins | lookup_plugins | ansible repo lookup_plugins directory
19
- additional_copy_path | | arbitrary array of files and directories to copy into test environment, relative to CWD. (eg, vars or included playbooks)
20
- extra_vars | Hash.new | Hash to set the extra_vars passed to ansibile-playbook command
21
- playbook | 'default.yml' | playbook for ansible-playbook to run
22
- modules_path | | ansible repo manifests directory
23
- ansible_verbose| false| Extra information logging
24
- ansible_verbosity| 1| Sets the verbosity flag appropriately (e.g.: `1 => '-v', 2 => '-vv', 3 => '-vvv" ...`) Valid values are one of: `1, 2, 3, 4` OR `:info, :warn, :debug, :trace`.
25
- ansible_check| false| Sets the `--check` flag when running Ansible
26
- ansible_diff| false| Sets the `--diff` flag when running Ansible
27
- update_package_repos| true| update OS repository metadata
28
- require_ruby_for_busser|true|install ruby to run busser for tests
29
- ansiblefile_path | | Path to Ansiblefile
30
- requirements_path | | Path to ansible-galaxy requirements
31
- ansible_vault_password_file| | Path of Ansible Vault Password File
32
- ansible_connection | local | Connection for Hosts and Groups
33
- ansible_inventory_file | hosts | Custom inventory file
34
- require_ansible_omnibus | false | Set if using omnibus ansible pip install
35
- ansible_omnibus_url | https://raw.githubusercontent.com /neillturner/omnibus-ansible/master/ansible_install.sh | omnibus ansible install location.
36
- ansible_omnibus_remote_path | "/opt/ansible" | Server Installation location of an omnibus ansible install.
37
- require_chef_for_busser|false|install chef to run busser for tests. NOTE: kitchen 1.4 only requires ruby to run busser so this is not required.
38
- chef_bootstrap_url |https://www.getchef.com /chef/install.sh| the chef install
39
- 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.
40
-
41
- ## Configuring Provisioner Options
42
-
43
- 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:
44
-
45
- ```yaml
46
- ---
47
- driver:
48
- name: vagrant
49
-
50
- provisioner:
51
- name: ansible_playbook
52
- roles_path: roles
53
- hosts: tomcat-servers
54
- require_ansible_repo: true
55
- ansible_verbose: true
56
- ansible_verbosity: 2
57
- ansible_diff: true
58
-
59
- platforms:
60
- - name: nocm_ubuntu-12.04
61
- driver_plugin: vagrant
62
- driver_config:
63
- box: nocm_ubuntu-12.04
64
- box_url: http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-server-12042-x64-vbox4210-nocm.box
65
-
66
- suites:
67
- - name: default
68
- ```
69
-
70
- **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
71
-
72
- ```yaml
73
- verifier:
74
- ruby_bindir: '/usr/bin'
75
- ```
76
- where /usr/bin is the location of the ruby command.
77
-
78
-
79
- 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
80
-
81
- To override a setting at the suite-level, specify the setting name under the suite's attributes:
82
-
83
- ```yaml
84
- suites:
85
- - name: server
86
- attributes:
87
- extra_vars:
88
- server_installer_url: http://downloads.app.com/v1.0
89
- tags:
90
- - server
91
- ```
92
-
93
- ### Per-suite Structure
94
-
95
- 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:
96
-
97
- $kitchen_root/ansible/$suite_name/roles
98
- $kitchen_root/ansible/$suite_name/modules
99
- $kitchen_root/ansible/$suite_name/Ansiblefile
1
+
2
+ # Provisioner Options
3
+
4
+ key | default value | Notes
5
+ ----|---------------|--------
6
+ ansible_version | "latest"| desired version, affects apt installs
7
+ ansible_sudo | true | drives whether ansible-playbook is executed as root or as the current authenticated user
8
+ ansible_platform | naively tries to determine | OS platform of server
9
+ require_ansible_repo | true | Set if using a ansible install from yum or apt repo
10
+ ansible_apt_repo | "ppa:ansible/ansible" | apt repo. see https://launchpad.net /~ansible/+archive/ubuntu/ansible or rquillo/ansible
11
+ ansible_yum_repo | https://download.fedoraproject.org /pub/epel/6/i386/epel-release-6-8.noarch.rpm | yum repo
12
+ enable_yum_epel | false | enable yum EPEL repo
13
+ ansible_sles_repo | http://download.opensuse.org /repositories/systemsmanagement/SLE_12/systemsmanagement.repo | zypper suse ansible repo
14
+ python_sles_repo | http://download.opensuse.org /repositories/devel:/languages:/python/SLE_12/devel:languages:python.repo | zypper suse python repo
15
+ require_ansible_omnibus | false | Set if using omnibus ansible pip install
16
+ ansible_omnibus_url | https://raw.githubusercontent.com /neillturner/omnibus-ansible/master/ansible_install.sh | omnibus ansible install location.
17
+ ansible_omnibus_remote_path | "/opt/ansible" | Server Installation location of an omnibus ansible install.
18
+ http_proxy | nil | use http proxy when installing puppet, packages and running puppet
19
+ https_proxy | nil | use https proxy when installing puppet, packages and running puppet
20
+ roles_path | roles | ansible repo roles directory
21
+ group_vars_path | group_vars | ansible repo group_vars directory
22
+ host_vars_path | host_vars | ansible repo hosts directory
23
+ filter_plugins | filter_plugins | ansible repo filter_plugins directory
24
+ lookup_plugins | lookup_plugins | ansible repo lookup_plugins directory
25
+ additional_copy_path | | arbitrary array of files and directories to copy into test environment, relative to CWD. (eg, vars or included playbooks)
26
+ extra_vars | Hash.new | Hash to set the extra_vars passed to ansibile-playbook command
27
+ playbook | 'default.yml' | playbook for ansible-playbook to run
28
+ modules_path | | ansible repo manifests directory
29
+ ansible_verbose| false| Extra information logging
30
+ ansible_verbosity| 1| Sets the verbosity flag appropriately (e.g.: `1 => '-v', 2 => '-vv', 3 => '-vvv" ...`) Valid values are one of: `1, 2, 3, 4` OR `:info, :warn, :debug, :trace`.
31
+ ansible_check| false| Sets the `--check` flag when running Ansible
32
+ ansible_diff| false| Sets the `--diff` flag when running Ansible
33
+ update_package_repos| true| update OS repository metadata
34
+ ansiblefile_path | | Path to Ansiblefile
35
+ requirements_path | | Path to ansible-galaxy requirements
36
+ ansible_vault_password_file| | Path of Ansible Vault Password File
37
+ ansible_connection | local | Connection for Hosts and Groups
38
+ ansible_inventory_file | hosts | Custom inventory file
39
+ require_ruby_for_busser|false|install ruby to run busser for tests
40
+ 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.
41
+ chef_bootstrap_url |https://www.getchef.com /chef/install.sh| the chef install
42
+ 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.
43
+
44
+ ## Configuring Provisioner Options
45
+
46
+ 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:
47
+
48
+ ```yaml
49
+ ---
50
+ driver:
51
+ name: vagrant
52
+
53
+ provisioner:
54
+ name: ansible_playbook
55
+ roles_path: roles
56
+ hosts: tomcat-servers
57
+ require_ansible_repo: true
58
+ ansible_verbose: true
59
+ ansible_verbosity: 2
60
+ ansible_diff: true
61
+
62
+ platforms:
63
+ - name: nocm_ubuntu-12.04
64
+ driver_plugin: vagrant
65
+ driver_config:
66
+ box: nocm_ubuntu-12.04
67
+ box_url: http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-server-12042-x64-vbox4210-nocm.box
68
+
69
+ suites:
70
+ - name: default
71
+ ```
72
+
73
+ **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
74
+
75
+ ```yaml
76
+ verifier:
77
+ ruby_bindir: '/usr/bin'
78
+ ```
79
+ where /usr/bin is the location of the ruby command.
80
+
81
+
82
+ 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
83
+
84
+ To override a setting at the suite-level, specify the setting name under the suite's attributes:
85
+
86
+ ```yaml
87
+ suites:
88
+ - name: server
89
+ attributes:
90
+ extra_vars:
91
+ server_installer_url: http://downloads.app.com/v1.0
92
+ tags:
93
+ - server
94
+ ```
95
+
96
+ ### Per-suite Structure
97
+
98
+ 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:
99
+
100
+ $kitchen_root/ansible/$suite_name/roles
101
+ $kitchen_root/ansible/$suite_name/modules
102
+ $kitchen_root/ansible/$suite_name/Ansiblefile
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.0.24
4
+ version: 0.0.25
5
5
  platform: ruby
6
6
  authors:
7
7
  - Neill Turner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-28 00:00:00.000000000 Z
11
+ date: 2015-09-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: test-kitchen