pg database
Overview
With this type you can create,delete and manage Postgres databases. Here is an example on how you could use this:
pg_database { 'my_database@instance':
ensure => 'present',
allow_connections => true,
connection_limit => -1,
owner => 'my_custom_role,
}
The pg_database
type recognises all of the options you also have when using SQL to create a user or a role.
Attributes
Attribute Name | Short Description |
---|---|
allow_connections | sIf false then no one can connect to this database. |
connection_limit | How many concurrent connections can be made to this database. |
db | The database name |
disable_corrective_change | Disable the modification of a resource when Puppet decides it is a corrective change. |
disable_corrective_ensure | Disable the creation or removal of a resource when Puppet decides is a corrective change. |
ensure | The basic property that the resource should be in. |
instance | Postgres instance to connect to. |
is_template | If true, then this database can be cloned by any user with CREATEDB privileges; if false (the default), then only superusers or the owner of the database can clone it. |
lc_collate | This is a shortcut for setting LC_COLLATE and LC_CTYPE at once. |
lc_ctype | Character classification (LC_CTYPE) to use in the new database. |
locale | This is a shortcut for setting LC_COLLATE and LC_CTYPE at once. |
name | The user name. |
oid | The ID of role |
owner | The role name of the user who will own the new database, or DEFAULT to use the default (namely, the user executing the command). |
provider | resource. |
tablespace | The name of the template from which to create the new database, or DEFAULT to use the default template (template1). |
template | specified if the role bypasses every row level security policy. |
allow_connections
sIf false then no one can connect to this database. The default is true, allowing connections (except as restricted by other mechanisms, such as GRANT/REVOKE CONNECT).
Valid values are true
, false
.
Back to overview of pg_database
connection_limit
How many concurrent connections can be made to this database. -1 (the default) means no limit.
Back to overview of pg_database
db
The database name
Back to overview of pg_database
disable_corrective_change
Disable the modification of a resource when Puppet decides it is a corrective change.
(requires easy_type V2.11.0 or higher)
When using a Puppet Server, Puppet knows about adaptive and corrective changes. A corrective change is when Puppet notices that the resource has changed, but the catalog has not changed. This can occur for example, when a user, by accident or willingly, changed something on the system that Puppet is managing. The normal Puppet process then repairs this and puts the resource back in the state as defined in the catalog. This process is precisely what you want most of the time, but not always. This can sometimes also occur when a hardware or network error occurs. Then Puppet cannot correctly determine the current state of the system and thinks the resource is changed, while in fact, it is not. Letting Puppet recreate remove or change the resource in these cases, is NOT wat you want.
Using the disable_corrective_change
parameter, you can disable corrective changes on the current resource.
Here is an example of this:
crucial_resource {'be_carefull':
...
disable_corrective_change => true,
...
}
When a corrective ensure does happen on the resource Puppet will not modify the resource and signal an error:
Error: Corrective change present requested by catalog, but disabled by parameter disable_corrective_change
Error: /Stage[main]/Main/Crucial_resource[be_carefull]/parameter: change from '10' to '20' failed: Corrective change present requested by catalog, but disabled by parameter disable_corrective_change. (corrective)
Back to overview of pg_database
disable_corrective_ensure
Disable the creation or removal of a resource when Puppet decides is a corrective change.
(requires easy_type V2.11.0 or higher)
When using a Puppet Server, Puppet knows about adaptive and corrective changes. A corrective change is when Puppet notices that the resource has changed, but the catalog has not changed. This can occur for example, when a user, by accident or willingly, changed something on the system that Puppet is managing. The normal Puppet process then repairs this and puts the resource back in the state as defined in the catalog. This process is precisely what you want most of the time, but not always. This can sometimes also occur when a hardware or network error occurs. Then Puppet cannot correctly determine the current state of the system and thinks the resource is changed, while in fact, it is not. Letting Puppet recreate remove or change the resource in these cases, is NOT wat you want.
Using the disable_corrective_ensure
parameter, you can disable corrective ensure present or ensure absent actions on the current resource.
Here is an example of this:
crucial_resource {'be_carefull':
ensure => 'present',
...
disable_corrective_ensure => true,
...
}
When a corrective ensure does happen on the resource Puppet will not create or remove the resource and signal an error:
Error: Corrective ensure present requested by catalog, but disabled by parameter disable_corrective_ensure.
Error: /Stage[main]/Main/Crucial_resource[be_carefull]/ensure: change from 'absent' to 'present' failed: Corrective ensure present requested by catalog, but disabled by parameter disable_corrective_ensure. (corrective)
Back to overview of pg_database
ensure
The basic property that the resource should be in.
Valid values are present
, absent
.
Back to overview of pg_database
instance
Postgres instance to connect to.
All types have a name like resource@instance
.
Back to overview of pg_database
is_template
If true, then this database can be cloned by any user with CREATEDB privileges; if false (the default), then only superusers or the owner of the database can clone it.
Valid values are true
, false
.
Back to overview of pg_database
lc_collate
This is a shortcut for setting LC_COLLATE and LC_CTYPE at once. If you specify this, you cannot specify either of those parameters.
Back to overview of pg_database
lc_ctype
Character classification (LC_CTYPE) to use in the new database. This affects the categorization of characters, e.g., lower, upper and digit. The default is to use the character classification of the template database. See below for additional restrictions.
Back to overview of pg_database
locale
This is a shortcut for setting LC_COLLATE and LC_CTYPE at once. If you specify this, you cannot specify either of those parameters.
Back to overview of pg_database
name
The user name.
Back to overview of pg_database
oid
The ID of role
Back to overview of pg_database
owner
The role name of the user who will own the new database, or DEFAULT to use the default (namely, the user executing the command). To create a database owned by another role, you must be a direct or indirect member of that role, or be a superuser.
Back to overview of pg_database
provider
The specific backend to use for this pg_database
resource. You will seldom need to specify this — Puppet will usually discover the appropriate provider for your platform.Available providers are:
- simple
- Manage Postgres databases via regular SQL
Back to overview of pg_database
tablespace
The name of the template from which to create the new database, or DEFAULT to use the default template (template1).
Back to overview of pg_database
template
specified if the role bypasses every row level security policy.