You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+19-19Lines changed: 19 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -155,14 +155,14 @@ Here follows an example of tp resources used inside a custom profile where the c
155
155
156
156
# Configuration of sshd_config server configuration file (main config file)
157
157
tp::conf { 'openssh':
158
-
template => $server_template,
159
-
options_hash => $options,
158
+
template => $server_template,
159
+
my_options => $options,
160
160
}
161
161
162
162
# Configuration of ssh_config client configuration file
163
163
tp::conf { 'openssh::ssh_config':
164
-
template => $client_template,
165
-
options_hash => $options,
164
+
template => $client_template,
165
+
my_options => $options,
166
166
}
167
167
}
168
168
@@ -191,11 +191,11 @@ Install an application with default settings (package installed, service started
191
191
192
192
tp::install { 'redis': }
193
193
194
-
Configure the application main configuration file a custom erb template which uses data from a custom $options_hash:
194
+
Configure the application main configuration file a custom erb template which uses data from a custom $my_options:
195
195
196
196
tp::conf { 'rsyslog':
197
-
template => 'site/rsyslog/rsyslog.conf.erb',
198
-
options_hash => lookup('rsyslog::options_hash'),
197
+
template => 'site/rsyslog/rsyslog.conf.erb',
198
+
my_options => lookup('rsyslog::my_options'),
199
199
}
200
200
201
201
Populate any custom directory from a Git repository (it requires Puppet Labs' vcsrepo module):
@@ -225,7 +225,7 @@ Other parameters are available to manage integrations:
225
225
-**puppi_enable** Default: false. Installs [Puppi](https://github.com/example42/puppi) and enables puppi integration.
226
226
-**test_enable** Default: false. If to enable automatic testing of the managed application.
227
227
-**test_template** Default: undef. If provided, the provided erb template is used to test the application (instead of default tests).
228
-
-**options_hash** Default: {}. An optional hash where to set variable to use in test_template.
228
+
-**my_options** Default: {}. An optional hash where to set variable to use in test_template.
229
229
230
230
Some specific params are to handle repos:
231
231
@@ -239,7 +239,7 @@ These parameters allow to skip management of packages or services:
239
239
240
240
Some parameters allow to configure tp::conf and tp::dir resources directly from tp::install (inheriting the same settings and options):
241
241
242
-
-**conf_hash**. Default: { }. A hash of tp::conf resources to create. These resources will refer to the same application specified in the tp::install $title and inherits the settings ensure, settings_hash, options_hash and data_module
242
+
-**conf_hash**. Default: { }. A hash of tp::conf resources to create. These resources will refer to the same application specified in the tp::install $title and inherits the settings ensure, settings_hash, my_options and data_module
243
243
-**dir_hash**. Default: { }. A hash of tp::dir resources to create, as for the conf one.
244
244
245
245
Parameters are also available to customise the tiny data settings which affect package and service names, repos settings, file paths and so on. The params are common to all the tp defines, check [Updating tiny data and using alternative data sources](#Updating-tiny-data-and-using-alternative-data-sources) section for details.
@@ -253,7 +253,7 @@ An example with a custom test for the rabbitmq service:
It's possible to specify the version of the package to install (the provided version must be available in the configured repos):
@@ -294,16 +294,16 @@ It's possible to manage files with different methods, for example directly provi
294
294
or providing a custom template with custom options:
295
295
296
296
tp::conf { 'openssh::ssh_config':
297
-
template => 'profile/openssh/ssh_config.erb',
298
-
options_hash => {
297
+
template => 'profile/openssh/ssh_config.erb',
298
+
my_options => {
299
299
UsePAM => 'yes',
300
300
X11Forwarding => 'no',
301
301
}
302
302
}
303
303
304
304
Via the template parameter with can both specify files .erb suffix (used as `content => template($template)`) or with .epp suffix (used as `content => epp($template)`). If not .erb or .epp suffix is present in the template value, then it's treates as and erb (`content => template($template)`).
305
305
306
-
In the profile/templates/openssh/ssh_config.erb template you will have the contents you want and use the above options with something like (note you can use both the @options and the @options_hash variable):
306
+
In the profile/templates/openssh/ssh_config.erb template you will have the contents you want and use the above options with something like (note you can use both the @options and the @my_options variable):
307
307
308
308
[...]
309
309
UsePAM <%= @options['UsePAM'] %>
@@ -323,10 +323,10 @@ also it's possible to provide the source to use, instead of managing it with the
323
323
'puppet:///modules/site/redis/redis.conf' ] ,
324
324
}
325
325
326
-
For applications for which it exists the setting 'config_file_format' you can just pass the hash of options_hash of settings to configure and tp::conf creates a valid configuration file for the application:
326
+
For applications for which it exists the setting 'config_file_format' you can just pass the hash of my_options of settings to configure and tp::conf creates a valid configuration file for the application:
327
327
328
328
tp::conf { 'filebeat':
329
-
options_hash => {
329
+
my_options => {
330
330
filebeat.modules => ['module: system']
331
331
syslog => {
332
332
enabled => true,
@@ -339,7 +339,7 @@ This example makes much more sense if based on Hiera data (see [Configuring tp r
339
339
340
340
tp::conf_hash:
341
341
filebeat:
342
-
options_hash:
342
+
my_options:
343
343
filebeat.modules:
344
344
- module: system
345
345
syslog:
@@ -530,15 +530,15 @@ Or you can use a specific `tp::test` define:
530
530
531
531
tp::test { 'rabbitmq':
532
532
template => 'profile/rabbimq/tptest.erb',
533
-
options_hash => {
533
+
my_options => {
534
534
port => '11111',
535
535
host => 'localhost',
536
536
},
537
537
}
538
538
539
-
All the keys set via the $options_hash parameter can be used in the erb template with sopmething like:
539
+
All the keys set via the $my_options parameter can be used in the erb template with sopmething like:
540
540
541
-
port_to_check=<%= @options_hash['port'] >
541
+
port_to_check=<%= @my_options['port'] >
542
542
543
543
The `tp::test` define has the following parameters to manage the content of the test script (placed under `/etc/tp/test/$title`):
[root@centos7-p4 ~]# vi /vagrant/modules_local/site/templates/nginx/nginx.conf.erb
13
13
14
-
You can pass an hash of custom key/values using the ```options_hash``` parameter:
14
+
You can pass an hash of custom key/values using the ```my_options``` parameter:
15
15
16
16
$nginx_options = {
17
17
'worker_processes' => '12',
18
18
'worker_connections' => '512',
19
19
}
20
20
tp::conf { 'nginx':
21
-
template => 'site/nginx/nginx.conf.erb',
22
-
options_hash => $nginx_options,
21
+
template => 'site/nginx/nginx.conf.erb',
22
+
my_options => $nginx_options,
23
23
}
24
24
25
25
An then, in your ```$modulepath/site/templates/ningx/nginx.conf.erb``` have something like:
@@ -35,7 +35,7 @@ An then, in your ```$modulepath/site/templates/ningx/nginx.conf.erb``` have some
35
35
multi_accept on;
36
36
}
37
37
38
-
Some explanations are needed here. Your ```options_hash``` parameter is accessed, in the erb file, via the ```@options``` variable (You can use also ```@options_hash```) because in ```tp::conf``` we plan to merge the values from @options_hash to a set of default options (compliant with the underlying OS).
38
+
Some explanations are needed here. Your ```my_options``` parameter is accessed, in the erb file, via the ```@options``` variable (You can use also ```@my_options```) because in ```tp::conf``` we plan to merge the values from @my_options to a set of default options (compliant with the underlying OS).
39
39
You have at disposal also the ```@settings``` hash which contains OS specific data for the managed application. To have an idea of what kind of data we provide for each supported application check in [```data/nginx/default.yaml```](https://github.com/example42/puppet-tp/blob/master/data/nginx/default.yaml).
40
40
41
41
There are many options in ```tp::conf``` that let you manage every aspect of your configurations, for example we can manage its permissions, how to populate its content (with static source, epp or erb templates, plain content...), if to trigger a service restart when the files changes (by default the relevant service, if present, is restarted) and so on.
Copy file name to clipboardExpand all lines: manifests/conf.pp
+3-3Lines changed: 3 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -181,7 +181,7 @@
181
181
# app that can be used in the provided erb or epp templates respectively as
182
182
# @options_hash['key'] or $options_hash['key'],
183
183
#
184
-
# @param settings_hash An hash that can override the application settings tp
184
+
# @param my_settings An hash that can override the application settings tp
185
185
# returns, according to the underlying Operating System and the default
186
186
# behaviour.
187
187
#
@@ -256,10 +256,10 @@
256
256
) {
257
257
# Deprecations
258
258
if$settings_hash != {} {
259
-
deprecation('settings_hash', 'Replace with my_settings')
259
+
tp::fail($on_missing_data, "Module ${caller_module_name} needs updates: Parameter settings_hash in tp::conf is deprecated, replace it with my_settings")
260
260
}
261
261
if$options_hash != {} {
262
-
deprecation('options_hash', 'Replace with my_options')
262
+
tp::fail($on_missing_data, "Module ${caller_module_name} needs updates: Parameter options_hash in tp::conf is deprecated, replace it with my_options")
Copy file name to clipboardExpand all lines: manifests/dir.pp
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -175,7 +175,7 @@
175
175
) {
176
176
# Deprecations
177
177
if$settings_hash != {} {
178
-
deprecation('settings_hash', 'Replace with my_settings')
178
+
tp::fail($on_missing_data, "Module ${caller_module_name} needs updates: Parameter settings_hash in tp::dir is deprecated, replace it with my_settings")
0 commit comments