Skip to content

Commit dcaed6c

Browse files
authored
Merge pull request puppetlabs#877 from hasegeli/readme
Cleanup README
2 parents c5ab452 + 6300868 commit dcaed6c

File tree

1 file changed

+50
-69
lines changed

1 file changed

+50
-69
lines changed

README.md

Lines changed: 50 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ PostgreSQL is a high-performance, free, open-source relational database server.
4444
To configure a basic default PostgreSQL server, declare the `postgresql::server` class.
4545

4646
```puppet
47-
class { 'postgresql::server': }
47+
class { 'postgresql::server':
48+
}
4849
```
4950

5051
## Usage
@@ -57,7 +58,6 @@ For default settings, declare the `postgresql::server` class as above. To custom
5758
class { 'postgresql::server':
5859
ip_mask_deny_postgres_user => '0.0.0.0/32',
5960
ip_mask_allow_all_users => '0.0.0.0/0',
60-
listen_addresses => '*',
6161
ipv4acls => ['hostssl all johndoe 192.168.0.0/24 cert'],
6262
postgres_password => 'TPSrep0rt!',
6363
}
@@ -79,7 +79,8 @@ For more details about server configuration parameters, consult the [PostgreSQL
7979
You can set up a variety of PostgreSQL databases with the `postgresql::server::db` defined type. For instance, to set up a database for PuppetDB:
8080

8181
```puppet
82-
class { 'postgresql::server': }
82+
class { 'postgresql::server':
83+
}
8384
8485
postgresql::server::db { 'mydatabasename':
8586
user => 'mydatabaseuser',
@@ -92,10 +93,11 @@ postgresql::server::db { 'mydatabasename':
9293
To manage users, roles, and permissions:
9394

9495
```puppet
95-
class { 'postgresql::server': }
96+
class { 'postgresql::server':
97+
}
9698
9799
postgresql::server::role { 'marmot':
98-
password_hash => postgresql_password('marmot', 'mypasswd'),
100+
password_hash => postgresql_password('marmot', 'mypasswd'),
99101
}
100102
101103
postgresql::server::database_grant { 'test1':
@@ -124,7 +126,8 @@ For example, to overwrite the default `locale` and `encoding` for all classes, u
124126
class { 'postgresql::globals':
125127
encoding => 'UTF-8',
126128
locale => 'en_US.UTF-8',
127-
}->
129+
}
130+
128131
class { 'postgresql::server':
129132
}
130133
```
@@ -135,8 +138,10 @@ To use a specific version of the PostgreSQL package:
135138
class { 'postgresql::globals':
136139
manage_package_repo => true,
137140
version => '9.2',
138-
}->
139-
class { 'postgresql::server': }
141+
}
142+
143+
class { 'postgresql::server':
144+
}
140145
```
141146

142147
### Manage remote users, roles, and permissions
@@ -151,32 +156,27 @@ You can provide a `connect_settings` hash for each of the Puppet resources, or y
151156

152157
```puppet
153158
$connection_settings_super2 = {
154-
'PGUSER' => "super2",
155-
'PGPASSWORD' => "foobar2",
156-
'PGHOST' => "127.0.0.1",
157-
'PGPORT' => "5432",
158-
'PGDATABASE' => "postgres",
159-
}
159+
'PGUSER' => 'super2',
160+
'PGPASSWORD' => 'foobar2',
161+
'PGHOST' => '127.0.0.1',
162+
'PGPORT' => '5432',
163+
'PGDATABASE' => 'postgres',
164+
}
160165
161166
include postgresql::server
162167
163168
# Connect with no special settings, i.e domain sockets, user postgres
164-
postgresql::server::role{'super2':
165-
password_hash => "foobar2",
166-
superuser => true,
169+
postgresql::server::role { 'super2':
170+
password_hash => 'foobar2',
171+
superuser => true,
167172
168173
connect_settings => {},
169-
require => [
170-
Class['postgresql::globals'],
171-
Class['postgresql::server::service'],
172-
],
173174
}
174175
175176
# Now using this new user connect via TCP
176177
postgresql::server::database { 'db1':
177178
connect_settings => $connection_settings_super2,
178-
179-
require => Postgresql::Server::Role['super2'],
179+
require => Postgresql::Server::Role['super2'],
180180
}
181181
```
182182

@@ -186,7 +186,7 @@ To create an access rule for `pg_hba.conf`:
186186

187187
```puppet
188188
postgresql::server::pg_hba_rule { 'allow application network to access app database':
189-
description => "Open up PostgreSQL for access from 200.1.2.0/24",
189+
description => 'Open up PostgreSQL for access from 200.1.2.0/24',
190190
type => 'host',
191191
database => 'app',
192192
user => 'app',
@@ -208,7 +208,7 @@ By default, `pg_hba_rule` requires that you include `postgresql::server`. Howeve
208208

209209
```puppet
210210
postgresql::server::pg_hba_rule { 'allow application network to access app database':
211-
description => "Open up postgresql for access from 200.1.2.0/24",
211+
description => 'Open up postgresql for access from 200.1.2.0/24',
212212
type => 'host',
213213
database => 'app',
214214
user => 'app',
@@ -224,7 +224,7 @@ postgresql::server::pg_hba_rule { 'allow application network to access app datab
224224
To create a user name map for the pg_ident.conf:
225225

226226
```puppet
227-
postgresql::server::pg_ident_rule{ 'Map the SSL certificate of the backup server as a replication user':
227+
postgresql::server::pg_ident_rule { 'Map the SSL certificate of the backup server as a replication user':
228228
map_name => 'sslrepli',
229229
system_username => 'repli1.example.com',
230230
database_username => 'replication',
@@ -245,22 +245,22 @@ sslrepli repli1.example.com replication
245245
To create the recovery configuration file (`recovery.conf`):
246246

247247
```puppet
248-
postgresql::server::recovery{ 'Create a recovery.conf file with the following defined parameters':
249-
restore_command => 'cp /mnt/server/archivedir/%f %p',
250-
archive_cleanup_command => undef,
251-
recovery_end_command => undef,
252-
recovery_target_name => 'daily backup 2015-01-26',
253-
recovery_target_time => '2015-02-08 22:39:00 EST',
254-
recovery_target_xid => undef,
255-
recovery_target_inclusive => true,
256-
recovery_target => 'immediate',
257-
recovery_target_timeline => 'latest',
258-
pause_at_recovery_target => true,
259-
standby_mode => 'on',
260-
primary_conninfo => 'host=localhost port=5432',
261-
primary_slot_name => undef,
262-
trigger_file => undef,
263-
recovery_min_apply_delay => 0,
248+
postgresql::server::recovery { 'Create a recovery.conf file with the following defined parameters':
249+
restore_command => 'cp /mnt/server/archivedir/%f %p',
250+
archive_cleanup_command => undef,
251+
recovery_end_command => undef,
252+
recovery_target_name => 'daily backup 2015-01-26',
253+
recovery_target_time => '2015-02-08 22:39:00 EST',
254+
recovery_target_xid => undef,
255+
recovery_target_inclusive => true,
256+
recovery_target => 'immediate',
257+
recovery_target_timeline => 'latest',
258+
pause_at_recovery_target => true,
259+
standby_mode => 'on',
260+
primary_conninfo => 'host=localhost port=5432',
261+
primary_slot_name => undef,
262+
trigger_file => undef,
263+
recovery_min_apply_delay => 0,
264264
}
265265
```
266266

@@ -289,10 +289,10 @@ Example usage:
289289

290290
```puppet
291291
postgresql::validate_db_connection { 'validate my postgres connection':
292-
database_host => 'my.postgres.host',
293-
database_username => 'mydbuser',
294-
database_password => 'mydbpassword',
295-
database_name => 'mydbname',
292+
database_host => 'my.postgres.host',
293+
database_username => 'mydbuser',
294+
database_password => 'mydbpassword',
295+
database_name => 'mydbname',
296296
}->
297297
exec { 'rake db:migrate':
298298
cwd => '/opt/myrubyapp',
@@ -496,12 +496,6 @@ Overrides the default PostgreSQL log directory.
496496

497497
Default value: initdb's default path.
498498

499-
##### `log_line_prefix`
500-
501-
Set a prefix for the server logs.
502-
503-
Default value: `undef`.
504-
505499
##### `manage_package_repo`
506500

507501
Sets up official PostgreSQL repositories on your host if set to `true`.
@@ -786,13 +780,6 @@ Specifies the IP mask from which remote connections should be denied for the pos
786780

787781
Default value: '0.0.0.0/0', which denies any remote connection.
788782

789-
##### `listen_addresses`
790-
791-
Specifies the addresses the server accepts connections to. Valid values:
792-
* 'localhost': Accept connections from local host only.
793-
* '*': Accept connections from any remote machine.
794-
* Specified comma-separated list of hostnames or IP addresses.
795-
796783
##### `locale`
797784

798785
Sets the default database locale for all databases created with this module. On certain operating systems this is used during the `template1` initialization as well, so it becomes a default outside of the module.
@@ -801,12 +788,6 @@ Default value: `undef`, which is effectively 'C'.
801788

802789
**On Debian, you must ensure that the 'locales-all' package is installed for full functionality of PostgreSQL.**
803790

804-
##### `log_line_prefix`
805-
806-
Set a prefix for the server logs.
807-
808-
Default value: '$log_line_prefix' variable set in `postgresql::server` or `postgresql::globals`.
809-
810791
##### `manage_pg_hba_conf`
811792

812793
Whether to manage the `pg_hba.conf`.
@@ -1449,8 +1430,8 @@ Sets the hash to use during password creation. If the password is not already pr
14491430
If set to true, updates the password on changes. Set this to false to not modify the role's password after creation.
14501431

14511432
```puppet
1452-
postgresql::server::role { "myusername":
1453-
password_hash => postgresql_password('myusername', 'mypassword'),
1433+
postgresql::server::role { 'myusername':
1434+
password_hash => postgresql_password('myusername', 'mypassword'),
14541435
}
14551436
```
14561437

@@ -1728,8 +1709,8 @@ This is the namevar.
17281709

17291710
Generates a PostgreSQL encrypted password, use `postgresql_password`. Call it from the command line and then copy and paste the encrypted password into your manifest:
17301711

1731-
```puppet
1732-
puppet apply --execute 'notify { "test": message => postgresql_password("username", "password") }'
1712+
```shell
1713+
puppet apply --execute 'notify { 'test': message => postgresql_password('username', 'password') }'
17331714
```
17341715

17351716
Alternatively, you can call this from your production manifests, but the manifests will then contain a clear text version of your passwords.

0 commit comments

Comments
 (0)