| Left: | ||
| Right: |
| OLD | NEW |
|---|---|
| (Empty) | |
| 1 # == Class: codereview | |
| 2 # | |
| 3 # A codereview server setup based on Rietveld and PostgreSQL. | |
| 4 # | |
| 5 # === Parameters: | |
| 6 # | |
| 7 # [*domain*] | |
| 8 # The auhority part of the URL the Rietveld instance is associated with. | |
| 9 # | |
| 10 # [*is_default*] | |
| 11 # Whether the $domain shall become set up as default (or fallback) | |
| 12 # within the HTTP daemon. | |
| 13 # | |
| 14 # [*certificate*] | |
| 15 # The name of the SSL certificate file within modules/private/files, if | |
| 16 # any. Requires a private_key as well. | |
| 17 # | |
| 18 # [*private_key*] | |
| 19 # The name of the private key file within modules/private/files, if any. | |
| 20 # Requires a certificate as well. | |
| 21 # | |
| 22 # [*database_account*] | |
| 23 # The name of the database account Rietveld shall use. | |
| 24 # | |
| 25 # [*database_password*] | |
| 26 # The password identifying Rietveld with the database. | |
| 27 # | |
| 28 # [*database_name*] | |
| 29 # The name of the Rietveld database within the RDBMS. | |
| 30 # | |
| 31 # === Examples: | |
| 32 # | |
| 33 # class {'codereview': | |
| 34 # domain => 'localhost', | |
| 35 # database_name => 'codereview', | |
| 36 # database_account => 'codereview', | |
| 37 # database_password => 'swordfish', | |
| 38 # } | |
| 39 # | |
| 40 class codereview( | |
| 41 $domain, | |
| 42 $is_default = false, | |
| 43 $certificate = undef, | |
| 44 $private_key = undef, | |
| 45 $database_account = hiera('codereview::database_account', 'rietveld'), | |
|
Felix Dahlke
2015/04/22 05:32:23
Should we really use defaults here? Seems preferab
mathias
2015/04/23 16:28:49
See my other comment regarding the rietveld parame
| |
| 46 $database_password = hiera('codereview::database_password', 'changeme'), | |
| 47 $database_name = hiera('codereview::database_name', 'codereview'), | |
| 48 ) { | |
| 49 | |
| 50 class {'postgresql::server': | |
|
Felix Dahlke
2015/04/22 05:32:23
Isn't this just an "include" then?
mathias
2015/04/23 16:28:49
You're right, it makes more sense to use an includ
| |
| 51 } | |
| 52 | |
| 53 postgresql::server::database {$database_name: | |
| 54 } | |
| 55 -> | |
| 56 postgresql::server::role {$database_account: | |
| 57 db => $database_name, | |
| 58 password_hash => postgresql_password($database_account, $database_password), | |
| 59 login => true, | |
| 60 superuser => false, | |
| 61 } | |
| 62 -> | |
| 63 postgresql::server::database_grant {$database_account: | |
| 64 db => $database_name, | |
| 65 privilege => 'ALL', | |
| 66 role => $database_account, | |
| 67 } | |
| 68 | |
| 69 class {'rietveld': | |
| 70 domain => $domain, | |
| 71 certificate => $certificate, | |
| 72 private_key => $private_key, | |
| 73 is_default => $is_default, | |
| 74 database => { | |
| 75 'engine' => 'postgresql_psycopg2', | |
| 76 'name' => $database_name, | |
| 77 'user' => $database_account, | |
| 78 'password' => $database_password, | |
| 79 }, | |
| 80 } | |
| 81 | |
| 82 package {['python-psycopg2']: | |
| 83 ensure => installed, | |
| 84 } | |
| 85 | |
| 86 Class['rietveld'] <- Package['python-psycopg2'] | |
| 87 Class['rietveld'] <- Postgresql::Server::Database_grant[$database_account] | |
| 88 } | |
| 89 | |
| OLD | NEW |