Merge branch 'jenkins-build-29' into 'master'
Auto-merge for build 29 See merge request puppet/postgresql_cd!26
This commit is contained in:
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@@ -9,6 +9,7 @@
|
|||||||
"csvlog",
|
"csvlog",
|
||||||
"csvlogs",
|
"csvlogs",
|
||||||
"datestyle",
|
"datestyle",
|
||||||
|
"datname",
|
||||||
"ecdh",
|
"ecdh",
|
||||||
"fdatasync",
|
"fdatasync",
|
||||||
"geqo",
|
"geqo",
|
||||||
@@ -34,6 +35,7 @@
|
|||||||
"multixact",
|
"multixact",
|
||||||
"naptime",
|
"naptime",
|
||||||
"nestloop",
|
"nestloop",
|
||||||
|
"onlyif",
|
||||||
"partitionwise",
|
"partitionwise",
|
||||||
"pghba",
|
"pghba",
|
||||||
"pgsql",
|
"pgsql",
|
||||||
@@ -47,6 +49,7 @@
|
|||||||
"tablespaces",
|
"tablespaces",
|
||||||
"tidscan",
|
"tidscan",
|
||||||
"timezonesets",
|
"timezonesets",
|
||||||
|
"trgm",
|
||||||
"usename",
|
"usename",
|
||||||
"walsender",
|
"walsender",
|
||||||
"writethrough",
|
"writethrough",
|
||||||
|
|||||||
@@ -139,6 +139,11 @@
|
|||||||
<li class="letter">P</li>
|
<li class="letter">P</li>
|
||||||
<ul>
|
<ul>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<span class='object_link'><a href="puppet_defined_types/postgresql_cd_3A_3Aserver_3A_3Adatabases_3A_3Adb_df.html" title="puppet_defined_types::postgresql_cd::server::databases::db_df (puppet_defined_type)">postgresql_cd::server::databases::db_df</a></span>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
<li>
|
<li>
|
||||||
<span class='object_link'><a href="puppet_defined_types/postgresql_cd_3A_3Aserver_3A_3Apghba_3A_3Apg_hba_rule.html" title="puppet_defined_types::postgresql_cd::server::pghba::pg_hba_rule (puppet_defined_type)">postgresql_cd::server::pghba::pg_hba_rule</a></span>
|
<span class='object_link'><a href="puppet_defined_types/postgresql_cd_3A_3Aserver_3A_3Apghba_3A_3Apg_hba_rule.html" title="puppet_defined_types::postgresql_cd::server::pghba::pg_hba_rule (puppet_defined_type)">postgresql_cd::server::pghba::pg_hba_rule</a></span>
|
||||||
|
|
||||||
|
|||||||
@@ -396,6 +396,24 @@
|
|||||||
—
|
—
|
||||||
<div class='inline'>
|
<div class='inline'>
|
||||||
<p>Whether to manage roles</p>
|
<p>Whether to manage roles</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
|
||||||
|
<span class='name'>pl_manage_databases</span>
|
||||||
|
|
||||||
|
|
||||||
|
<span class='type'>(<tt>Boolean</tt>)</span>
|
||||||
|
|
||||||
|
|
||||||
|
<em class="default">(defaults to: <tt>true</tt>)</em>
|
||||||
|
|
||||||
|
|
||||||
|
—
|
||||||
|
<div class='inline'>
|
||||||
|
<p>Whether to manage databases</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</li>
|
</li>
|
||||||
@@ -411,7 +429,6 @@
|
|||||||
<pre class="lines">
|
<pre class="lines">
|
||||||
|
|
||||||
|
|
||||||
24
|
|
||||||
25
|
25
|
||||||
26
|
26
|
||||||
27
|
27
|
||||||
@@ -455,10 +472,12 @@
|
|||||||
65
|
65
|
||||||
66
|
66
|
||||||
67
|
67
|
||||||
68</pre>
|
68
|
||||||
|
69
|
||||||
|
70</pre>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<pre class="code"><span class="info file"># File 'manifests/params.pp', line 24</span>
|
<pre class="code"><span class="info file"># File 'manifests/params.pp', line 25</span>
|
||||||
|
|
||||||
class postgresql_cd::params (
|
class postgresql_cd::params (
|
||||||
|
|
||||||
@@ -484,6 +503,7 @@ class postgresql_cd::params (
|
|||||||
String $pl_server_key = 'server.key',
|
String $pl_server_key = 'server.key',
|
||||||
String $pl_ca_crt = 'root.crt',
|
String $pl_ca_crt = 'root.crt',
|
||||||
Boolean $pl_manage_roles = true,
|
Boolean $pl_manage_roles = true,
|
||||||
|
Boolean $pl_manage_databases = true,
|
||||||
|
|
||||||
) {
|
) {
|
||||||
$fqdn = $facts['networking']['fqdn']
|
$fqdn = $facts['networking']['fqdn']
|
||||||
|
|||||||
@@ -40,14 +40,21 @@
|
|||||||
<ul id="full_list" class="puppet_defined_type">
|
<ul id="full_list" class="puppet_defined_type">
|
||||||
|
|
||||||
|
|
||||||
<li id="object_puppet_defined_types::postgresql_cd::server::pghba::pg_hba_rule" class="odd">
|
<li id="object_puppet_defined_types::postgresql_cd::server::databases::db_df" class="odd">
|
||||||
|
<div class="item">
|
||||||
|
<span class='object_link'><a href="puppet_defined_types/postgresql_cd_3A_3Aserver_3A_3Adatabases_3A_3Adb_df.html" title="puppet_defined_types::postgresql_cd::server::databases::db_df (puppet_defined_type)">postgresql_cd::server::databases::db_df</a></span>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
<li id="object_puppet_defined_types::postgresql_cd::server::pghba::pg_hba_rule" class="even">
|
||||||
<div class="item">
|
<div class="item">
|
||||||
<span class='object_link'><a href="puppet_defined_types/postgresql_cd_3A_3Aserver_3A_3Apghba_3A_3Apg_hba_rule.html" title="puppet_defined_types::postgresql_cd::server::pghba::pg_hba_rule (puppet_defined_type)">postgresql_cd::server::pghba::pg_hba_rule</a></span>
|
<span class='object_link'><a href="puppet_defined_types/postgresql_cd_3A_3Aserver_3A_3Apghba_3A_3Apg_hba_rule.html" title="puppet_defined_types::postgresql_cd::server::pghba::pg_hba_rule (puppet_defined_type)">postgresql_cd::server::pghba::pg_hba_rule</a></span>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
|
||||||
<li id="object_puppet_defined_types::postgresql_cd::server::roles::role_df" class="even">
|
<li id="object_puppet_defined_types::postgresql_cd::server::roles::role_df" class="odd">
|
||||||
<div class="item">
|
<div class="item">
|
||||||
<span class='object_link'><a href="puppet_defined_types/postgresql_cd_3A_3Aserver_3A_3Aroles_3A_3Arole_df.html" title="puppet_defined_types::postgresql_cd::server::roles::role_df (puppet_defined_type)">postgresql_cd::server::roles::role_df</a></span>
|
<span class='object_link'><a href="puppet_defined_types/postgresql_cd_3A_3Aserver_3A_3Aroles_3A_3Arole_df.html" title="puppet_defined_types::postgresql_cd::server::roles::role_df (puppet_defined_type)">postgresql_cd::server::roles::role_df</a></span>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -0,0 +1,261 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>
|
||||||
|
Defined Type: postgresql_cd::server::databases::db_df
|
||||||
|
|
||||||
|
— Documentation by YARD 0.9.36
|
||||||
|
|
||||||
|
</title>
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="../css/style.css" type="text/css" />
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="../css/common.css" type="text/css" />
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
pathId = "puppet_defined_types::postgresql_cd::server::databases::db_df";
|
||||||
|
relpath = '../';
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
||||||
|
|
||||||
|
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
|
||||||
|
|
||||||
|
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="nav_wrap">
|
||||||
|
<iframe id="nav" src="../puppet_defined_type_list.html?1"></iframe>
|
||||||
|
<div id="resizer"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="main" tabindex="-1">
|
||||||
|
<div id="header">
|
||||||
|
<div id="menu">
|
||||||
|
|
||||||
|
<a href="../_index.html">Index (p)</a> »
|
||||||
|
<span class='title'><span class='object_link'>Defined Types</span></span>
|
||||||
|
»
|
||||||
|
<span class="title">postgresql_cd::server::databases::db_df</span>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="search">
|
||||||
|
|
||||||
|
<a class="full_list_link" id="puppet_class_list_link"
|
||||||
|
href="../puppet_class_list.html">
|
||||||
|
|
||||||
|
<svg width="24" height="24">
|
||||||
|
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
||||||
|
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
||||||
|
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
||||||
|
</svg>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="clear"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="content"><h1>Defined Type: postgresql_cd::server::databases::db_df</h1>
|
||||||
|
<div class="box_info">
|
||||||
|
<dl>
|
||||||
|
<dt>Defined in:</dt>
|
||||||
|
<dd>
|
||||||
|
manifests/server/databases/db_df.pp
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h2>Summary</h2>
|
||||||
|
define manages databases
|
||||||
|
|
||||||
|
<h2>Overview</h2>
|
||||||
|
<div class="docstring">
|
||||||
|
<div class="discussion">
|
||||||
|
|
||||||
|
<p>postgresql_cd::server::databases::db_df Module name: postgresql_cd Author: Arne Teuke (arne_teuke@confdroid.com.com)</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class="tags">
|
||||||
|
<p class="tag_title">Parameters:</p>
|
||||||
|
<ul class="param">
|
||||||
|
|
||||||
|
<li>
|
||||||
|
|
||||||
|
<span class='name'>pl_db_name</span>
|
||||||
|
|
||||||
|
|
||||||
|
<span class='type'>(<tt>Optional[String]</tt>)</span>
|
||||||
|
|
||||||
|
|
||||||
|
<em class="default">(defaults to: <tt>undef</tt>)</em>
|
||||||
|
|
||||||
|
|
||||||
|
—
|
||||||
|
<div class='inline'>
|
||||||
|
<p>the name of the database to be created.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
|
||||||
|
<span class='name'>pl_owner_name</span>
|
||||||
|
|
||||||
|
|
||||||
|
<span class='type'>(<tt>Optional[String]</tt>)</span>
|
||||||
|
|
||||||
|
|
||||||
|
<em class="default">(defaults to: <tt>undef</tt>)</em>
|
||||||
|
|
||||||
|
|
||||||
|
—
|
||||||
|
<div class='inline'>
|
||||||
|
<p>the name of the owner for the database (optional), if none specified, the postgresql defaults will apply.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
|
||||||
|
<span class='name'>pl_db_action</span>
|
||||||
|
|
||||||
|
|
||||||
|
<span class='type'>(<tt>Optional[String]</tt>)</span>
|
||||||
|
|
||||||
|
|
||||||
|
<em class="default">(defaults to: <tt>undef</tt>)</em>
|
||||||
|
|
||||||
|
|
||||||
|
—
|
||||||
|
<div class='inline'>
|
||||||
|
<p>whether to create or drop the database. ‘CREATE DATABASE’ creates it, ‘DROP DATABASE’ drops it.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
|
||||||
|
<span class='name'>pl_db_extension</span>
|
||||||
|
|
||||||
|
|
||||||
|
<span class='type'>(<tt>String</tt>)</span>
|
||||||
|
|
||||||
|
|
||||||
|
<em class="default">(defaults to: <tt>'pg_trgm'</tt>)</em>
|
||||||
|
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<p class="tag_title">See Also:</p>
|
||||||
|
<ul class="see">
|
||||||
|
|
||||||
|
<li><a href="https://www.postgresql.org/docs/9.6/static/managing-databases.html" target="_parent" title="https://www.postgresql.org/docs/9.6/static/managing-databases.html">https://www.postgresql.org/docs/9.6/static/managing-databases.html</a></li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</div><div class="method_details_list">
|
||||||
|
<table class="source_code">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<pre class="lines">
|
||||||
|
|
||||||
|
|
||||||
|
13
|
||||||
|
14
|
||||||
|
15
|
||||||
|
16
|
||||||
|
17
|
||||||
|
18
|
||||||
|
19
|
||||||
|
20
|
||||||
|
21
|
||||||
|
22
|
||||||
|
23
|
||||||
|
24
|
||||||
|
25
|
||||||
|
26
|
||||||
|
27
|
||||||
|
28
|
||||||
|
29
|
||||||
|
30
|
||||||
|
31
|
||||||
|
32
|
||||||
|
33
|
||||||
|
34
|
||||||
|
35
|
||||||
|
36
|
||||||
|
37
|
||||||
|
38
|
||||||
|
39
|
||||||
|
40
|
||||||
|
41
|
||||||
|
42
|
||||||
|
43
|
||||||
|
44
|
||||||
|
45
|
||||||
|
46
|
||||||
|
47</pre>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<pre class="code"><span class="info file"># File 'manifests/server/databases/db_df.pp', line 13</span>
|
||||||
|
|
||||||
|
define postgresql_cd::server::databases::db_df (
|
||||||
|
|
||||||
|
Optional[String] $pl_db_name = undef,
|
||||||
|
Optional[String] $pl_owner_name = undef,
|
||||||
|
Optional[String] $pl_db_action = undef,
|
||||||
|
String $pl_db_extension = 'pg_trgm',
|
||||||
|
) {
|
||||||
|
$pl_manage_databases = $postgresql_cd::params::pl_manage_databases
|
||||||
|
|
||||||
|
if $pl_manage_databases == true {
|
||||||
|
# create databases
|
||||||
|
|
||||||
|
if $pl_db_action == 'CREATE DATABASE' {
|
||||||
|
exec { "create_database_${name}":
|
||||||
|
command => template('postgresql_cd/server/databases/db_create_sql.erb'),
|
||||||
|
user => 'postgres',
|
||||||
|
path => ['/usr/bin','/bin'],
|
||||||
|
cwd => '/tmp',
|
||||||
|
unless => template('postgresql_cd/server/databases/unless_db_sql.erb'),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Drop databases
|
||||||
|
|
||||||
|
if $pl_db_action == 'DROP DATABASE' {
|
||||||
|
exec { "drop_database_${name}":
|
||||||
|
command => template('postgresql_cd/server/databases/db_drop_sql.erb'),
|
||||||
|
user => 'postgres',
|
||||||
|
path => ['/usr/bin','/bin'],
|
||||||
|
cwd => '/tmp',
|
||||||
|
onlyif => template('postgresql_cd/server/databases/unless_drop_sql.erb'),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}</pre>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="footer">
|
||||||
|
Generated by <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>.
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -19,6 +19,7 @@
|
|||||||
# @param [String] pl_server_key the name of the server key
|
# @param [String] pl_server_key the name of the server key
|
||||||
# @param [String] pl_ca_crt the name of the CA crt
|
# @param [String] pl_ca_crt the name of the CA crt
|
||||||
# @param [Boolean] pl_manage_roles Whether to manage roles
|
# @param [Boolean] pl_manage_roles Whether to manage roles
|
||||||
|
# @param [Boolean] pl_manage_databases Whether to manage databases
|
||||||
# @summary Class contains all parameters for the postgresql_cd module.
|
# @summary Class contains all parameters for the postgresql_cd module.
|
||||||
##############################################################################
|
##############################################################################
|
||||||
class postgresql_cd::params (
|
class postgresql_cd::params (
|
||||||
@@ -45,6 +46,7 @@ class postgresql_cd::params (
|
|||||||
String $pl_server_key = 'server.key',
|
String $pl_server_key = 'server.key',
|
||||||
String $pl_ca_crt = 'root.crt',
|
String $pl_ca_crt = 'root.crt',
|
||||||
Boolean $pl_manage_roles = true,
|
Boolean $pl_manage_roles = true,
|
||||||
|
Boolean $pl_manage_databases = true,
|
||||||
|
|
||||||
) {
|
) {
|
||||||
$fqdn = $facts['networking']['fqdn']
|
$fqdn = $facts['networking']['fqdn']
|
||||||
|
|||||||
47
manifests/server/databases/db_df.pp
Normal file
47
manifests/server/databases/db_df.pp
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
## postgresql_cd::server::databases::db_df
|
||||||
|
# Module name: postgresql_cd
|
||||||
|
# Author: Arne Teuke (arne_teuke@confdroid.com.com)
|
||||||
|
# @summary define manages databases
|
||||||
|
# @see https://www.postgresql.org/docs/9.6/static/managing-databases.html
|
||||||
|
# @param [String] pl_db_name the name of the database to be created.
|
||||||
|
# @param [String] pl_owner_name the name of the owner for the database
|
||||||
|
# (optional), if none specified, the postgresql defaults will apply.
|
||||||
|
# @param [String] pl_db_action whether to create or drop the database.
|
||||||
|
# 'CREATE DATABASE' creates it, 'DROP DATABASE' drops it.
|
||||||
|
# @param [String] pl_db_extension
|
||||||
|
##############################################################################
|
||||||
|
define postgresql_cd::server::databases::db_df (
|
||||||
|
|
||||||
|
Optional[String] $pl_db_name = undef,
|
||||||
|
Optional[String] $pl_owner_name = undef,
|
||||||
|
Optional[String] $pl_db_action = undef,
|
||||||
|
String $pl_db_extension = 'pg_trgm',
|
||||||
|
) {
|
||||||
|
$pl_manage_databases = $postgresql_cd::params::pl_manage_databases
|
||||||
|
|
||||||
|
if $pl_manage_databases == true {
|
||||||
|
# create databases
|
||||||
|
|
||||||
|
if $pl_db_action == 'CREATE DATABASE' {
|
||||||
|
exec { "create_database_${name}":
|
||||||
|
command => template('postgresql_cd/server/databases/db_create_sql.erb'),
|
||||||
|
user => 'postgres',
|
||||||
|
path => ['/usr/bin','/bin'],
|
||||||
|
cwd => '/tmp',
|
||||||
|
unless => template('postgresql_cd/server/databases/unless_db_sql.erb'),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Drop databases
|
||||||
|
|
||||||
|
if $pl_db_action == 'DROP DATABASE' {
|
||||||
|
exec { "drop_database_${name}":
|
||||||
|
command => template('postgresql_cd/server/databases/db_drop_sql.erb'),
|
||||||
|
user => 'postgres',
|
||||||
|
path => ['/usr/bin','/bin'],
|
||||||
|
cwd => '/tmp',
|
||||||
|
onlyif => template('postgresql_cd/server/databases/unless_drop_sql.erb'),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
2
templates/server/databases/db_create_sql.erb
Normal file
2
templates/server/databases/db_create_sql.erb
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
psql -U postgres -tc "SELECT 1 FROM pg_database WHERE datname = '<%= @pl_db_name %>'" | grep -q 1 || psql -U postgres -c "CREATE DATABASE <%= @pl_db_name %> OWNER '<%= @pl_owner_name %>' "
|
||||||
|
psql -U postgres <%= @pl_db_name %> -c 'create extension if not exists <%= @pl_db_extension %>'
|
||||||
1
templates/server/databases/db_drop_sql.erb
Normal file
1
templates/server/databases/db_drop_sql.erb
Normal file
@@ -0,0 +1 @@
|
|||||||
|
dropdb -U postgres <%= @pl_db_name %> --if-exists
|
||||||
1
templates/server/databases/unless_db_sql.erb
Normal file
1
templates/server/databases/unless_db_sql.erb
Normal file
@@ -0,0 +1 @@
|
|||||||
|
psql -U postgres -c "SELECT datname FROM pg_database WHERE datname='<%= @pl_db_name %>' " | grep -q 1
|
||||||
1
templates/server/databases/unless_drop_sql.erb
Normal file
1
templates/server/databases/unless_drop_sql.erb
Normal file
@@ -0,0 +1 @@
|
|||||||
|
psql -U postgres -c "SELECT datname FROM pg_database WHERE datname='<%= @pl_db_name %>' " | grep -q 1
|
||||||
Reference in New Issue
Block a user