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
+69-72Lines changed: 69 additions & 72 deletions
Original file line number
Diff line number
Diff line change
@@ -283,16 +283,16 @@ Only the specified parameters are recognized in the template. The `recovery.conf
283
283
284
284
### Validate connectivity
285
285
286
-
To validate client connections to a remote PostgreSQL database before starting dependent tasks, use the `postgresql::validate_db_connection` resource. You can use this on any node where the PostgreSQL client software is installed. It is often chained to other tasks such as starting an application server or performing a database migration.
286
+
To validate client connections to a remote PostgreSQL database before starting dependent tasks, use the `postgresql_conn_validator` resource. You can use this on any node where the PostgreSQL client software is installed. It is often chained to other tasks such as starting an application server or performing a database migration.
287
287
288
288
Example usage:
289
289
290
290
```puppet
291
-
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',
291
+
postgresql_conn_validator { 'validate my postgres connection':
292
+
host => 'my.postgres.host',
293
+
db_username => 'mydbuser',
294
+
db_password => 'mydbpassword',
295
+
db_name => 'mydbname',
296
296
}->
297
297
exec { 'rake db:migrate':
298
298
cwd => '/opt/myrubyapp',
@@ -332,13 +332,13 @@ The postgresql module comes with many options for configuring the server. While
Installs PostgreSQL bindings for Postgres-Docs. Set the following parameters if you have a custom version you would like to install.
@@ -1543,64 +1536,6 @@ Specifies the name of the tablespace.
1543
1536
1544
1537
Default value: the namevar.
1545
1538
1546
-
#### postgresql::validate_db_connection
1547
-
1548
-
Validates client connection with a remote PostgreSQL database.
1549
-
1550
-
##### `connect_settings`
1551
-
1552
-
Specifies a hash of environment variables used when connecting to a remote server. This is an alternative to providing individual parameters (`database_host`, etc). If provided, the individual parameters take precedence.
1553
-
1554
-
##### `create_db_first`
1555
-
1556
-
Ensures that the database is created before running the test. This only works if your test is local.
1557
-
1558
-
Default value: `true`.
1559
-
1560
-
##### `database_host`
1561
-
1562
-
Sets the hostname of the database you wish to test.
1563
-
1564
-
Default value: `undef`, which generally uses the designated local Unix socket.
1565
-
1566
-
##### `database_name`
1567
-
1568
-
Specifies the name of the database you wish to test.
1569
-
1570
-
Default value: 'postgres'.
1571
-
1572
-
##### `database_port`
1573
-
1574
-
Defines the port to use when connecting.
1575
-
1576
-
Default value: `undef`, which generally defaults to port 5432 depending on your PostgreSQL packaging.
1577
-
1578
-
##### `database_password`
1579
-
1580
-
Specifies the password to connect with. Can be left blank, not recommended.
1581
-
1582
-
##### `database_username`
1583
-
1584
-
Specifies the username to connect with.
1585
-
1586
-
Default value: `undef`.
1587
-
1588
-
When using a Unix socket and ident auth, this is the user you are running as.
1589
-
1590
-
**If the host is remote you must provide a username.**
1591
-
1592
-
##### `run_as`
1593
-
1594
-
Specifies the user to run the `psql` command as. This is important when trying to connect to a database locally using Unix sockets and `ident` authentication. Not needed for remote testing.
1595
-
1596
-
##### `sleep`
1597
-
1598
-
Sets the number of seconds to sleep for before trying again after a failure.
1599
-
1600
-
##### `tries`
1601
-
1602
-
Sets the number of attempts after failure before giving up and failing the resource.
1603
-
1604
1539
### Types
1605
1540
1606
1541
#### postgresql_psql
@@ -1703,6 +1638,68 @@ Specifies the name of the slot to create. Must be a valid replication slot name.
1703
1638
1704
1639
This is the namevar.
1705
1640
1641
+
#### postgresql_conn_validator
1642
+
1643
+
Validate the connection to a local or remote PostgreSQL database using this type.
1644
+
1645
+
##### `connect_settings`
1646
+
1647
+
Specifies a hash of environment variables used when connecting to a remote server. This is an alternative to providing individual parameters (`host`, etc). If provided, the individual parameters take precedence.
1648
+
1649
+
Default value: {}
1650
+
1651
+
##### `db_name`
1652
+
1653
+
Specifies the name of the database you wish to test.
1654
+
1655
+
Default value: ''
1656
+
1657
+
##### `db_password`
1658
+
1659
+
Specifies the password to connect with. Can be left blank if `.pgpass` is being used, otherwise not recommended.
1660
+
1661
+
Default value: ''
1662
+
1663
+
##### `db_username`
1664
+
1665
+
Specifies the username to connect with.
1666
+
1667
+
Default value: ''
1668
+
1669
+
When using a Unix socket and ident auth, this is the user you are running as.
1670
+
1671
+
##### `command`
1672
+
1673
+
This is the command run against the target database to verify connectivity.
1674
+
1675
+
Default value: 'SELECT 1'
1676
+
1677
+
##### `host`
1678
+
1679
+
Sets the hostname of the database you wish to test.
1680
+
1681
+
Default value: '', which generally uses the designated local Unix socket.
1682
+
1683
+
**If the host is remote you must provide a username.**
1684
+
1685
+
##### `port`
1686
+
1687
+
Defines the port to use when connecting.
1688
+
1689
+
Default value: ''
1690
+
1691
+
##### `run_as`
1692
+
1693
+
Specifies the user to run the `psql` command as. This is important when trying to connect to a database locally using Unix sockets and `ident` authentication. Not needed for remote testing.
1694
+
1695
+
##### `sleep`
1696
+
1697
+
Sets the number of seconds to sleep for before trying again after a failure.
1698
+
1699
+
##### `tries`
1700
+
1701
+
Sets the number of attempts after failure before giving up and failing the resource.
0 commit comments