File tree Expand file tree Collapse file tree 2 files changed +77
-0
lines changed Expand file tree Collapse file tree 2 files changed +77
-0
lines changed Original file line number Diff line number Diff line change 55
55
$manage_pg_ident_conf = $postgresql::params::manage_pg_ident_conf,
56
56
$manage_recovery_conf = $postgresql::params::manage_recovery_conf,
57
57
$module_workdir = $postgresql::params::module_workdir,
58
+
59
+ Hash[String, Hash] $roles = {},
60
+ Hash[String, Any] $config_entries = {},
61
+ Hash[String, Hash] $pg_hba_rules = {},
62
+
58
63
# Deprecated
59
64
$version = undef ,
60
65
) inherits postgresql::params {
85
90
-> Class[' postgresql::server::config' ]
86
91
-> Class[' postgresql::server::service' ]
87
92
-> Class[' postgresql::server::passwd' ]
93
+
94
+ $roles .each |$rolename , $role | {
95
+ postgresql::server::role { $rolename:
96
+ * => $role ,
97
+ }
98
+ }
99
+
100
+ $config_entries .each |$entry , $value | {
101
+ postgresql::server::config_entry { $entry:
102
+ value => $value ,
103
+ }
104
+ }
105
+
106
+ $pg_hba_rules .each |$rule_name , $rule | {
107
+ postgresql::server::pg_hba_rule { $rule_name:
108
+ * => $rule ,
109
+ }
110
+ }
88
111
}
Original file line number Diff line number Diff line change @@ -165,4 +165,58 @@ class { 'postgresql::globals':
165
165
is_expected . to contain_class ( 'postgresql::repo' ) . with_version ( '99.5' )
166
166
end
167
167
end
168
+
169
+ describe 'additional roles' do
170
+ let ( :params ) do
171
+ {
172
+ :roles => {
173
+ :username => { :createdb => true }
174
+ }
175
+ }
176
+ end
177
+
178
+ it { is_expected . to compile . with_all_deps }
179
+ it { is_expected . to contain_postgresql__server__role ( 'username' ) . with_createdb ( true ) }
180
+ end
181
+
182
+ describe 'additional config_entries' do
183
+ let ( :params ) do
184
+ {
185
+ :config_entries => {
186
+ :fsync => 'off' ,
187
+ :checkpoint_segments => '20'
188
+ }
189
+ }
190
+ end
191
+
192
+ it { is_expected . to compile . with_all_deps }
193
+ it { is_expected . to contain_postgresql__server__config_entry ( 'fsync' ) . with_value ( 'off' ) }
194
+ it { is_expected . to contain_postgresql__server__config_entry ( 'checkpoint_segments' ) . with_value ( '20' ) }
195
+ end
196
+
197
+ describe 'additional pg_hba_rules' do
198
+ let ( :params ) do
199
+ {
200
+ :pg_hba_rules => {
201
+ :from_remote_host => {
202
+ :type => 'host' ,
203
+ :database => 'mydb' ,
204
+ :user => 'myuser' ,
205
+ :auth_method => 'md5' ,
206
+ :address => '192.0.2.100'
207
+ }
208
+ }
209
+ }
210
+ end
211
+
212
+ it { is_expected . to compile . with_all_deps }
213
+ it do
214
+ is_expected . to contain_postgresql__server__pg_hba_rule ( 'from_remote_host' ) . \
215
+ with_type ( 'host' ) . \
216
+ with_database ( 'mydb' ) . \
217
+ with_user ( 'myuser' ) . \
218
+ with_auth_method ( 'md5' ) . \
219
+ with_address ( '192.0.2.100' )
220
+ end
221
+ end
168
222
end
You can’t perform that action at this time.
0 commit comments