Documentation by YARD 0.9.36
+Alphabetic Index
+ +Puppet Class Listing A-Z
+ + +
+
+
+
|
+
Defined Type Listing A-Z
+ + +
+
+
+
|
+
File Listing
+-
+
+
+
- README + + +
diff --git a/doc/_index.html b/doc/_index.html new file mode 100644 index 0000000..45d5b97 --- /dev/null +++ b/doc/_index.html @@ -0,0 +1,222 @@ + + +
+ + +
+
+
+
|
+
+
+
+
|
+
| t |
+ + + +6 +7 +8+ |
+
+ # File 'manifests/init.pp', line 6
+
+class confdroid_postgresql {
+ include confdroid_postgresql::params
+}
+ |
+
confdroid_postgresql::bouncer::bouncer.pp Module name: confdroid_postgresql Author: 12ww1160 (12ww1160@confdroid.com)
+ +
+ + + +6 +7 +8 +9 +10 +11 +12 +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 +48 +49+ |
+
+ # File 'manifests/bouncer/bouncer.pp', line 6
+
+class confdroid_postgresql::bouncer::bouncer (
+
+) inherits confdroid_postgresql::params {
+ if ($fqdn == $pl_server_fqdn) and ($pl_use_pg_bouncer == true) {
+ # ensure directory exists
+ file { $pl_bouncer_dir:
+ ensure => directory,
+ owner => 'root',
+ group => 'root',
+ mode => '0750',
+ selrange => s0,
+ selrole => object_r,
+ seltype => etc_t,
+ seluser => system_u,
+ }
+ # create auth user file to be populated through placeholder
+ file { $pl_bouncer_auth_file:
+ ensure => file,
+ owner => 'pgbouncer',
+ group => 'pgbouncer',
+ mode => '0440',
+ selrange => s0,
+ selrole => object_r,
+ seltype => etc_t,
+ seluser => system_u,
+ content => template($pl_bouncer_auth_erb),
+ }
+
+ # create the pgbouncer.ini file
+ concat { $pl_bouncer_ini_file:
+ ensure => present,
+ owner => 'pgbouncer',
+ mode => '0600',
+ #notify => Service[$pl_service],
+ }
+
+ # manage file header
+ concat::fragment { 'bouncer_header':
+ target => $pl_bouncer_ini_file,
+ content => template($pl_bouncer_ini_erb),
+ order => '000',
+ }
+ }
+}
+ |
+
confdroid_postgresql::bouncer::service.pp Module name: confdroid_postgresql Author: 12ww1160 (12ww1160@confdroid.com)
+ +
+ + + +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18+ |
+
+ # File 'manifests/bouncer/service.pp', line 6
+
+class confdroid_postgresql::bouncer::service (
+
+) inherits confdroid_postgresql::params {
+ if ($fqdn == $pl_server_fqdn) and ($pl_use_pg_bouncer == true) {
+ require confdroid_postgresql::bouncer::bouncer
+ service { $pl_bouncer_service:
+ ensure => running,
+ hasstatus => true,
+ hasrestart => true,
+ enable => true,
+ }
+ }
+}
+ |
+
confdroid_postgresql::exporter::dirs.pp Module name: confdroid_postgresql Author: 12ww1160 (12ww1160@confdroid.com)
+ +
+ + + +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21+ |
+
+ # File 'manifests/exporter/dirs.pp', line 6
+
+class confdroid_postgresql::exporter::dirs (
+
+) inherits confdroid_postgresql::params {
+ if ($fqdn == $pl_server_fqdn) and ($pl_use_exporter == true) {
+ file { $pl_install_dir:
+ ensure => directory,
+ owner => 'postgres',
+ group => 'postgres',
+ mode => '0755',
+ selrange => s0,
+ selrole => object_r,
+ seltype => usr_t,
+ seluser => system_u,
+ }
+ }
+}
+ |
+
confdroid_postgresql::exporter::files.pp Module name: confdroid_postgresql Author: 12ww1160 (12ww1160@confdroid.com)
+ +
+ + + +6 +7 +8 +9 +10 +11 +12+ |
+
+ # File 'manifests/exporter/files.pp', line 6
+
+class confdroid_postgresql::exporter::files (
+
+) inherits confdroid_postgresql::params {
+ if ($fqdn == $pl_server_fqdn) and ($pl_use_exporter == true) {
+ require confdroid_postgresql::exporter::dirs
+ }
+}
+ |
+
confdroid_postgresql::exporter::service.pp Module name: confdroid_postgresql Author: 12ww1160 (12ww1160@confdroid.com)
+ +
+ + + +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19+ |
+
+ # File 'manifests/exporter/service.pp', line 6
+
+class confdroid_postgresql::exporter::service (
+
+) inherits confdroid_postgresql::params {
+ if ($fqdn == $pl_server_fqdn) and ($pl_use_exporter == true) {
+ require confdroid_postgresql::exporter::files
+
+# service { $pl_exporter_service:
+# ensure => running,
+# hasstatus => true,
+# hasrestart => true,
+# enable => true,
+# }
+ }
+}
+ |
+
confdroid_postgresql::firewall::iptables.pp Module name: confdroid_postgresql Author: 12ww1160 (12ww1160@confdroid.com)
+ +
+ + + +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17+ |
+
+ # File 'manifests/firewall/iptables.pp', line 6
+
+class confdroid_postgresql::firewall::iptables (
+
+) inherits confdroid_postgresql::params {
+ if ($fqdn == $pl_server_fqdn) and ($pl_enable_fw == true) {
+ firewall { "${pl_fw_rule_order}${pl_fw_port} tcp port ${pl_fw_port}":
+ source => $pl_source_range,
+ proto => 'tcp',
+ dport => $pl_fw_port,
+ jump => 'accept',
+ }
+ }
+}
+ |
+
confdroid_postgresql::main::config.pp Module name: confdroid_postgresql Author: 12ww1160 (12ww1160@confdroid.com)
+ +
+ + + +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20+ |
+
+ # File 'manifests/main/config.pp', line 6
+
+class confdroid_postgresql::main::config (
+
+) inherits confdroid_postgresql::params {
+ require confdroid_postgresql::main::install
+
+ if $fqdn == $pl_server_fqdn {
+ include confdroid_postgresql::server::service
+# if $pl_use_exporter == true {
+# include confdroid_postgresql::exporter::service
+# }
+ if $pl_use_pg_bouncer == true {
+ include confdroid_postgresql::bouncer::service
+ }
+ }
+}
+ |
+
confdroid_postgresql::main::dirs.pp Module name: confdroid_postgresql Author: 12ww1160 (12ww1160@confdroid.com)
+ +
+ + + +6 +7 +8 +9 +10+ |
+
+ # File 'manifests/main/dirs.pp', line 6
+
+class confdroid_postgresql::main::dirs (
+
+) inherits confdroid_postgresql::params {
+ require confdroid_postgresql::main::install
+}
+ |
+
confdroid_postgresql::main::files.pp Module name: confdroid_postgresql Author: 12ww1160 (12ww1160@confdroid.com)
+ +
+ + + +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26+ |
+
+ # File 'manifests/main/files.pp', line 6
+
+class confdroid_postgresql::main::files (
+
+) inherits confdroid_postgresql::params {
+ if $fqdn == $pl_server_fqdn {
+ require confdroid_postgresql::server::initdb
+ require confdroid_postgresql::main::dirs
+
+ file { '/var/lib/pgsql/data/postgresql.conf':
+ ensure => file,
+ owner => 'postgres',
+ group => 'postgres',
+ mode => '0600',
+ selrange => s0,
+ selrole => object_r,
+ seltype => postgresql_db_t,
+ seluser => unconfined_u,
+ content => template('confdroid_postgresql/postgresql.conf.erb'),
+ notify => Service[$pl_service],
+ }
+ }
+}
+ |
+
confdroid_postgresql::main::install.pp Module name: confdroid_postgresql Author: 12ww1160 (12ww1160@confdroid.com)
+ +
+ + + +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33+ |
+
+ # File 'manifests/main/install.pp', line 6
+
+class confdroid_postgresql::main::install (
+
+) inherits confdroid_postgresql::params {
+ if $fqdn == $pl_server_fqdn {
+ package { $reqpackages_server:
+ ensure => $pkg_ensure,
+ }
+ package { $reqpackages_client:
+ ensure => $pkg_ensure,
+ }
+ if $pl_manage_extensions == true {
+ package { $reqpackages_extensions:
+ ensure => $pkg_ensure,
+ }
+ }
+ if $pl_use_pg_bouncer == true {
+ package { $reqpackages_bouncer:
+ ensure => $pkg_ensure,
+ }
+ }
+ }
+
+ if $fqdn != $pl_server_fqdn {
+ package { $reqpackages_client:
+ ensure => $pkg_ensure,
+ }
+ }
+}
+ |
+
confdroid_postgresql::params.pp Module name: confdroid_postgresql Author: 12ww1160 (12ww1160@confdroid.com)
+ +
+ + + +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73 +74 +75 +76 +77 +78 +79 +80 +81 +82 +83 +84 +85 +86 +87 +88 +89 +90 +91 +92 +93 +94 +95 +96 +97 +98 +99 +100 +101 +102 +103 +104 +105 +106 +107+ |
+
+ # File 'manifests/params.pp', line 38
+
+class confdroid_postgresql::params (
+
+ String $pl_server_fqdn = undef,
+
+ # installation
+ Array $reqpackages_server = ['postgresql-server','postgresql-contrib'],
+ String $reqpackages_extensions = 'timescaledb',
+ String $reqpackages_client = 'postgresql',
+ String $reqpackages_bouncer = 'pgbouncer',
+ String $pkg_ensure = 'latest',
+
+ # firewall
+ String $pl_fw_rule_order = '50',
+ String $pl_fw_port = '5432',
+ String $pl_source_range = '0.0.0.0/0',
+ Boolean $pl_enable_fw = true,
+
+ # main config
+ String $pl_listen_address = '*',
+ String $pl_listen_port = '5432',
+ String $pl_max_conn = '100',
+ String $pl_idle_timeout = '60000',
+ Boolean $pl_ssl_enabled = false,
+ String $pl_server_crt = 'server.crt',
+ String $pl_server_key = 'server.key',
+ String $pl_ca_crt = 'root.crt',
+ Boolean $pl_manage_content = true,
+ Boolean $pl_manage_extensions = false,
+
+ # postgresql exporter
+ Boolean $pl_use_exporter = false,
+ String $pl_install_dir = '/opt/postgres-exporter',
+
+ # pg bouncer
+ Boolean $pl_use_pg_bouncer = false,
+ String $pl_bouncer_listen_addr = '0.0.0.0',
+ String $pl_bouncer_port = '6432',
+ String $pl_bouncer_auth_mode = 'md5',
+ String $pl_bouncer_auth_users = 'placeholder',
+ String $pl_bouncer_pool_mode = 'transaction',
+ String $pl_bouncer_mx_cl_conn = '100',
+ String $pl_bouncer_pool_size = '20',
+
+) {
+ $fqdn = $facts['networking']['fqdn']
+ $domain = $facts['networking']['domain']
+ $os_name = $facts['os']['name']
+ $os_release = $facts['os']['release']['major']
+
+ # Directories
+ $pl_data_dir = '/var/lib/pgsql/data/'
+ $pl_bouncer_dir = '/etc/pgbouncer'
+
+ # files
+ $pl_pg_hba_conf = "${pl_data_dir}/pg_hba.conf"
+ $pl_pg_hba_rule_conf = 'confdroid_postgresql/server/pghba/pg_hba_rule.conf.erb'
+ $pl_pg_hba_conf_erb = 'confdroid_postgresql/server/pghba/pg_hba.conf.erb'
+ $pl_bouncer_ini_file = "${pl_bouncer_dir}/pgbouncer.ini"
+ $pl_bouncer_ini_erb = 'confdroid_postgresql/server/bouncer/pgbouncer.ini.erb'
+ $pl_bouncer_auth_file = "${pl_bouncer_dir}/userlist.txt"
+ $pl_bouncer_auth_erb = 'confdroid_postgresql/server/bouncer/bouncer_users.erb'
+
+ # Service
+ $pl_service = 'postgresql'
+ $pl_exporter_service = 'postgres_exporter'
+ $pl_bouncer_service = 'pgbouncer'
+
+ # includes must be last
+ include confdroid_postgresql::main::config
+}
+ |
+
confdroid_postgresql::server::initdb.pp Module name: confdroid_postgresql Author: 12ww1160 (12ww1160@confdroid.com)
+ +
+ + + +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20+ |
+
+ # File 'manifests/server/initdb.pp', line 6
+
+class confdroid_postgresql::server::initdb (
+
+) inherits confdroid_postgresql::params {
+ if $fqdn == $pl_server_fqdn {
+ require confdroid_postgresql::main::install
+
+ exec { 'init_pgsql_db':
+ command => 'postgresql-setup --initdb',
+ creates => "${pl_data_dir}/PG_VERSION",
+ path => ['/sbin','/usr/bin'],
+ }
+ }
+
+ include confdroid_postgresql::main::files
+}
+ |
+
confdroid_postgresql::server::pg_hba.pp Module name: confdroid_postgresql Author: 12ww1160 (arne_teuke@puppetsoft.com) }
+ +
+ + + +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 +48 +49 +50 +51 +52 +53 +54 +55+ |
+
+ # File 'manifests/server/pghba/pg_hba.pp', line 15
+
+class confdroid_postgresql::server::pghba::pg_hba (
+
+) inherits confdroid_postgresql::params {
+ if $fqdn == $pl_server_fqdn {
+ # create the pg_hba.conf file
+
+ concat { $pl_pg_hba_conf:
+ ensure => present,
+ owner => 'postgres',
+ mode => '0600',
+ notify => Service[$pl_service],
+ }
+
+ # manage file header
+
+ concat::fragment { 'pghba_header':
+ target => $pl_pg_hba_conf,
+ content => template($pl_pg_hba_conf_erb),
+ order => '000',
+ }
+
+ # manage default rules => should go into external config set
+# confdroid_postgresql::server::pghba::pg_hba_rule { 'local access for role postgres':
+# pl_auth_type => 'local',
+# pl_auth_database => 'all',
+# pl_auth_user => $ql_user_name,
+# pl_auth_method => 'trust',
+# pl_auth_order => '001',
+# pl_auth_option => $ql_auth_option,
+# }
+
+# confdroid_postgresql::server::pghba::pg_hba_rule { 'local access for all roles':
+# pl_auth_type => 'local',
+# pl_auth_database => 'all',
+# pl_auth_user => 'all',
+# pl_auth_method => 'trust',
+# pl_auth_order => '002',
+# pl_auth_option => $pl_auth_option,
+# }
+ }
+}
+ |
+
confdroid_postgresql::server::service.pp Module name: confdroid_postgresql Author: 12ww1160 (12ww1160@confdroid.com)
+ +
+ + + +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21+ |
+
+ # File 'manifests/server/service.pp', line 6
+
+class confdroid_postgresql::server::service (
+
+) inherits confdroid_postgresql::params {
+ if $fqdn == $pl_server_fqdn {
+ require confdroid_postgresql::firewall::iptables
+ require confdroid_postgresql::server::initdb
+ require confdroid_postgresql::server::pghba::pg_hba
+
+ service { $pl_service:
+ ensure => running,
+ hasstatus => true,
+ hasrestart => true,
+ enable => true,
+ }
+ }
+}
+ |
+
confdroid_postgresql::bouncer::bouncer_rule.pp Module name: confdroid_postgresql Author: 12ww1160 (12ww1160@confdroid.com)
+ +
+ + + +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26+ |
+
+ # File 'manifests/bouncer/bouncer_rule.pp', line 10
+
+define confdroid_postgresql::bouncer::bouncer_rule (
+
+ String $pl_bouncer_db_name = undef,
+ String $pl_bouncer_host = '127.0.0.1',
+ String $pl_bouncer_port = '5432',
+ String $pl_bounce_order = undef,
+
+) {
+ $pl_bouncer_ini_file = $confdroid_postgresql::params::pl_bouncer_ini_file
+ $pl_bouncer_ini_erb = $confdroid_postgresql::params::pl_bouncer_ini_erb
+
+ concat::fragment { "pl_bouncer_rule_${name}":
+ target => $pl_bouncer_ini_file,
+ content => template($pl_bouncer_ini_erb),
+ order => $pl_bounce_order,
+ }
+}
+ |
+
confdroid_postgresql::server::databases::db_df Module name: confdroid_postgresql Author: 12ww1160 (12ww1160@confdroid.com.com)
+ +
+ + + +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+ |
+
+ # File 'manifests/server/databases/db_df.pp', line 13
+
+define confdroid_postgresql::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_content = $confdroid_postgresql::params::pl_manage_content
+
+ if $pl_manage_content == true {
+ # create databases
+
+ if $pl_db_action == 'CREATE DATABASE' {
+ exec { "create_database_${name}":
+ command => template('confdroid_postgresql/server/databases/db_create_sql.erb'),
+ user => 'postgres',
+ path => ['/usr/bin','/bin'],
+ cwd => '/tmp',
+ unless => template('confdroid_postgresql/server/databases/unless_db_sql.erb'),
+ }
+ }
+
+ # Drop databases
+
+ if $pl_db_action == 'DROP DATABASE' {
+ exec { "drop_database_${name}":
+ command => template('confdroid_postgresql/server/databases/db_drop_sql.erb'),
+ user => 'postgres',
+ path => ['/usr/bin','/bin'],
+ cwd => '/tmp',
+ onlyif => template('confdroid_postgresql/server/databases/unless_drop_sql.erb'),
+ }
+ }
+ }
+}
+ |
+
confdroid_postgresql::server::pghba::pg_hba_rule Module name: confdroid_postgresql Author: 12ww1160 (12ww1160@confdroid.com)
+ +
+ + + +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45+ |
+
+ # File 'manifests/server/pghba/pg_hba_rule.pp', line 22
+
+define confdroid_postgresql::server::pghba::pg_hba_rule (
+
+ Optional[String] $pl_auth_type = undef,
+ Optional[String] $pl_auth_database = undef,
+ Optional[String] $pl_auth_user = undef,
+ Optional[String] $pl_auth_address = undef,
+ Optional[String] $pl_auth_method = undef,
+ Optional[String] $pl_auth_option = undef,
+ Optional[String] $pl_auth_order = undef,
+ Optional[String] $pl_auth_description = undef,
+
+) {
+ $pl_pg_hba_conf = $confdroid_postgresql::params::pl_pg_hba_conf
+ $pl_pg_hba_rule_conf = $confdroid_postgresql::params::pl_pg_hba_rule_conf
+ $pl_data_dir = $confdroid_postgresql::params::pl_data_dir
+
+# create rule fragment
+
+ concat::fragment { "pl_rule_${name}":
+ target => $pl_pg_hba_conf,
+ content => template($pl_pg_hba_rule_conf),
+ order => $pl_auth_order,
+ }
+}
+ |
+
+ + + +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33+ |
+
+ # File 'manifests/server/roles/role_df.pp', line 12
+
+define confdroid_postgresql::server::roles::role_df (
+
+ Optional[String] $pl_role_name = undef,
+ Optional[String] $pl_role_pw = undef,
+ String $pl_role_attributes = 'LOGIN',
+ String $pl_role_status = 'CREATE ROLE',
+
+) {
+ $pl_manage_content = $confdroid_postgresql::params::pl_manage_content
+
+ if $pl_manage_content == true {
+ # create the role
+
+ exec { "role_${name}":
+ command => template('confdroid_postgresql/server/roles/role.sql.erb'),
+ user => 'postgres',
+ path => ['/usr/bin','/bin'],
+ cwd => '/tmp',
+ unless => template('confdroid_postgresql/server/roles/unless_sql.erb'),
+ }
+ }
+}
+ |
+