Allow remote access to Postgres based on hiera param
Also always update the rhizomatica role password if it has changed
This commit is contained in:
parent
99149dc916
commit
fb78bacc12
1 changed files with 23 additions and 2 deletions
|
@ -21,12 +21,27 @@ class rhizo_base::postgresql::common {
|
|||
$pgsql_user = $rhizo_base::pgsql_user
|
||||
$pgsql_pwd = $rhizo_base::pgsql_pwd
|
||||
$pgsql_host = $rhizo_base::pgsql_host
|
||||
|
||||
|
||||
postgresql::server::db { $pgsql_db:
|
||||
user => $pgsql_user,
|
||||
password => postgresql_password($pgsql_user, $pgsql_pwd),
|
||||
}
|
||||
|
||||
postgresql::server::role { $pgsql_user:
|
||||
password_hash => postgresql_password($pgsql_user, $pgsql_pwd),
|
||||
update_password => true
|
||||
}
|
||||
|
||||
if (hiera('rhizo::remote_postgres', 0) == 1) {
|
||||
|
||||
postgresql::server::pg_hba_rule { 'Network remote access':
|
||||
type => 'host',
|
||||
database => $pgsql_db,
|
||||
user => $pgsql_user,
|
||||
address => '10.23.100.0/24',
|
||||
auth_method => 'md5',
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class rhizo_base::postgresql::ubuntu inherits rhizo_base::postgresql::common {
|
||||
|
@ -42,11 +57,17 @@ class rhizo_base::postgresql::ubuntu inherits rhizo_base::postgresql::common {
|
|||
|
||||
class rhizo_base::postgresql::debian inherits rhizo_base::postgresql::common {
|
||||
|
||||
if (hiera('rhizo::remote_postgres', 0) == 1) {
|
||||
$listen = '*'
|
||||
} else {
|
||||
$listen = 'localhost'
|
||||
}
|
||||
class { 'postgresql::globals':
|
||||
manage_package_repo => true,
|
||||
version => '9.6',
|
||||
}->
|
||||
}->
|
||||
class { 'postgresql::server':
|
||||
listen_addresses => $listen,
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue