diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2018-06-28 12:17:40 +0200 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2018-06-28 12:17:40 +0200 |
commit | 0a145a25c0a8cbcd50d515d2a828bd6665836ddb (patch) | |
tree | c6e3832098d19917b0ba0bcbe119103c632c7d29 /modules/profile/manifests/postgresql.pp | |
parent | f1d583bfdaf881116e5f9ca9e050307e7acdc28e (diff) | |
parent | 3925777d9715d271c0643faef9f520e7816dba89 (diff) | |
download | Puppet-0a145a25c0a8cbcd50d515d2a828bd6665836ddb.tar.gz Puppet-0a145a25c0a8cbcd50d515d2a828bd6665836ddb.tar.zst Puppet-0a145a25c0a8cbcd50d515d2a828bd6665836ddb.zip |
Merge branch 'refactoring' into dev
Diffstat (limited to 'modules/profile/manifests/postgresql.pp')
-rw-r--r-- | modules/profile/manifests/postgresql.pp | 64 |
1 files changed, 6 insertions, 58 deletions
diff --git a/modules/profile/manifests/postgresql.pp b/modules/profile/manifests/postgresql.pp index 2cd1bcc..97ce572 100644 --- a/modules/profile/manifests/postgresql.pp +++ b/modules/profile/manifests/postgresql.pp | |||
@@ -1,4 +1,7 @@ | |||
1 | class profile::postgresql { | 1 | class profile::postgresql ( |
2 | Optional[String] $pg_user = "postgres", | ||
3 | Optional[String] $pg_group = "postgres", | ||
4 | ) { | ||
2 | $password_seed = lookup("base_installation::puppet_pass_seed") | 5 | $password_seed = lookup("base_installation::puppet_pass_seed") |
3 | 6 | ||
4 | class { '::postgresql::globals': | 7 | class { '::postgresql::globals': |
@@ -7,16 +10,13 @@ class profile::postgresql { | |||
7 | pg_hba_conf_defaults => false, | 10 | pg_hba_conf_defaults => false, |
8 | } | 11 | } |
9 | 12 | ||
10 | # FIXME: get it from the postgresql module? | ||
11 | $pg_user = "postgres" | ||
12 | |||
13 | class { '::postgresql::client': } | 13 | class { '::postgresql::client': } |
14 | 14 | ||
15 | # FIXME: postgresql module is buggy and doesn't create dir? | 15 | # FIXME: postgresql module is buggy and doesn't create dir? |
16 | file { "/var/lib/postgres": | 16 | file { "/var/lib/postgres": |
17 | ensure => directory, | 17 | ensure => directory, |
18 | owner => $pg_user, | 18 | owner => $pg_user, |
19 | group => $pg_user, | 19 | group => $pg_group, |
20 | before => File["/var/lib/postgres/data"], | 20 | before => File["/var/lib/postgres/data"], |
21 | require => Package["postgresql-server"], | 21 | require => Package["postgresql-server"], |
22 | } | 22 | } |
@@ -26,59 +26,7 @@ class profile::postgresql { | |||
26 | listen_addresses => "*", | 26 | listen_addresses => "*", |
27 | } | 27 | } |
28 | 28 | ||
29 | postgresql::server::pg_hba_rule { 'local access as postgres user': | 29 | profile::postgresql::base_pg_hba_rules { "default": } |
30 | description => 'Allow local access to postgres user', | ||
31 | type => 'local', | ||
32 | database => 'all', | ||
33 | user => $pg_user, | ||
34 | auth_method => 'ident', | ||
35 | order => "00-01", | ||
36 | } | ||
37 | postgresql::server::pg_hba_rule { 'localhost access as postgres user': | ||
38 | description => 'Allow localhost access to postgres user', | ||
39 | type => 'host', | ||
40 | database => 'all', | ||
41 | user => $pg_user, | ||
42 | address => "127.0.0.1/32", | ||
43 | auth_method => 'md5', | ||
44 | order => "00-02", | ||
45 | } | ||
46 | postgresql::server::pg_hba_rule { 'localhost ip6 access as postgres user': | ||
47 | description => 'Allow localhost access to postgres user', | ||
48 | type => 'host', | ||
49 | database => 'all', | ||
50 | user => $pg_user, | ||
51 | address => "::1/128", | ||
52 | auth_method => 'md5', | ||
53 | order => "00-03", | ||
54 | } | ||
55 | postgresql::server::pg_hba_rule { 'deny access to postgresql user': | ||
56 | description => 'Deny remote access to postgres user', | ||
57 | type => 'host', | ||
58 | database => 'all', | ||
59 | user => $pg_user, | ||
60 | address => "0.0.0.0/0", | ||
61 | auth_method => 'reject', | ||
62 | order => "00-04", | ||
63 | } | ||
64 | |||
65 | postgresql::server::pg_hba_rule { 'local access': | ||
66 | description => 'Allow local access with password', | ||
67 | type => 'local', | ||
68 | database => 'all', | ||
69 | user => 'all', | ||
70 | auth_method => 'md5', | ||
71 | order => "10-01", | ||
72 | } | ||
73 | |||
74 | postgresql::server::pg_hba_rule { 'local access with same name': | ||
75 | description => 'Allow local access with same name', | ||
76 | type => 'local', | ||
77 | database => 'all', | ||
78 | user => 'all', | ||
79 | auth_method => 'ident', | ||
80 | order => "10-02", | ||
81 | } | ||
82 | 30 | ||
83 | } | 31 | } |
84 | 32 | ||