kitchen-puppet 1.44.2 → 1.45.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +197 -197
- data/kitchen-puppet.gemspec +35 -35
- data/lib/kitchen-puppet/version.rb +7 -7
- data/lib/kitchen/provisioner/puppet/librarian.rb +80 -80
- data/lib/kitchen/provisioner/puppet_agent.rb +389 -392
- data/lib/kitchen/provisioner/puppet_apply.rb +1204 -1207
- data/provisioner_options.md +292 -292
- metadata +10 -10
data/provisioner_options.md
CHANGED
@@ -1,292 +1,292 @@
|
|
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
|
13
|
-
|
14
|
-
Installs from the puppet collection.
|
15
|
-
This is required if you wish to install puppet version 4.
|
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 was only one collection PC1.
|
21
|
-
|
22
|
-
* if require_puppet_repo is set to true (the default)
|
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.getchef.com/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 | yaml file of custom facter_files 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 | | 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_key_remote_path | "/etc/puppet/secure/keys" | directory of hiera-eyaml keys on server
|
47
|
-
hiera_eyaml_key_path | "hiera_keys" | directory of hiera-eyaml keys on workstation
|
48
|
-
hiera_package | 'hiera-puppet' | Only used if `install_hiera` is set
|
49
|
-
hiera_version | "latest"| desired version, affects apt installs.
|
50
|
-
http_proxy | nil | use http proxy when installing puppet, packages and running puppet
|
51
|
-
https_proxy | nil | use https proxy when installing puppet, packages and running puppet
|
52
|
-
ignored_paths_from_root | [] | allow extra paths to be ignored when copying from puppet repository
|
53
|
-
ignore_spec_fixtures | false | don't copy spec/fixtures to avoid problems with symlinks
|
54
|
-
install_custom_facts| false | Install custom facts to yaml file at "/tmp/kitchen/facter/kitchen.rb"
|
55
|
-
install_hiera | false | Installs `hiera-puppet` package. Not needed for puppet > 3.x.x
|
56
|
-
librarian_puppet_ssl_file | nil | ssl certificate file for librarian-puppet
|
57
|
-
manifest | 'site.pp' | manifest for puppet apply to run
|
58
|
-
manifests_path | | puppet repo manifests directory
|
59
|
-
modules_path | | puppet repo manifests directory. Can be multiple directories separated by colons and then they will be merged
|
60
|
-
platform | platform_name kitchen.yml parameter | OS platform of server
|
61
|
-
puppet_apply_command | nil | Overwrite the puppet apply command. Needs "sudo -E puppet apply" as a prefix.
|
62
|
-
puppet_apt_repo | "http://apt.puppetlabs.com/puppetlabs-release-precise.deb"| apt repo Ubuntu12
|
63
|
-
_for Ubuntu15 change to_ | "http://apt.puppetlabs.com/puppetlabs-release-jessie.deb" |
|
64
|
-
puppet_apt_collections_repo | "http://apt.puppetlabs.com/puppetlabs-release-pc1-wheezy.deb" | apt collections repo
|
65
|
-
_for Ubuntu15 change to_ | "http://apt.puppetlabs.com/puppetlabs-release-pc1-jessie.deb" |
|
66
|
-
puppet_coll_remote_path | "/opt/puppetlabs" | Server Installation location of a puppet collections install.
|
67
|
-
puppet_config_path | | path of custom puppet.conf file
|
68
|
-
puppet_debug| false| Enable full debugging logging on puppet run
|
69
|
-
puppet_detailed_exitcodes | nil | Provide transaction information via exit codes. See `--detailed-exitcodes` section of `puppet help apply`
|
70
|
-
puppet_enc | | path for external node classifier script
|
71
|
-
puppet_environment | nil | puppet environment for running puppet apply (Must set if using Puppet v4)
|
72
|
-
puppet_git_init | nil | initialize puppet from GIT repository, e.g. "git@github.com:example/puppet-repo.git"
|
73
|
-
puppet_git_pr | nil | checkout specific Pull Request from repository specified in puppet_git_init, e.g. "324"
|
74
|
-
puppet_logdest | nil | _Array_ of log destinations. Include 'console' if wanted
|
75
|
-
puppet_omnibus_url | https://raw.githubusercontent.com/ petems/puppet-install-shell/ master/install_puppet.sh | omnibus puppet v3 install location.
|
76
|
-
_for puppet v4 change to_ | https://raw.githubusercontent.com/ petems/puppet-install-shell/ master/install_puppet_agent.sh |
|
77
|
-
puppet_noop| false| puppet runs in a no-op or dry-run mode
|
78
|
-
puppet_no_sudo | false | allow puppet command to run without sudo if required
|
79
|
-
puppet_verbose| false| Extra information logging on puppet run
|
80
|
-
puppet_version | "latest"| desired version, affects apt installs.
|
81
|
-
puppet_whitelist_exit_code | nil | Whitelist exit code expected from puppet run. Intended to be used together with `puppet_detailed_exitcodes`.
|
82
|
-
puppet_yum_repo | "https://yum.puppetlabs.com/puppetlabs-release-el-6.noarch.rpm"| yum repo RH/Centos6
|
83
|
-
_for RH/Centos7 change to_ | "https://yum.puppetlabs.com/puppetlabs-release-el-7.noarch.rpm" |
|
84
|
-
puppet_yum_collections_repo | "http://yum.puppetlabs.com/puppetlabs-release-pc1-el-6.noarch.rpm" | yum collections repo RH/Centos6
|
85
|
-
_for RH/Centos7 change to_ | "https://yum.puppetlabs.com/puppetlabs-release-pc1-el-7.noarch.rpm" |
|
86
|
-
puppetfile_path | | Path to Puppetfile
|
87
|
-
remove_puppet_repo | false | remove copy of puppet repository and puppet configuration on server after running puppet
|
88
|
-
require_chef_for_busser | true | Install chef as currently needed by busser to run tests
|
89
|
-
require_puppet_collections | false | Set if using puppet collections install (Puppet v4)
|
90
|
-
require_puppet_omnibus | false | Set if using omnibus puppet install
|
91
|
-
require_puppet_repo | true | Set if using a puppet install from yum or apt repo
|
92
|
-
resolve_with_librarian_puppet | true | Use librarian_puppet to resolve modules if a Puppetfile is found
|
93
|
-
update_package_repos| true| update OS repository metadata
|
94
|
-
|
95
|
-
## Puppet Apply Configuring Provisioner Options
|
96
|
-
|
97
|
-
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:
|
98
|
-
|
99
|
-
```yaml
|
100
|
-
---
|
101
|
-
driver:
|
102
|
-
name: vagrant
|
103
|
-
|
104
|
-
provisioner:
|
105
|
-
name: puppet_apply
|
106
|
-
manifests_path: /repository/puppet_repo/manifests
|
107
|
-
modules_path: /repository/puppet_repo/modules-mycompany
|
108
|
-
hiera_data_path: /repository/puppet_repo/hieradata
|
109
|
-
|
110
|
-
platforms:
|
111
|
-
- name: nocm_ubuntu-12.04
|
112
|
-
driver_plugin: vagrant
|
113
|
-
driver_config:
|
114
|
-
box: nocm_ubuntu-12.04
|
115
|
-
box_url: http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-server-12042-x64-vbox4210-nocm.box
|
116
|
-
|
117
|
-
suites:
|
118
|
-
- name: default
|
119
|
-
```
|
120
|
-
|
121
|
-
**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
|
122
|
-
|
123
|
-
```yaml
|
124
|
-
verifier:
|
125
|
-
ruby_bindir: '/usr/bin'
|
126
|
-
```
|
127
|
-
where /usr/bin is the location of the ruby command.
|
128
|
-
|
129
|
-
in this example, vagrant will download a box for ubuntu 1204 with no configuration management installed, then install the
|
130
|
-
latest puppet and puppet apply against a puppet repo from the /repository/puppet_repo directory using the defailt manifest site.pp
|
131
|
-
|
132
|
-
To override a setting at the suite-level, specify the setting name under the suite:
|
133
|
-
|
134
|
-
```yaml
|
135
|
-
suites:
|
136
|
-
- name: default
|
137
|
-
provisioner:
|
138
|
-
manifest: foobar.pp
|
139
|
-
```
|
140
|
-
|
141
|
-
#### custom_install_command example usage
|
142
|
-
|
143
|
-
* One liner
|
144
|
-
```yaml
|
145
|
-
custom_install_command: yum install -y git
|
146
|
-
```
|
147
|
-
* Multiple lines, a.k.a embed shell script
|
148
|
-
```yaml
|
149
|
-
custom_install_command: |
|
150
|
-
command1
|
151
|
-
command2
|
152
|
-
```
|
153
|
-
* Multiple lines join without new line
|
154
|
-
```yaml
|
155
|
-
custom_install_command: >
|
156
|
-
command1 &&
|
157
|
-
command2
|
158
|
-
```
|
159
|
-
|
160
|
-
### Per-suite Structure
|
161
|
-
|
162
|
-
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:
|
163
|
-
|
164
|
-
$kitchen_root/puppet/$suite_name/manifests
|
165
|
-
$kitchen_root/puppet/$suite_name/modules
|
166
|
-
$kitchen_root/puppet/$suite_name/hiera
|
167
|
-
$kitchen_root/puppet/$suite_name/hiera.yaml
|
168
|
-
$kitchen_root/puppet/$suite_name/Puppetfile
|
169
|
-
|
170
|
-
### Puppet Version
|
171
|
-
When specifying a puppet version, you must use this format: "3.6.2-1puppetlabs1". I have
|
172
|
-
no idea why Puppet versioned their repository with a trailing
|
173
|
-
"-1puppetlabs1", but there it is.
|
174
|
-
|
175
|
-
|
176
|
-
# Puppet Agent Provisioner Options
|
177
|
-
|
178
|
-
key | default value | Notes
|
179
|
-
----|---------------|--------
|
180
|
-
puppet_version | "latest"| desired version, affects apt installs.
|
181
|
-
facter_version | "latest"| desired version, affects apt installs.
|
182
|
-
platform | platform_name kitchen.yml parameter | OS platform of server
|
183
|
-
require_puppet_repo | true | Set if using a puppet install from yum or apt repo
|
184
|
-
puppet_apt_repo | "http://apt.puppetlabs.com/puppetlabs-release-precise.deb"| apt repo
|
185
|
-
puppet_yum_repo | "https://yum.puppetlabs.com/puppetlabs-release-el-6.noarch.rpm"| yum repo
|
186
|
-
require_puppet_omnibus | false | Set if using omnibus puppet install
|
187
|
-
puppet_omnibus_url | | omnibus puppet install location.
|
188
|
-
puppet_omnibus_remote_path | "/opt/puppet" | Server Installation location of an omnibus puppet install.
|
189
|
-
puppet_detailed_exitcodes | nil | Provide transaction information via exit codes.
|
190
|
-
puppet_logdest | nil | Where to send messages. Choose between syslog, the console, and a log file.
|
191
|
-
puppet_masterport | nil | The port on which to contact the puppet master.
|
192
|
-
puppet_test | false | Enable the most common options used for testing.
|
193
|
-
puppet_onetime | true | Run the configuration once.
|
194
|
-
puppet_no_daemonize | true | Do not send the process into the background.
|
195
|
-
puppet_server | nil | will default to 'puppet'. Useful for interactively running when used with the --no-daemonize option.
|
196
|
-
puppet_waitforcert | '0' | Time to wait for certificate if agent does not yet have certificates
|
197
|
-
puppet_certname | nil | Set the certname (unique ID) of the client
|
198
|
-
puppet_digest | nil | Change the certificate fingerprinting digest algorithm. The default is SHA256
|
199
|
-
puppet_debug| false| Enable full debugging logging on puppet run
|
200
|
-
puppet_verbose| false| Extra information logging on puppet run
|
201
|
-
puppet_noop| false| puppet runs in a no-op or dry-run mode
|
202
|
-
update_package_repos| true| update OS repository metadata
|
203
|
-
custom_facts| Hash.new | Hash to set the puppet facts before running puppet apply
|
204
|
-
facterlib | nil | Path for dynamic fact generation, e.g. /etc/puppet/facter . See https://docs.puppetlabs.com/facter/2.2/custom_facts.html
|
205
|
-
chef_bootstrap_url |"https://www.getchef.com/chef/install.sh"| the chef (needed for busser to run tests)
|
206
|
-
puppet_agent_command | nil | Overwrite the puppet agent command. Needs "sudo -E puppet agent" as a prefix.
|
207
|
-
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.
|
208
|
-
puppet_config_path | | path of custom puppet.conf file
|
209
|
-
http_proxy | nil | use http proxy when installing puppet and packages
|
210
|
-
ignore_spec_fixtures | | ignore spec/fixtures directory
|
211
|
-
|
212
|
-
NOTE: Puppet Collections Support not in puppet agent yet
|
213
|
-
|
214
|
-
## Puppet Agent Configuring Provisioner Options
|
215
|
-
|
216
|
-
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:
|
217
|
-
|
218
|
-
```yaml
|
219
|
-
---
|
220
|
-
driver:
|
221
|
-
name: vagrant
|
222
|
-
|
223
|
-
provisioner:
|
224
|
-
name: puppet_agent
|
225
|
-
puppet_debug: true
|
226
|
-
puppet_verbose: true
|
227
|
-
puppet_server: puppetmaster-nocm-ubuntu-1204
|
228
|
-
|
229
|
-
platforms:
|
230
|
-
- name: nocm_ubuntu-12.04
|
231
|
-
driver_plugin: vagrant
|
232
|
-
driver_config:
|
233
|
-
box: nocm_ubuntu-12.04
|
234
|
-
box_url: http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-server-12042-x64-vbox4210-nocm.box
|
235
|
-
|
236
|
-
suites:
|
237
|
-
- name: default
|
238
|
-
```
|
239
|
-
|
240
|
-
**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
|
241
|
-
|
242
|
-
```yaml
|
243
|
-
verifier:
|
244
|
-
ruby_bindir: '/usr/bin'
|
245
|
-
```
|
246
|
-
where /usr/bin is the location of the ruby command.
|
247
|
-
|
248
|
-
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
|
249
|
-
|
250
|
-
NOTE: It is important that the server can resolve the hostname ip address of the puppetmaster, in this case puppetmaster-nocm-ubuntu-1204
|
251
|
-
and the puppetmaster must be able to resolve the hostname ip address address of the hostname of the node running puppet agent.
|
252
|
-
This can be done by settings in the /etc/hosts files before running puppet.
|
253
|
-
|
254
|
-
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 *.
|
255
|
-
|
256
|
-
|
257
|
-
To override a setting at the suite-level, specify the setting name under the suite:
|
258
|
-
|
259
|
-
```yaml
|
260
|
-
suites:
|
261
|
-
- name: default
|
262
|
-
provisioner:
|
263
|
-
manifest: foobar.pp
|
264
|
-
```
|
265
|
-
|
266
|
-
## Custom ServerSpec or Beaker Invocation
|
267
|
-
|
268
|
-
Instead of using the busser use a custom serverspec invocation using [shell verifier](https://github.com/higanworks/kitchen-verifier-shell) to call it.
|
269
|
-
With such setup there is no dependency on busser and any other chef library.
|
270
|
-
|
271
|
-
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
|
272
|
-
|
273
|
-
Using a structure like
|
274
|
-
```yaml
|
275
|
-
verifier:
|
276
|
-
name: shell
|
277
|
-
remote_exec: true
|
278
|
-
command: |
|
279
|
-
sudo -s <<SERVERSPEC
|
280
|
-
cd /opt/gdc/serverspec-core
|
281
|
-
export SERVERSPEC_ENV=$EC2DATA_ENVIRONMENT
|
282
|
-
export SERVERSPEC_BACKEND=exec
|
283
|
-
serverspec junit=true tag=~skip_in_kitchen check:role:$EC2DATA_TYPE
|
284
|
-
SERVERSPEC
|
285
|
-
```
|
286
|
-
|
287
|
-
where `serverspec` is a wrapper around `rake` invocation.
|
288
|
-
Use a `Rakefile` similar to one in https://github.com/vincentbernat/serverspec-example.
|
289
|
-
|
290
|
-
With such approach we can achieve flexibility of running same test suite both in test kitchen and actual, even production, instances.
|
291
|
-
|
292
|
-
Beware: kitchen-shell-verifier is not yet merged into test-kitchen upstream so using separate gem is unavoidable so far
|
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
|
13
|
+
|
14
|
+
Installs from the puppet collection.
|
15
|
+
This is required if you wish to install puppet version 4.
|
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 was only one collection PC1.
|
21
|
+
|
22
|
+
* if require_puppet_repo is set to true (the default)
|
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.getchef.com/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 | yaml file of custom facter_files 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 | | 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_key_remote_path | "/etc/puppet/secure/keys" | directory of hiera-eyaml keys on server
|
47
|
+
hiera_eyaml_key_path | "hiera_keys" | directory of hiera-eyaml keys on workstation
|
48
|
+
hiera_package | 'hiera-puppet' | Only used if `install_hiera` is set
|
49
|
+
hiera_version | "latest"| desired version, affects apt installs.
|
50
|
+
http_proxy | nil | use http proxy when installing puppet, packages and running puppet
|
51
|
+
https_proxy | nil | use https proxy when installing puppet, packages and running puppet
|
52
|
+
ignored_paths_from_root | ['spec'] | allow extra paths to be ignored when copying from puppet repository
|
53
|
+
ignore_spec_fixtures | false | don't copy spec/fixtures to avoid problems with symlinks
|
54
|
+
install_custom_facts| false | Install custom facts to yaml file at "/tmp/kitchen/facter/kitchen.rb"
|
55
|
+
install_hiera | false | Installs `hiera-puppet` package. Not needed for puppet > 3.x.x
|
56
|
+
librarian_puppet_ssl_file | nil | ssl certificate file for librarian-puppet
|
57
|
+
manifest | 'site.pp' | manifest for puppet apply to run
|
58
|
+
manifests_path | | puppet repo manifests directory
|
59
|
+
modules_path | | puppet repo manifests directory. Can be multiple directories separated by colons and then they will be merged
|
60
|
+
platform | platform_name kitchen.yml parameter | OS platform of server
|
61
|
+
puppet_apply_command | nil | Overwrite the puppet apply command. Needs "sudo -E puppet apply" as a prefix.
|
62
|
+
puppet_apt_repo | "http://apt.puppetlabs.com/puppetlabs-release-precise.deb"| apt repo Ubuntu12
|
63
|
+
_for Ubuntu15 change to_ | "http://apt.puppetlabs.com/puppetlabs-release-jessie.deb" |
|
64
|
+
puppet_apt_collections_repo | "http://apt.puppetlabs.com/puppetlabs-release-pc1-wheezy.deb" | apt collections repo
|
65
|
+
_for Ubuntu15 change to_ | "http://apt.puppetlabs.com/puppetlabs-release-pc1-jessie.deb" |
|
66
|
+
puppet_coll_remote_path | "/opt/puppetlabs" | Server Installation location of a puppet collections install.
|
67
|
+
puppet_config_path | | path of custom puppet.conf file
|
68
|
+
puppet_debug| false| Enable full debugging logging on puppet run
|
69
|
+
puppet_detailed_exitcodes | nil | Provide transaction information via exit codes. See `--detailed-exitcodes` section of `puppet help apply`
|
70
|
+
puppet_enc | | path for external node classifier script
|
71
|
+
puppet_environment | nil | puppet environment for running puppet apply (Must set if using Puppet v4)
|
72
|
+
puppet_git_init | nil | initialize puppet from GIT repository, e.g. "git@github.com:example/puppet-repo.git"
|
73
|
+
puppet_git_pr | nil | checkout specific Pull Request from repository specified in puppet_git_init, e.g. "324"
|
74
|
+
puppet_logdest | nil | _Array_ of log destinations. Include 'console' if wanted
|
75
|
+
puppet_omnibus_url | https://raw.githubusercontent.com/ petems/puppet-install-shell/ master/install_puppet.sh | omnibus puppet v3 install location.
|
76
|
+
_for puppet v4 change to_ | https://raw.githubusercontent.com/ petems/puppet-install-shell/ master/install_puppet_agent.sh |
|
77
|
+
puppet_noop| false| puppet runs in a no-op or dry-run mode
|
78
|
+
puppet_no_sudo | false | allow puppet command to run without sudo if required
|
79
|
+
puppet_verbose| false| Extra information logging on puppet run
|
80
|
+
puppet_version | "latest"| desired version, affects apt installs.
|
81
|
+
puppet_whitelist_exit_code | nil | Whitelist exit code expected from puppet run. Intended to be used together with `puppet_detailed_exitcodes`.
|
82
|
+
puppet_yum_repo | "https://yum.puppetlabs.com/puppetlabs-release-el-6.noarch.rpm"| yum repo RH/Centos6
|
83
|
+
_for RH/Centos7 change to_ | "https://yum.puppetlabs.com/puppetlabs-release-el-7.noarch.rpm" |
|
84
|
+
puppet_yum_collections_repo | "http://yum.puppetlabs.com/puppetlabs-release-pc1-el-6.noarch.rpm" | yum collections repo RH/Centos6
|
85
|
+
_for RH/Centos7 change to_ | "https://yum.puppetlabs.com/puppetlabs-release-pc1-el-7.noarch.rpm" |
|
86
|
+
puppetfile_path | | Path to Puppetfile
|
87
|
+
remove_puppet_repo | false | remove copy of puppet repository and puppet configuration on server after running puppet
|
88
|
+
require_chef_for_busser | true | Install chef as currently needed by busser to run tests
|
89
|
+
require_puppet_collections | false | Set if using puppet collections install (Puppet v4)
|
90
|
+
require_puppet_omnibus | false | Set if using omnibus puppet install
|
91
|
+
require_puppet_repo | true | Set if using a puppet install from yum or apt repo
|
92
|
+
resolve_with_librarian_puppet | true | Use librarian_puppet to resolve modules if a Puppetfile is found
|
93
|
+
update_package_repos| true| update OS repository metadata
|
94
|
+
|
95
|
+
## Puppet Apply Configuring Provisioner Options
|
96
|
+
|
97
|
+
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:
|
98
|
+
|
99
|
+
```yaml
|
100
|
+
---
|
101
|
+
driver:
|
102
|
+
name: vagrant
|
103
|
+
|
104
|
+
provisioner:
|
105
|
+
name: puppet_apply
|
106
|
+
manifests_path: /repository/puppet_repo/manifests
|
107
|
+
modules_path: /repository/puppet_repo/modules-mycompany
|
108
|
+
hiera_data_path: /repository/puppet_repo/hieradata
|
109
|
+
|
110
|
+
platforms:
|
111
|
+
- name: nocm_ubuntu-12.04
|
112
|
+
driver_plugin: vagrant
|
113
|
+
driver_config:
|
114
|
+
box: nocm_ubuntu-12.04
|
115
|
+
box_url: http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-server-12042-x64-vbox4210-nocm.box
|
116
|
+
|
117
|
+
suites:
|
118
|
+
- name: default
|
119
|
+
```
|
120
|
+
|
121
|
+
**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
|
122
|
+
|
123
|
+
```yaml
|
124
|
+
verifier:
|
125
|
+
ruby_bindir: '/usr/bin'
|
126
|
+
```
|
127
|
+
where /usr/bin is the location of the ruby command.
|
128
|
+
|
129
|
+
in this example, vagrant will download a box for ubuntu 1204 with no configuration management installed, then install the
|
130
|
+
latest puppet and puppet apply against a puppet repo from the /repository/puppet_repo directory using the defailt manifest site.pp
|
131
|
+
|
132
|
+
To override a setting at the suite-level, specify the setting name under the suite:
|
133
|
+
|
134
|
+
```yaml
|
135
|
+
suites:
|
136
|
+
- name: default
|
137
|
+
provisioner:
|
138
|
+
manifest: foobar.pp
|
139
|
+
```
|
140
|
+
|
141
|
+
#### custom_install_command example usage
|
142
|
+
|
143
|
+
* One liner
|
144
|
+
```yaml
|
145
|
+
custom_install_command: yum install -y git
|
146
|
+
```
|
147
|
+
* Multiple lines, a.k.a embed shell script
|
148
|
+
```yaml
|
149
|
+
custom_install_command: |
|
150
|
+
command1
|
151
|
+
command2
|
152
|
+
```
|
153
|
+
* Multiple lines join without new line
|
154
|
+
```yaml
|
155
|
+
custom_install_command: >
|
156
|
+
command1 &&
|
157
|
+
command2
|
158
|
+
```
|
159
|
+
|
160
|
+
### Per-suite Structure
|
161
|
+
|
162
|
+
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:
|
163
|
+
|
164
|
+
$kitchen_root/puppet/$suite_name/manifests
|
165
|
+
$kitchen_root/puppet/$suite_name/modules
|
166
|
+
$kitchen_root/puppet/$suite_name/hiera
|
167
|
+
$kitchen_root/puppet/$suite_name/hiera.yaml
|
168
|
+
$kitchen_root/puppet/$suite_name/Puppetfile
|
169
|
+
|
170
|
+
### Puppet Version
|
171
|
+
When specifying a puppet version, you must use this format: "3.6.2-1puppetlabs1". I have
|
172
|
+
no idea why Puppet versioned their repository with a trailing
|
173
|
+
"-1puppetlabs1", but there it is.
|
174
|
+
|
175
|
+
|
176
|
+
# Puppet Agent Provisioner Options
|
177
|
+
|
178
|
+
key | default value | Notes
|
179
|
+
----|---------------|--------
|
180
|
+
puppet_version | "latest"| desired version, affects apt installs.
|
181
|
+
facter_version | "latest"| desired version, affects apt installs.
|
182
|
+
platform | platform_name kitchen.yml parameter | OS platform of server
|
183
|
+
require_puppet_repo | true | Set if using a puppet install from yum or apt repo
|
184
|
+
puppet_apt_repo | "http://apt.puppetlabs.com/puppetlabs-release-precise.deb"| apt repo
|
185
|
+
puppet_yum_repo | "https://yum.puppetlabs.com/puppetlabs-release-el-6.noarch.rpm"| yum repo
|
186
|
+
require_puppet_omnibus | false | Set if using omnibus puppet install
|
187
|
+
puppet_omnibus_url | | omnibus puppet install location.
|
188
|
+
puppet_omnibus_remote_path | "/opt/puppet" | Server Installation location of an omnibus puppet install.
|
189
|
+
puppet_detailed_exitcodes | nil | Provide transaction information via exit codes.
|
190
|
+
puppet_logdest | nil | Where to send messages. Choose between syslog, the console, and a log file.
|
191
|
+
puppet_masterport | nil | The port on which to contact the puppet master.
|
192
|
+
puppet_test | false | Enable the most common options used for testing.
|
193
|
+
puppet_onetime | true | Run the configuration once.
|
194
|
+
puppet_no_daemonize | true | Do not send the process into the background.
|
195
|
+
puppet_server | nil | will default to 'puppet'. Useful for interactively running when used with the --no-daemonize option.
|
196
|
+
puppet_waitforcert | '0' | Time to wait for certificate if agent does not yet have certificates
|
197
|
+
puppet_certname | nil | Set the certname (unique ID) of the client
|
198
|
+
puppet_digest | nil | Change the certificate fingerprinting digest algorithm. The default is SHA256
|
199
|
+
puppet_debug| false| Enable full debugging logging on puppet run
|
200
|
+
puppet_verbose| false| Extra information logging on puppet run
|
201
|
+
puppet_noop| false| puppet runs in a no-op or dry-run mode
|
202
|
+
update_package_repos| true| update OS repository metadata
|
203
|
+
custom_facts| Hash.new | Hash to set the puppet facts before running puppet apply
|
204
|
+
facterlib | nil | Path for dynamic fact generation, e.g. /etc/puppet/facter . See https://docs.puppetlabs.com/facter/2.2/custom_facts.html
|
205
|
+
chef_bootstrap_url |"https://www.getchef.com/chef/install.sh"| the chef (needed for busser to run tests)
|
206
|
+
puppet_agent_command | nil | Overwrite the puppet agent command. Needs "sudo -E puppet agent" as a prefix.
|
207
|
+
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.
|
208
|
+
puppet_config_path | | path of custom puppet.conf file
|
209
|
+
http_proxy | nil | use http proxy when installing puppet and packages
|
210
|
+
ignore_spec_fixtures | | ignore spec/fixtures directory
|
211
|
+
|
212
|
+
NOTE: Puppet Collections Support not in puppet agent yet
|
213
|
+
|
214
|
+
## Puppet Agent Configuring Provisioner Options
|
215
|
+
|
216
|
+
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:
|
217
|
+
|
218
|
+
```yaml
|
219
|
+
---
|
220
|
+
driver:
|
221
|
+
name: vagrant
|
222
|
+
|
223
|
+
provisioner:
|
224
|
+
name: puppet_agent
|
225
|
+
puppet_debug: true
|
226
|
+
puppet_verbose: true
|
227
|
+
puppet_server: puppetmaster-nocm-ubuntu-1204
|
228
|
+
|
229
|
+
platforms:
|
230
|
+
- name: nocm_ubuntu-12.04
|
231
|
+
driver_plugin: vagrant
|
232
|
+
driver_config:
|
233
|
+
box: nocm_ubuntu-12.04
|
234
|
+
box_url: http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-server-12042-x64-vbox4210-nocm.box
|
235
|
+
|
236
|
+
suites:
|
237
|
+
- name: default
|
238
|
+
```
|
239
|
+
|
240
|
+
**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
|
241
|
+
|
242
|
+
```yaml
|
243
|
+
verifier:
|
244
|
+
ruby_bindir: '/usr/bin'
|
245
|
+
```
|
246
|
+
where /usr/bin is the location of the ruby command.
|
247
|
+
|
248
|
+
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
|
249
|
+
|
250
|
+
NOTE: It is important that the server can resolve the hostname ip address of the puppetmaster, in this case puppetmaster-nocm-ubuntu-1204
|
251
|
+
and the puppetmaster must be able to resolve the hostname ip address address of the hostname of the node running puppet agent.
|
252
|
+
This can be done by settings in the /etc/hosts files before running puppet.
|
253
|
+
|
254
|
+
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 *.
|
255
|
+
|
256
|
+
|
257
|
+
To override a setting at the suite-level, specify the setting name under the suite:
|
258
|
+
|
259
|
+
```yaml
|
260
|
+
suites:
|
261
|
+
- name: default
|
262
|
+
provisioner:
|
263
|
+
manifest: foobar.pp
|
264
|
+
```
|
265
|
+
|
266
|
+
## Custom ServerSpec or Beaker Invocation
|
267
|
+
|
268
|
+
Instead of using the busser use a custom serverspec invocation using [shell verifier](https://github.com/higanworks/kitchen-verifier-shell) to call it.
|
269
|
+
With such setup there is no dependency on busser and any other chef library.
|
270
|
+
|
271
|
+
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
|
272
|
+
|
273
|
+
Using a structure like
|
274
|
+
```yaml
|
275
|
+
verifier:
|
276
|
+
name: shell
|
277
|
+
remote_exec: true
|
278
|
+
command: |
|
279
|
+
sudo -s <<SERVERSPEC
|
280
|
+
cd /opt/gdc/serverspec-core
|
281
|
+
export SERVERSPEC_ENV=$EC2DATA_ENVIRONMENT
|
282
|
+
export SERVERSPEC_BACKEND=exec
|
283
|
+
serverspec junit=true tag=~skip_in_kitchen check:role:$EC2DATA_TYPE
|
284
|
+
SERVERSPEC
|
285
|
+
```
|
286
|
+
|
287
|
+
where `serverspec` is a wrapper around `rake` invocation.
|
288
|
+
Use a `Rakefile` similar to one in https://github.com/vincentbernat/serverspec-example.
|
289
|
+
|
290
|
+
With such approach we can achieve flexibility of running same test suite both in test kitchen and actual, even production, instances.
|
291
|
+
|
292
|
+
Beware: kitchen-shell-verifier is not yet merged into test-kitchen upstream so using separate gem is unavoidable so far
|