kitchen-puppet 3.4.1 → 3.4.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,411 +1,411 @@
1
-
2
- # Puppet Apply Install Options
3
-
4
- Kitchen-puppet is very flexible in how it installs puppet:
5
-
6
- It installs it in the following order:
7
-
8
- * if require_puppet_omnibus is set to true
9
-
10
- Installs using the omnibus_puppet script and passes the puppet_version if specied as -v option.
11
-
12
- * If require_puppet_collections is set to true (the default)
13
-
14
- Installs from the puppet collection.
15
- This is required if you wish to install puppet version 4 or 5.
16
-
17
- You get the version of puppet in the collection. To influence which puppet version is install modify either
18
- * puppet_yum_collections_repo
19
- * puppet_apt_collections_repo
20
- to an new collection. At time of writing there are only 2 collections PC1 and puppet5.
21
-
22
- * if require_puppet_repo is set to true
23
-
24
- Installs from the operation system repository with the puppet version that is in the particular repository.
25
-
26
- # Puppet Apply Provisioner Options
27
-
28
- key | default value | Notes
29
- ----|---------------|--------
30
- chef_bootstrap_url | https://www.chef.io/ chef/install.sh | the chef (needed for busser to run tests) NOTE: kitchen 1.4 only requires ruby to run busser so this is not required.
31
- custom_facts| Hash.new | Hash to set the puppet facts before running puppet apply
32
- custom_options | | custom options to add to puppet apply command.
33
- custom_pre_install_command | nil | Custom shell command to be used at beginning of install stage. Can be multiline.
34
- custom_install_command | nil | Custom shell command to be used at end of install stage. Can be multiline. See examples below.
35
- custom_pre_apply_command | nil | Custom shell command to be used before the puppet apply stage. Can be multiline. See examples below.
36
- custom_post_apply_command | nil | Custom shell command to be used after the puppet apply stage. Can be multiline. See examples below.
37
- facter_file | nil | custom facter_file to be provided to the puppet-apply command
38
- facter_version | "latest"| desired version, affects apt installs.
39
- files_path | | directory to place at /tmp/kitchen/files
40
- fileserver_config_path | | file to place fileserver.conf
41
- hiera_config_path | hiera.global.yaml then hiera.yaml | path to hiera.yaml
42
- hiera_data_path | | puppet repo hiera data directory
43
- hiera_data_remote_path | "/var/lib/hiera" | Hiera data directory on server
44
- hiera_deep_merge | false | install the deep_merge gem to support hiera deep merge mode
45
- hiera_eyaml | false | use hiera-eyaml to encrypt hiera data
46
- hiera_eyaml_gpg | false | use GPG encryption backend for hiera-eyaml
47
- hiera_eyaml_gpg_recipients | false | recipients eg ehiera/hiera-eyaml-gpg.recipients
48
- hiera_eyaml_gpg_secring | false | eg hiera/secring.gpg
49
- hiera_eyaml_gpg_pubring | false | eg hiera/pubring.gpg
50
- hiera_eyaml_key_remote_path | "/etc/puppet/secure/keys" | directory of hiera-eyaml keys on server
51
- hiera_eyaml_key_path | "hiera_keys" | directory of hiera-eyaml keys on workstation
52
- hiera_package | 'hiera-puppet' | Only used if `install_hiera` is set
53
- hiera_version | "latest"| desired version, affects apt installs.
54
- hiera_writer_files | | Adds hiera YAML file generation
55
- http_proxy | nil | use http proxy when installing puppet, packages and running puppet
56
- https_proxy | nil | use https proxy when installing puppet, packages and running puppet
57
- ignored_paths_from_root | ['spec'] | allow extra paths to be ignored when copying from puppet repository
58
- ignore_spec_fixtures | false | don't copy spec/fixtures to avoid problems with symlinks
59
- install_custom_facts| false | Install custom facts to yaml file at "/tmp/kitchen/facter/kitchen.rb"
60
- install_hiera | false | Installs `hiera-puppet` package. Not needed for puppet > 3.x.x
61
- librarian_puppet_ssl_file | nil | ssl certificate file for librarian-puppet
62
- r10k_ssl_file | nil | ssl certificate file for r10k
63
- manifest | puppet parses every .pp file in the manifests_path directory and its subdirectories | manifest(s) for puppet apply to run. If set to a file like 'site.pp' it will use the file in the mainfests_path.
64
- manifests_path | 'mainfests' | puppet repo manifests directory
65
- max_retries| 1 | maximum number of retry attempts of converge command
66
- modules_path | | puppet repo manifests directory. Can be multiple directories separated by colons and then they will be merged
67
- no_proxy | nil | list of URLs or IPs that should be excluded from proxying
68
- platform | platform_name kitchen.yml parameter | OS platform of server
69
- puppet_apply_command | nil | Overwrite the puppet apply command. Needs "sudo -E puppet apply" as a prefix.
70
- puppet_apt_repo | http://apt.puppetlabs.com/ puppetlabs-release-precise.deb | apt repo Ubuntu12 see https://apt.puppetlabs.com for others
71
- _for Ubuntu14 change to_ | http://apt.puppetlabs.com/ puppetlabs-release-trusty.deb |
72
- _for Ubuntu15 change to_ | http://apt.puppetlabs.com/ puppetlabs-release-jessie.deb |
73
- _for Ubuntu16.04 change to_ | http://apt.puppetlabs.com/ puppetlabs-release-xenial.deb |
74
- puppet_apt_collections_repo | http://apt.puppetlabs.com/ puppet5-release-wheezy.deb | apt collections repo
75
- _for Ubuntu14 change to_ | http://apt.puppetlabs.com/ puppet5-release-trusty.deb |
76
- _for Ubuntu15 change to_ | http://apt.puppetlabs.com/ puppet5-release-jessie.deb |
77
- _for Ubuntu16.04 change to_ | http://apt.puppetlabs.com/ puppet5-release-xenial.deb |
78
- puppet_binary | 'puppet' | puppet default binary
79
- puppet_coll_remote_path | "/opt/puppetlabs" | Server Installation location of a puppet collections install.
80
- puppet_config_path | | path of custom puppet.conf file
81
- puppet_debug| false| Enable full debugging logging on puppet run
82
- puppet_detailed_exitcodes | nil | Provide transaction information via exit codes. See `--detailed-exitcodes` section of `puppet help apply`
83
- puppet_enc | | path for external node classifier script
84
- puppet_environment | nil | puppet environment for running puppet apply (Must set if using Puppet v4)
85
- puppet_environment _config_path | "environment.conf" | Puppet environment config file
86
- puppet_environment _hiera_config_path | "hiera.yaml" | Environment layer hiera config file (see Puppet 4.10), only used if puppet _environmentpath = true
87
- puppet_environment _remote_hieradata_path | "hieradata" | Path in `puppet_environmentpath_remote_path` to contains the hiera data.
88
- puppet_environment _remote_modules_path | "modules" | Path in `puppet_environmentpath_remote_path` to contains the modules.
89
- puppet_environment _remote_manifests_path | "manifests" | Path in `puppet_environmentpath_remote_path` to contains the manifests.
90
- puppet _environmentpath_remote_path | /etc/puppet/environments (v3), /etc/puppetlabs/code/environments (v4) | The remote path for environments if `puppet_environment` is true
91
- puppet_future_parser | false | Run puppet with the future parser enabled (see https://docs.puppet.com/ puppet/3.8/experiments_future.html).
92
- puppet_git_init | nil | initialize puppet from GIT repository, e.g. "git@github.com:example/puppet-repo.git"
93
- puppet_git_pr | nil | checkout specific Pull Request from repository specified in puppet_git_init, e.g. "324"
94
- puppet_logdest | nil | _Array_ of log destinations. Include 'console' if wanted
95
- puppet_omnibus_url | https://raw.githubusercontent.com/ petems/puppet-install-shell/ master/install_puppet_5_agent.sh | omnibus puppet v5 install location.
96
- _for puppet v3 change to_ | https://raw.githubusercontent.com/ petems/puppet-install-shell/ master/install_puppet.sh |
97
- _for puppet v4 change to_ | https://raw.githubusercontent.com/ petems/puppet-install-shell/ master/install_puppet_agent.sh |
98
- puppet_noop| false| puppet runs in a no-op or dry-run mode
99
- puppet_no_sudo | false | allow puppet command to run without sudo if required
100
- puppet_verbose| false| Extra information logging on puppet run
101
- puppet_show_diff| false| Show diffs for changes to config files during puppet runs.
102
- puppet_version | "latest"| desired version, affects apt and most installs.
103
- puppet_whitelist_exit_code | nil | Whitelist exit code expected from puppet run. Intended to be used together with `puppet_detailed_exitcodes`. You can also specify a yaml list here (you should use 0 and 2 for `puppet_detailed_exitcodes` to capture puppet runtime errors and allow multiple converge runs (without changes)).
104
- puppet_yum_repo | https://yum.puppetlabs.com/ puppetlabs-release-el-6.noarch.rpm | yum repo RH/Centos6
105
- _for RH/Centos7 change to_ | https://yum.puppetlabs.com/ puppetlabs-release-el-7.noarch.rpm |
106
- puppet_yum_collections_repo | http://yum.puppetlabs.com/ puppet5/puppet-release-el-6.noarch.rpm | yum collections repo RH/Centos6
107
- _for RH/Centos7 change to_ | http://yum.puppetlabs.com/ puppet5/puppet-release-el-7.noarch.rpm |
108
- puppetfile_path | | Path to Puppetfile
109
- remove_puppet_repo | false | remove copy of puppet repository and puppet configuration on server after running puppet
110
- require_chef_for_busser | true | Install chef as currently needed by busser to run tests
111
- require_puppet_collections | true | Set if using puppet collections install (Puppet v4)
112
- require_puppet_omnibus | false | Set if using omnibus puppet install
113
- require_puppet_repo | true | Set if using a puppet install from yum or apt repo
114
- resolve_with_librarian_puppet | true | Use librarian_puppet to resolve modules if a Puppetfile is found
115
- resolve_with_r10k | true | Use r10k to resolve modules if a Puppetfile is found
116
- retry_on_exit_code| [] | Array of exit codes to retry converge command against
117
- update_package_repos| true| update OS repository metadata
118
- wait_for_retry| 30 | number of seconds to wait before retrying converge command
119
-
120
- ## Puppet Apply Configuring Provisioner Options
121
-
122
- 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:
123
-
124
- ```yaml
125
- ---
126
- driver:
127
- name: vagrant
128
-
129
- provisioner:
130
- name: puppet_apply
131
- manifests_path: /repository/puppet_repo/manifests
132
- modules_path: /repository/puppet_repo/modules-mycompany
133
- hiera_data_path: /repository/puppet_repo/hieradata
134
-
135
- platforms:
136
- - name: nocm_ubuntu-12.04
137
- driver_plugin: vagrant
138
- driver_config:
139
- box: nocm_ubuntu-12.04
140
- box_url: http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-server-12042-x64-vbox4210-nocm.box
141
-
142
- suites:
143
- - name: default
144
- ```
145
-
146
- **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
147
-
148
- ```yaml
149
- verifier:
150
- ruby_bindir: '/usr/bin'
151
- ```
152
- where /usr/bin is the location of the ruby command.
153
-
154
- in this example, vagrant will download a box for ubuntu 1204 with no configuration management installed, then install the
155
- latest puppet and puppet apply against a puppet repo from the /repository/puppet_repo directory using the defailt manifest site.pp
156
-
157
- To override a setting at the suite-level, specify the setting name under the suite:
158
-
159
- ```yaml
160
- suites:
161
- - name: default
162
- provisioner:
163
- manifest: foobar.pp
164
- ```
165
-
166
- #### custom_install_command example usage
167
-
168
- * One liner
169
- ```yaml
170
- custom_install_command: yum install -y git
171
- ```
172
- * Multiple lines, a.k.a embed shell script
173
- ```yaml
174
- custom_install_command: |
175
- command1
176
- command2
177
- ```
178
- * Multiple lines join without new line
179
- ```yaml
180
- custom_install_command: >
181
- command1 &&
182
- command2
183
- ```
184
-
185
- ### Per-suite Structure
186
-
187
- It can be beneficial to keep different Puppet layouts for different suites. Rather than having to specify the manifest, modules, etc for each suite, you can create the following directory structure and they will automatically be found:
188
-
189
- $kitchen_root/puppet/$suite_name/manifests
190
- $kitchen_root/puppet/$suite_name/modules
191
- $kitchen_root/puppet/$suite_name/hiera
192
- $kitchen_root/puppet/$suite_name/hiera.yaml
193
- $kitchen_root/puppet/$suite_name/Puppetfile
194
-
195
- ### Puppet Version
196
- When specifying a puppet version, you must use this format: "3.6.2-1puppetlabs1". I have
197
- no idea why Puppet versioned their repository with a trailing
198
- "-1puppetlabs1", but there it is.
199
-
200
-
201
- ### eyaml
202
-
203
- See https://puppet.com/blog/encrypt-your-data-using-hiera-eyaml
204
-
205
- See https://blog.benroberts.net/2014/12/setting-up-hiera-eyaml-gpg for using GPG backend allowing secrets to be protected using asymmetric keys.
206
-
207
-
208
- # Puppet Agent Provisioner Options
209
-
210
- key | default value | Notes
211
- ----|---------------|--------
212
- puppet_version | "latest"| desired version, affects apt installs.
213
- facter_version | "latest"| desired version, affects apt installs.
214
- platform | platform_name kitchen.yml parameter | OS platform of server
215
- require_puppet_repo | true | Set if using a puppet install from yum or apt repo
216
- puppet_apt_repo | http://apt.puppetlabs.com/ puppetlabs-release-precise.deb| apt repo
217
- puppet_yum_repo | https://yum.puppetlabs.com/ puppetlabs-release-el-6.noarch.rpm| yum repo
218
- require_puppet_omnibus | false | Set if using omnibus puppet install
219
- puppet_omnibus_url | | omnibus puppet install location.
220
- puppet_omnibus_remote_path | "/opt/puppet" | Server Installation location of an omnibus puppet install.
221
- puppet_detailed_exitcodes | nil | Provide transaction information via exit codes.
222
- puppet_logdest | nil | Where to send messages. Choose between syslog, the console, and a log file.
223
- puppet_masterport | nil | The port on which to contact the puppet master.
224
- puppet_environment | nil | The puppet environment to run the agent under
225
- puppet_test | false | Enable the most common options used for testing.
226
- puppet_onetime | true | Run the configuration once.
227
- puppet_no_daemonize | true | Do not send the process into the background.
228
- puppet_server | nil | will default to 'puppet'. Useful for interactively running when used with the --no-daemonize option.
229
- puppet_waitforcert | '0' | Time to wait for certificate if agent does not yet have certificates
230
- puppet_certname | nil | Set the certname (unique ID) of the client
231
- puppet_digest | nil | Change the certificate fingerprinting digest algorithm. The default is SHA256
232
- puppet_debug| false| Enable full debugging logging on puppet run
233
- puppet_verbose| false| Extra information logging on puppet run
234
- puppet_noop| false| puppet runs in a no-op or dry-run mode
235
- update_package_repos| true| update OS repository metadata
236
- custom_facts| Hash.new | Hash to set the puppet facts before running puppet apply
237
- facterlib | nil | Path for dynamic fact generation, e.g. /etc/puppet/facter . See https://docs.puppetlabs.com/facter/2.2/custom_facts.html
238
- chef_bootstrap_url |"https://www.chef.io/chef/install.sh"| the chef (needed for busser to run tests)
239
- puppet_agent_command | nil | Overwrite the puppet agent command. Needs "sudo -E puppet agent" as a prefix.
240
- require_chef_for_busser | true | Install chef as currently needed by busser to run tests. NOTE: kitchen 1.4 only requires ruby to run busser so this is not required.
241
- puppet_config_path | | path of custom puppet.conf file
242
- http_proxy | nil | use http proxy when installing puppet and packages
243
- https_proxy | nil | use https proxy when installing puppet and packages
244
- no_proxy | nil | list of URLs or IPs that should be excluded from proxying
245
- ignore_spec_fixtures | | ignore spec/fixtures directory
246
-
247
- NOTE: Puppet Collections Support not in puppet agent yet
248
-
249
- ## Puppet Agent Configuring Provisioner Options
250
-
251
- 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:
252
-
253
- ```yaml
254
- ---
255
- driver:
256
- name: vagrant
257
-
258
- provisioner:
259
- name: puppet_agent
260
- puppet_debug: true
261
- puppet_verbose: true
262
- puppet_server: puppetmaster-nocm-ubuntu-1204
263
-
264
- platforms:
265
- - name: nocm_ubuntu-12.04
266
- driver_plugin: vagrant
267
- driver_config:
268
- box: nocm_ubuntu-12.04
269
- box_url: http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-server-12042-x64-vbox4210-nocm.box
270
-
271
- suites:
272
- - name: default
273
- ```
274
-
275
- **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
276
-
277
- ```yaml
278
- verifier:
279
- ruby_bindir: '/usr/bin'
280
- ```
281
- where /usr/bin is the location of the ruby command.
282
-
283
- In this example, vagrant will download a box for ubuntu 1204 with no configuration management installed, then install the latest puppet and run puppet agent against a puppet master at puppetmaster-nocm-ubuntu-1204
284
-
285
- NOTE: It is important that the server can resolve the hostname ip address of the puppetmaster, in this case puppetmaster-nocm-ubuntu-1204
286
- and the puppetmaster must be able to resolve the hostname ip address address of the hostname of the node running puppet agent.
287
- This can be done by settings in the /etc/hosts files before running puppet.
288
-
289
- NOTE: For testing it is possible to set the puppetmaster to autosign the certificate of a node by created a file /etc/puppet/autosign.conf that contains an *.
290
-
291
-
292
- To override a setting at the suite-level, specify the setting name under the suite:
293
-
294
- ```yaml
295
- suites:
296
- - name: default
297
- provisioner:
298
- manifest: foobar.pp
299
- ```
300
-
301
- ## Custom ServerSpec or Beaker Invocation
302
-
303
- Instead of using the busser use a custom serverspec invocation using [shell verifier](https://github.com/higanworks/kitchen-verifier-shell) to call it.
304
- With such setup there is no dependency on busser and any other chef library.
305
-
306
- Also you can specify you tests in a different directory structure or even call [beaker](https://github.com/puppetlabs/beaker) instead of server spec and have tests in beaker structure
307
-
308
- Using a structure like
309
- ```yaml
310
- verifier:
311
- name: shell
312
- remote_exec: true
313
- command: |
314
- sudo -s <<SERVERSPEC
315
- cd /opt/gdc/serverspec-core
316
- export SERVERSPEC_ENV=$EC2DATA_ENVIRONMENT
317
- export SERVERSPEC_BACKEND=exec
318
- serverspec junit=true tag=~skip_in_kitchen check:role:$EC2DATA_TYPE
319
- SERVERSPEC
320
- ```
321
-
322
- where `serverspec` is a wrapper around `rake` invocation.
323
- Use a `Rakefile` similar to one in https://github.com/vincentbernat/serverspec-example.
324
-
325
- With such approach we can achieve flexibility of running same test suite both in test kitchen and actual, even production, instances.
326
-
327
- Beware: kitchen-shell-verifier is not yet merged into test-kitchen upstream so using separate gem is unavoidable so far
328
-
329
- ## Checking puppet apply success (with puppet_detailed_exitcodes)
330
-
331
- If you do not enable puppet_detailed_exitcodes, the provisioner only failes if the manifest can not be compiled. If the manifest contains errors (some manifests can not be executed) puppet will return exit 0 and thus the provisioner will be successfull, altought your catalog has not been fully applied. Probably this is not what you want.
332
-
333
- When you enable `puppet_detailed_exitcodes`, you can specify the error conditions to check for with `puppet_whitelist_exit_code` also, otherwise the provisioner will fail altought everything is fine (and changes have been made).
334
-
335
- Puppet will return with one of the following codes (see https://docs.puppet.com/puppet/latest/man/agent.html) when `puppet_detailed_exitcodes` is true:
336
-
337
- * 0: The run succeeded with no changes or failures; the system was already in the desired state.
338
- * 1: The run failed, or wasn't attempted due to another run already in progress.
339
- * 2: The run succeeded, and some resources were changed.
340
- * 4: The run succeeded, and some resources failed.
341
- * 6: The run succeeded, and included both changes and failures.
342
-
343
- If you enable `puppet_detailed_exitcodes` you should should probably set `puppet_whitelist_exit_code` to 0 and 2
344
-
345
- ```yaml
346
- provisioner:
347
- puppet_detailed_exitcodes: true
348
- puppet_whitelist_exit_code:
349
- - 0
350
- - 2
351
- ```
352
-
353
- # Puppet Bolt Provisioner Options
354
-
355
- key | default value | Notes
356
- ----|---------------|--------
357
- bolt_commands | nil | array of bolt commands to run.
358
- bolt_version | | desired puppet bolt version, defaults to latest.
359
- custom_pre_install_command | nil | Custom shell command to be used at beginning of install stage. Can be multiline.
360
- custom_install_command | nil | Custom shell command to be used at end of install stage. Can be multiline. See examples below.
361
- custom_pre_bolt_command | nil | Custom shell command to be used before the puppet bolt stage. Can be multiline.
362
- custom_post_bolt_command | nil | Custom shell command to be used after the puppet bolt stage. Can be multiline.
363
- http_proxy | nil | use http proxy when installing bolt, packages and running bolt
364
- https_proxy | nil | use https proxy when installing bolt, packages and running bolt
365
- no_proxy | nil | list of URLs or IPs that should be excluded from proxying
366
- platform | platform_name kitchen.yml parameter | OS platform of server
367
- require_bolt_omnibus | false | Set if using omnibus bolt install. (for future use)
368
- require_bolt_repo | true | Set if using a puppet bolt from yum or apt repo
369
- remove_bolt_repo | false | remove copy of bolt configuration on server after running bolt
370
-
371
- ## Puppet Bolt Configuring Provisioner Options
372
-
373
- The Bolt provisioner can be configured globally or per suite, global settings act as defaults for all suites, you can then customise per suite, for example:
374
-
375
- ```yaml
376
- ---
377
- driver:
378
- name: docker
379
- use_sudo: false
380
- privileged: true
381
-
382
- provisioner:
383
- name: puppet_bolt
384
- bolt_commands:
385
- - bolt --help
386
- - bolt --version
387
-
388
- platforms:
389
- - name: ubuntu-16.04
390
- driver_config:
391
- image: ubuntu:16.04
392
- platform: ubuntu
393
- - name: centos-6.6
394
- driver_config:
395
- image: centos:6.6
396
- platform: centos
397
- - name: centos-7
398
- driver_config:
399
- image: centos:latest
400
- platform: centos
401
- run_command: /usr/sbin/init
402
- - name: 'centos'
403
- driver_plugin: docker
404
- driver:
405
- use_sudo: false
406
- image: centos:7
407
- run_command: /usr/sbin/init
408
-
409
- suites:
410
- - name: base
411
- ```
1
+
2
+ # Puppet Apply Install Options
3
+
4
+ Kitchen-puppet is very flexible in how it installs puppet:
5
+
6
+ It installs it in the following order:
7
+
8
+ * if require_puppet_omnibus is set to true
9
+
10
+ Installs using the omnibus_puppet script and passes the puppet_version if specied as -v option.
11
+
12
+ * If require_puppet_collections is set to true (the default)
13
+
14
+ Installs from the puppet collection.
15
+ This is required if you wish to install puppet version 4 or 5.
16
+
17
+ You get the version of puppet in the collection. To influence which puppet version is install modify either
18
+ * puppet_yum_collections_repo
19
+ * puppet_apt_collections_repo
20
+ to an new collection. At time of writing there are only 2 collections PC1 and puppet5.
21
+
22
+ * if require_puppet_repo is set to true
23
+
24
+ Installs from the operation system repository with the puppet version that is in the particular repository.
25
+
26
+ # Puppet Apply Provisioner Options
27
+
28
+ key | default value | Notes
29
+ ----|---------------|--------
30
+ chef_bootstrap_url | https://www.chef.io/ chef/install.sh | the chef (needed for busser to run tests) NOTE: kitchen 1.4 only requires ruby to run busser so this is not required.
31
+ custom_facts| Hash.new | Hash to set the puppet facts before running puppet apply
32
+ custom_options | | custom options to add to puppet apply command.
33
+ custom_pre_install_command | nil | Custom shell command to be used at beginning of install stage. Can be multiline.
34
+ custom_install_command | nil | Custom shell command to be used at end of install stage. Can be multiline. See examples below.
35
+ custom_pre_apply_command | nil | Custom shell command to be used before the puppet apply stage. Can be multiline. See examples below.
36
+ custom_post_apply_command | nil | Custom shell command to be used after the puppet apply stage. Can be multiline. See examples below.
37
+ facter_file | nil | custom facter_file to be provided to the puppet-apply command
38
+ facter_version | "latest"| desired version, affects apt installs.
39
+ files_path | | directory to place at /tmp/kitchen/files
40
+ fileserver_config_path | | file to place fileserver.conf
41
+ hiera_config_path | hiera.global.yaml then hiera.yaml | path to hiera.yaml
42
+ hiera_data_path | | puppet repo hiera data directory
43
+ hiera_data_remote_path | "/var/lib/hiera" | Hiera data directory on server
44
+ hiera_deep_merge | false | install the deep_merge gem to support hiera deep merge mode
45
+ hiera_eyaml | false | use hiera-eyaml to encrypt hiera data
46
+ hiera_eyaml_gpg | false | use GPG encryption backend for hiera-eyaml
47
+ hiera_eyaml_gpg_recipients | false | recipients eg ehiera/hiera-eyaml-gpg.recipients
48
+ hiera_eyaml_gpg_secring | false | eg hiera/secring.gpg
49
+ hiera_eyaml_gpg_pubring | false | eg hiera/pubring.gpg
50
+ hiera_eyaml_key_remote_path | "/etc/puppet/secure/keys" | directory of hiera-eyaml keys on server
51
+ hiera_eyaml_key_path | "hiera_keys" | directory of hiera-eyaml keys on workstation
52
+ hiera_package | 'hiera-puppet' | Only used if `install_hiera` is set
53
+ hiera_version | "latest"| desired version, affects apt installs.
54
+ hiera_writer_files | | Adds hiera YAML file generation
55
+ http_proxy | nil | use http proxy when installing puppet, packages and running puppet
56
+ https_proxy | nil | use https proxy when installing puppet, packages and running puppet
57
+ ignored_paths_from_root | ['spec'] | allow extra paths to be ignored when copying from puppet repository
58
+ ignore_spec_fixtures | false | don't copy spec/fixtures to avoid problems with symlinks
59
+ install_custom_facts| false | Install custom facts to yaml file at "/tmp/kitchen/facter/kitchen.rb"
60
+ install_hiera | false | Installs `hiera-puppet` package. Not needed for puppet > 3.x.x
61
+ librarian_puppet_ssl_file | nil | ssl certificate file for librarian-puppet
62
+ r10k_ssl_file | nil | ssl certificate file for r10k
63
+ manifest | puppet parses every .pp file in the manifests_path directory and its subdirectories | manifest(s) for puppet apply to run. If set to a file like 'site.pp' it will use the file in the mainfests_path.
64
+ manifests_path | 'mainfests' | puppet repo manifests directory
65
+ max_retries| 1 | maximum number of retry attempts of converge command
66
+ modules_path | | puppet repo manifests directory. Can be multiple directories separated by colons and then they will be merged
67
+ no_proxy | nil | list of URLs or IPs that should be excluded from proxying
68
+ platform | platform_name kitchen.yml parameter | OS platform of server
69
+ puppet_apply_command | nil | Overwrite the puppet apply command. Needs "sudo -E puppet apply" as a prefix.
70
+ puppet_apt_repo | http://apt.puppetlabs.com/ puppetlabs-release-precise.deb | apt repo Ubuntu12 see https://apt.puppetlabs.com for others
71
+ _for Ubuntu14 change to_ | http://apt.puppetlabs.com/ puppetlabs-release-trusty.deb |
72
+ _for Ubuntu15 change to_ | http://apt.puppetlabs.com/ puppetlabs-release-jessie.deb |
73
+ _for Ubuntu16.04 change to_ | http://apt.puppetlabs.com/ puppetlabs-release-xenial.deb |
74
+ puppet_apt_collections_repo | http://apt.puppetlabs.com/ puppet5-release-wheezy.deb | apt collections repo
75
+ _for Ubuntu14 change to_ | http://apt.puppetlabs.com/ puppet5-release-trusty.deb |
76
+ _for Ubuntu15 change to_ | http://apt.puppetlabs.com/ puppet5-release-jessie.deb |
77
+ _for Ubuntu16.04 change to_ | http://apt.puppetlabs.com/ puppet5-release-xenial.deb |
78
+ puppet_binary | 'puppet' | puppet default binary
79
+ puppet_coll_remote_path | "/opt/puppetlabs" | Server Installation location of a puppet collections install.
80
+ puppet_config_path | | path of custom puppet.conf file
81
+ puppet_debug| false| Enable full debugging logging on puppet run
82
+ puppet_detailed_exitcodes | nil | Provide transaction information via exit codes. See `--detailed-exitcodes` section of `puppet help apply`
83
+ puppet_enc | | path for external node classifier script
84
+ puppet_environment | nil | puppet environment for running puppet apply (Must set if using Puppet v4)
85
+ puppet_environment _config_path | "environment.conf" | Puppet environment config file
86
+ puppet_environment _hiera_config_path | "hiera.yaml" | Environment layer hiera config file (see Puppet 4.10), only used if puppet _environmentpath = true
87
+ puppet_environment _remote_hieradata_path | "hieradata" | Path in `puppet_environmentpath_remote_path` to contains the hiera data.
88
+ puppet_environment _remote_modules_path | "modules" | Path in `puppet_environmentpath_remote_path` to contains the modules.
89
+ puppet_environment _remote_manifests_path | "manifests" | Path in `puppet_environmentpath_remote_path` to contains the manifests.
90
+ puppet _environmentpath_remote_path | /etc/puppet/environments (v3), /etc/puppetlabs/code/environments (v4) | The remote path for environments if `puppet_environment` is true
91
+ puppet_future_parser | false | Run puppet with the future parser enabled (see https://docs.puppet.com/ puppet/3.8/experiments_future.html).
92
+ puppet_git_init | nil | initialize puppet from GIT repository, e.g. "git@github.com:example/puppet-repo.git"
93
+ puppet_git_pr | nil | checkout specific Pull Request from repository specified in puppet_git_init, e.g. "324"
94
+ puppet_logdest | nil | _Array_ of log destinations. Include 'console' if wanted
95
+ puppet_omnibus_url | https://raw.githubusercontent.com/ petems/puppet-install-shell/ master/install_puppet_5_agent.sh | omnibus puppet v5 install location.
96
+ _for puppet v3 change to_ | https://raw.githubusercontent.com/ petems/puppet-install-shell/ master/install_puppet.sh |
97
+ _for puppet v4 change to_ | https://raw.githubusercontent.com/ petems/puppet-install-shell/ master/install_puppet_agent.sh |
98
+ puppet_noop| false| puppet runs in a no-op or dry-run mode
99
+ puppet_no_sudo | false | allow puppet command to run without sudo if required
100
+ puppet_verbose| false| Extra information logging on puppet run
101
+ puppet_show_diff| false| Show diffs for changes to config files during puppet runs.
102
+ puppet_version | "latest"| desired version, affects apt and most installs.
103
+ puppet_whitelist_exit_code | nil | Whitelist exit code expected from puppet run. Intended to be used together with `puppet_detailed_exitcodes`. You can also specify a yaml list here (you should use 0 and 2 for `puppet_detailed_exitcodes` to capture puppet runtime errors and allow multiple converge runs (without changes)).
104
+ puppet_yum_repo | https://yum.puppetlabs.com/ puppetlabs-release-el-6.noarch.rpm | yum repo RH/Centos6
105
+ _for RH/Centos7 change to_ | https://yum.puppetlabs.com/ puppetlabs-release-el-7.noarch.rpm |
106
+ puppet_yum_collections_repo | http://yum.puppetlabs.com/ puppet5/puppet-release-el-6.noarch.rpm | yum collections repo RH/Centos6
107
+ _for RH/Centos7 change to_ | http://yum.puppetlabs.com/ puppet5/puppet-release-el-7.noarch.rpm |
108
+ puppetfile_path | | Path to Puppetfile
109
+ remove_puppet_repo | false | remove copy of puppet repository and puppet configuration on server after running puppet
110
+ require_chef_for_busser | true | Install chef as currently needed by busser to run tests
111
+ require_puppet_collections | true | Set if using puppet collections install (Puppet v4)
112
+ require_puppet_omnibus | false | Set if using omnibus puppet install
113
+ require_puppet_repo | true | Set if using a puppet install from yum or apt repo
114
+ resolve_with_librarian_puppet | true | Use librarian_puppet to resolve modules if a Puppetfile is found
115
+ resolve_with_r10k | true | Use r10k to resolve modules if a Puppetfile is found
116
+ retry_on_exit_code| [] | Array of exit codes to retry converge command against
117
+ update_package_repos| true| update OS repository metadata
118
+ wait_for_retry| 30 | number of seconds to wait before retrying converge command
119
+
120
+ ## Puppet Apply Configuring Provisioner Options
121
+
122
+ 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:
123
+
124
+ ```yaml
125
+ ---
126
+ driver:
127
+ name: vagrant
128
+
129
+ provisioner:
130
+ name: puppet_apply
131
+ manifests_path: /repository/puppet_repo/manifests
132
+ modules_path: /repository/puppet_repo/modules-mycompany
133
+ hiera_data_path: /repository/puppet_repo/hieradata
134
+
135
+ platforms:
136
+ - name: nocm_ubuntu-12.04
137
+ driver_plugin: vagrant
138
+ driver_config:
139
+ box: nocm_ubuntu-12.04
140
+ box_url: http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-server-12042-x64-vbox4210-nocm.box
141
+
142
+ suites:
143
+ - name: default
144
+ ```
145
+
146
+ **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
147
+
148
+ ```yaml
149
+ verifier:
150
+ ruby_bindir: '/usr/bin'
151
+ ```
152
+ where /usr/bin is the location of the ruby command.
153
+
154
+ in this example, vagrant will download a box for ubuntu 1204 with no configuration management installed, then install the
155
+ latest puppet and puppet apply against a puppet repo from the /repository/puppet_repo directory using the defailt manifest site.pp
156
+
157
+ To override a setting at the suite-level, specify the setting name under the suite:
158
+
159
+ ```yaml
160
+ suites:
161
+ - name: default
162
+ provisioner:
163
+ manifest: foobar.pp
164
+ ```
165
+
166
+ #### custom_install_command example usage
167
+
168
+ * One liner
169
+ ```yaml
170
+ custom_install_command: yum install -y git
171
+ ```
172
+ * Multiple lines, a.k.a embed shell script
173
+ ```yaml
174
+ custom_install_command: |
175
+ command1
176
+ command2
177
+ ```
178
+ * Multiple lines join without new line
179
+ ```yaml
180
+ custom_install_command: >
181
+ command1 &&
182
+ command2
183
+ ```
184
+
185
+ ### Per-suite Structure
186
+
187
+ It can be beneficial to keep different Puppet layouts for different suites. Rather than having to specify the manifest, modules, etc for each suite, you can create the following directory structure and they will automatically be found:
188
+
189
+ $kitchen_root/puppet/$suite_name/manifests
190
+ $kitchen_root/puppet/$suite_name/modules
191
+ $kitchen_root/puppet/$suite_name/hiera
192
+ $kitchen_root/puppet/$suite_name/hiera.yaml
193
+ $kitchen_root/puppet/$suite_name/Puppetfile
194
+
195
+ ### Puppet Version
196
+ When specifying a puppet version, you must use this format: "3.6.2-1puppetlabs1". I have
197
+ no idea why Puppet versioned their repository with a trailing
198
+ "-1puppetlabs1", but there it is.
199
+
200
+
201
+ ### eyaml
202
+
203
+ See https://puppet.com/blog/encrypt-your-data-using-hiera-eyaml
204
+
205
+ See https://blog.benroberts.net/2014/12/setting-up-hiera-eyaml-gpg for using GPG backend allowing secrets to be protected using asymmetric keys.
206
+
207
+
208
+ # Puppet Agent Provisioner Options
209
+
210
+ key | default value | Notes
211
+ ----|---------------|--------
212
+ puppet_version | "latest"| desired version, affects apt installs.
213
+ facter_version | "latest"| desired version, affects apt installs.
214
+ platform | platform_name kitchen.yml parameter | OS platform of server
215
+ require_puppet_repo | true | Set if using a puppet install from yum or apt repo
216
+ puppet_apt_repo | http://apt.puppetlabs.com/ puppetlabs-release-precise.deb| apt repo
217
+ puppet_yum_repo | https://yum.puppetlabs.com/ puppetlabs-release-el-6.noarch.rpm| yum repo
218
+ require_puppet_omnibus | false | Set if using omnibus puppet install
219
+ puppet_omnibus_url | | omnibus puppet install location.
220
+ puppet_omnibus_remote_path | "/opt/puppet" | Server Installation location of an omnibus puppet install.
221
+ puppet_detailed_exitcodes | nil | Provide transaction information via exit codes.
222
+ puppet_logdest | nil | Where to send messages. Choose between syslog, the console, and a log file.
223
+ puppet_masterport | nil | The port on which to contact the puppet master.
224
+ puppet_environment | nil | The puppet environment to run the agent under
225
+ puppet_test | false | Enable the most common options used for testing.
226
+ puppet_onetime | true | Run the configuration once.
227
+ puppet_no_daemonize | true | Do not send the process into the background.
228
+ puppet_server | nil | will default to 'puppet'. Useful for interactively running when used with the --no-daemonize option.
229
+ puppet_waitforcert | '0' | Time to wait for certificate if agent does not yet have certificates
230
+ puppet_certname | nil | Set the certname (unique ID) of the client
231
+ puppet_digest | nil | Change the certificate fingerprinting digest algorithm. The default is SHA256
232
+ puppet_debug| false| Enable full debugging logging on puppet run
233
+ puppet_verbose| false| Extra information logging on puppet run
234
+ puppet_noop| false| puppet runs in a no-op or dry-run mode
235
+ update_package_repos| true| update OS repository metadata
236
+ custom_facts| Hash.new | Hash to set the puppet facts before running puppet apply
237
+ facterlib | nil | Path for dynamic fact generation, e.g. /etc/puppet/facter . See https://docs.puppetlabs.com/facter/2.2/custom_facts.html
238
+ chef_bootstrap_url |"https://www.chef.io/chef/install.sh"| the chef (needed for busser to run tests)
239
+ puppet_agent_command | nil | Overwrite the puppet agent command. Needs "sudo -E puppet agent" as a prefix.
240
+ require_chef_for_busser | true | Install chef as currently needed by busser to run tests. NOTE: kitchen 1.4 only requires ruby to run busser so this is not required.
241
+ puppet_config_path | | path of custom puppet.conf file
242
+ http_proxy | nil | use http proxy when installing puppet and packages
243
+ https_proxy | nil | use https proxy when installing puppet and packages
244
+ no_proxy | nil | list of URLs or IPs that should be excluded from proxying
245
+ ignore_spec_fixtures | | ignore spec/fixtures directory
246
+
247
+ NOTE: Puppet Collections Support not in puppet agent yet
248
+
249
+ ## Puppet Agent Configuring Provisioner Options
250
+
251
+ 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:
252
+
253
+ ```yaml
254
+ ---
255
+ driver:
256
+ name: vagrant
257
+
258
+ provisioner:
259
+ name: puppet_agent
260
+ puppet_debug: true
261
+ puppet_verbose: true
262
+ puppet_server: puppetmaster-nocm-ubuntu-1204
263
+
264
+ platforms:
265
+ - name: nocm_ubuntu-12.04
266
+ driver_plugin: vagrant
267
+ driver_config:
268
+ box: nocm_ubuntu-12.04
269
+ box_url: http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-server-12042-x64-vbox4210-nocm.box
270
+
271
+ suites:
272
+ - name: default
273
+ ```
274
+
275
+ **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
276
+
277
+ ```yaml
278
+ verifier:
279
+ ruby_bindir: '/usr/bin'
280
+ ```
281
+ where /usr/bin is the location of the ruby command.
282
+
283
+ In this example, vagrant will download a box for ubuntu 1204 with no configuration management installed, then install the latest puppet and run puppet agent against a puppet master at puppetmaster-nocm-ubuntu-1204
284
+
285
+ NOTE: It is important that the server can resolve the hostname ip address of the puppetmaster, in this case puppetmaster-nocm-ubuntu-1204
286
+ and the puppetmaster must be able to resolve the hostname ip address address of the hostname of the node running puppet agent.
287
+ This can be done by settings in the /etc/hosts files before running puppet.
288
+
289
+ NOTE: For testing it is possible to set the puppetmaster to autosign the certificate of a node by created a file /etc/puppet/autosign.conf that contains an *.
290
+
291
+
292
+ To override a setting at the suite-level, specify the setting name under the suite:
293
+
294
+ ```yaml
295
+ suites:
296
+ - name: default
297
+ provisioner:
298
+ manifest: foobar.pp
299
+ ```
300
+
301
+ ## Custom ServerSpec or Beaker Invocation
302
+
303
+ Instead of using the busser use a custom serverspec invocation using [shell verifier](https://github.com/higanworks/kitchen-verifier-shell) to call it.
304
+ With such setup there is no dependency on busser and any other chef library.
305
+
306
+ Also you can specify you tests in a different directory structure or even call [beaker](https://github.com/puppetlabs/beaker) instead of server spec and have tests in beaker structure
307
+
308
+ Using a structure like
309
+ ```yaml
310
+ verifier:
311
+ name: shell
312
+ remote_exec: true
313
+ command: |
314
+ sudo -s <<SERVERSPEC
315
+ cd /opt/gdc/serverspec-core
316
+ export SERVERSPEC_ENV=$EC2DATA_ENVIRONMENT
317
+ export SERVERSPEC_BACKEND=exec
318
+ serverspec junit=true tag=~skip_in_kitchen check:role:$EC2DATA_TYPE
319
+ SERVERSPEC
320
+ ```
321
+
322
+ where `serverspec` is a wrapper around `rake` invocation.
323
+ Use a `Rakefile` similar to one in https://github.com/vincentbernat/serverspec-example.
324
+
325
+ With such approach we can achieve flexibility of running same test suite both in test kitchen and actual, even production, instances.
326
+
327
+ Beware: kitchen-shell-verifier is not yet merged into test-kitchen upstream so using separate gem is unavoidable so far
328
+
329
+ ## Checking puppet apply success (with puppet_detailed_exitcodes)
330
+
331
+ If you do not enable puppet_detailed_exitcodes, the provisioner only failes if the manifest can not be compiled. If the manifest contains errors (some manifests can not be executed) puppet will return exit 0 and thus the provisioner will be successfull, altought your catalog has not been fully applied. Probably this is not what you want.
332
+
333
+ When you enable `puppet_detailed_exitcodes`, you can specify the error conditions to check for with `puppet_whitelist_exit_code` also, otherwise the provisioner will fail altought everything is fine (and changes have been made).
334
+
335
+ Puppet will return with one of the following codes (see https://docs.puppet.com/puppet/latest/man/agent.html) when `puppet_detailed_exitcodes` is true:
336
+
337
+ * 0: The run succeeded with no changes or failures; the system was already in the desired state.
338
+ * 1: The run failed, or wasn't attempted due to another run already in progress.
339
+ * 2: The run succeeded, and some resources were changed.
340
+ * 4: The run succeeded, and some resources failed.
341
+ * 6: The run succeeded, and included both changes and failures.
342
+
343
+ If you enable `puppet_detailed_exitcodes` you should should probably set `puppet_whitelist_exit_code` to 0 and 2
344
+
345
+ ```yaml
346
+ provisioner:
347
+ puppet_detailed_exitcodes: true
348
+ puppet_whitelist_exit_code:
349
+ - 0
350
+ - 2
351
+ ```
352
+
353
+ # Puppet Bolt Provisioner Options
354
+
355
+ key | default value | Notes
356
+ ----|---------------|--------
357
+ bolt_commands | nil | array of bolt commands to run.
358
+ bolt_version | | desired puppet bolt version, defaults to latest.
359
+ custom_pre_install_command | nil | Custom shell command to be used at beginning of install stage. Can be multiline.
360
+ custom_install_command | nil | Custom shell command to be used at end of install stage. Can be multiline. See examples below.
361
+ custom_pre_bolt_command | nil | Custom shell command to be used before the puppet bolt stage. Can be multiline.
362
+ custom_post_bolt_command | nil | Custom shell command to be used after the puppet bolt stage. Can be multiline.
363
+ http_proxy | nil | use http proxy when installing bolt, packages and running bolt
364
+ https_proxy | nil | use https proxy when installing bolt, packages and running bolt
365
+ no_proxy | nil | list of URLs or IPs that should be excluded from proxying
366
+ platform | platform_name kitchen.yml parameter | OS platform of server
367
+ require_bolt_omnibus | false | Set if using omnibus bolt install. (for future use)
368
+ require_bolt_repo | true | Set if using a puppet bolt from yum or apt repo
369
+ remove_bolt_repo | false | remove copy of bolt configuration on server after running bolt
370
+
371
+ ## Puppet Bolt Configuring Provisioner Options
372
+
373
+ The Bolt provisioner can be configured globally or per suite, global settings act as defaults for all suites, you can then customise per suite, for example:
374
+
375
+ ```yaml
376
+ ---
377
+ driver:
378
+ name: docker
379
+ use_sudo: false
380
+ privileged: true
381
+
382
+ provisioner:
383
+ name: puppet_bolt
384
+ bolt_commands:
385
+ - bolt --help
386
+ - bolt --version
387
+
388
+ platforms:
389
+ - name: ubuntu-16.04
390
+ driver_config:
391
+ image: ubuntu:16.04
392
+ platform: ubuntu
393
+ - name: centos-6.6
394
+ driver_config:
395
+ image: centos:6.6
396
+ platform: centos
397
+ - name: centos-7
398
+ driver_config:
399
+ image: centos:latest
400
+ platform: centos
401
+ run_command: /usr/sbin/init
402
+ - name: 'centos'
403
+ driver_plugin: docker
404
+ driver:
405
+ use_sudo: false
406
+ image: centos:7
407
+ run_command: /usr/sbin/init
408
+
409
+ suites:
410
+ - name: base
411
+ ```