aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas Vigier <boklm@mageia.org>2013-01-17 17:28:59 +0000
committerNicolas Vigier <boklm@mageia.org>2013-01-17 17:28:59 +0000
commit86114729e8c8288e12be7e494adfc302230f3931 (patch)
tree8be1c89fa1348830b49cc43992c8286c7855ef68
parentebe4bbc484513d496722d9d5fc60646cc3faa587 (diff)
downloadpuppet-86114729e8c8288e12be7e494adfc302230f3931.tar
puppet-86114729e8c8288e12be7e494adfc302230f3931.tar.gz
puppet-86114729e8c8288e12be7e494adfc302230f3931.tar.bz2
puppet-86114729e8c8288e12be7e494adfc302230f3931.tar.xz
puppet-86114729e8c8288e12be7e494adfc302230f3931.zip
Add postgresql::hba_entry and postgresql::var
-rw-r--r--modules/postgresql/manifests/hba_entry.pp40
-rw-r--r--modules/postgresql/manifests/server.pp23
-rw-r--r--modules/postgresql/manifests/var.pp8
3 files changed, 63 insertions, 8 deletions
diff --git a/modules/postgresql/manifests/hba_entry.pp b/modules/postgresql/manifests/hba_entry.pp
new file mode 100644
index 00000000..bc8afcc3
--- /dev/null
+++ b/modules/postgresql/manifests/hba_entry.pp
@@ -0,0 +1,40 @@
+# == Define: postgresql::hba_entry
+#
+# Set a new entry to pg_hba.conf file
+#
+# === Parameters
+#
+# See pgsql doc for more details about pg_hba.conf parameters :
+# http://www.postgresql.org/docs/9.1/static/auth-pg-hba-conf.html
+#
+# [*namevar*]
+# namevar is not used.
+#
+# [*type*]
+# can be local, host, hostssl, hostnossl
+#
+# [*database*]
+# database name
+#
+# [*user*]
+# user name
+#
+# [*address*]
+# host name or IP address range
+#
+# [*method*]
+# authentication method to use
+#
+define postgresql::hba_entry(
+ $type,
+ $database,
+ $user,
+ $address,
+ $method
+) {
+ include postgresql::var
+ Postgresql::Pg_hba <| title == $postgresql::var::hba_file |> {
+ conf_lines +> "${type} ${database} ${user} ${address} ${method}",
+ }
+}
+# vim: sw=2
diff --git a/modules/postgresql/manifests/server.pp b/modules/postgresql/manifests/server.pp
index 8089bb4c..85f5dda5 100644
--- a/modules/postgresql/manifests/server.pp
+++ b/modules/postgresql/manifests/server.pp
@@ -1,15 +1,14 @@
class postgresql::server {
- $pgsql_data = '/var/lib/pgsql/data/'
- $pg_version = '9.0'
+ include postgresql::var
# missing requires is corrected in cooker,
# should be removed
# once the fix is in a stable release
- package { "postgresql${pg_version}-plpgsql":
+ package { "postgresql${postgresql::var::pg_version}-plpgsql":
alias => 'postgresql-plpgsql',
}
- package { "postgresql${pg_version}-server":
+ package { "postgresql${postgresql::var::pg_version}-server":
alias => 'postgresql-server',
require => Package['postgresql-plpgsql'],
}
@@ -24,7 +23,7 @@ class postgresql::server {
openssl::self_signed_splitted_cert { "pgsql.$::domain":
filename => 'server',
- directory => $pgsql_data,
+ directory => $postgresql::var::pgsql_data,
owner => 'postgres',
group => 'postgres',
require => Package['postgresql-server']
@@ -35,12 +34,20 @@ class postgresql::server {
content => template('postgresql/pam'),
}
- postgresql::pg_hba { "${pgsql_data}/pg_hba.conf": }
+ @postgresql::pg_hba { $postgresql::var::hba_file: }
+
+ postgresql::hba_entry { 'allow_local_ipv4':
+ type => 'host',
+ database => 'all',
+ user => 'all',
+ address => '127.0.0.1/32',
+ method => 'md5',
+ }
postgresql::config {
- "$pgsql_data/pg_ident.conf":
+ "${postgresql::var::pgsql_data}/pg_ident.conf":
content => template('postgresql/pg_ident.conf');
- "$pgsql_data/postgresql.conf":
+ "${postgresql::var::pgsql_data}/postgresql.conf":
content => template('postgresql/postgresql.conf');
}
}
diff --git a/modules/postgresql/manifests/var.pp b/modules/postgresql/manifests/var.pp
new file mode 100644
index 00000000..094a83fd
--- /dev/null
+++ b/modules/postgresql/manifests/var.pp
@@ -0,0 +1,8 @@
+class postgresql::var(
+ $pgsql_data = '/var/lib/pgsql/data/',
+ $pg_version = '9.0'
+)
+{
+ $hba_file = "${pgsql_data}/pg_hba.conf"
+}
+# vim: sw=2