SHARE
TWEET

Untitled

Korolv Mar 20th, 2019 94 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class profile::postgresqlsimple (
  2.   String $pg_listen_addresses = '172.27.0.0/16',
  3.   String $pg_version          = '10',
  4.   String $pg_user             = 'postgres',
  5.   String $pg_database         = 'postgres',
  6.   String $pg_password         = '2281488',
  7.   String $pg_hba_ip           = '172.27.0.0/16',
  8. ) {                                      
  9.   class {'postgresql::globals':
  10.     manage_package_repo => true,
  11.     version             => $pg_version,
  12.     require             => Package['apt-transport-https']
  13.   }
  14.  
  15.   class {'postgresql::server':
  16.     listen_addresses    => $pg_listen_addresses,
  17.   }
  18.  
  19.  
  20.   postgresql::server::role { $pg_user:
  21.     password_hash       => postgresql_password($pg_user, $pg_password),
  22.   }
  23.  
  24.   postgresql::server::db { $pg_database :
  25.     user      => $pg_user,
  26.     password  => postgresql_password($pg_user, $pg_password),
  27.   }
  28.  
  29.  
  30.   postgresql::server::database_grant { $pg_database:
  31.     privilege           => 'ALL',
  32.     db                  => $pg_database,
  33.     role                => $pg_user,
  34.     require             => Postgresql::Server::Db[$pg_database],
  35.   }
  36.  
  37.   postgresql::server::pg_hba_rule { 'allow applications':
  38.     description => 'Open ip from app',
  39.     type        => 'host',
  40.     database    => 'all',
  41.     user        => 'all',
  42.     address     => $pg_hba_ip,
  43.     auth_method => 'md5',
  44.   }
  45.  
  46.   file { "/etc/profile.d/append-postgresql-bin.sh":
  47.     mode    => '644',
  48.     content => "PATH=\$PATH:/usr/lib/postgresql/$pg_version/bin/",
  49.   }
  50. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top