]> git.immae.eu Git - perso/Immae/Projets/Puppet.git/blobdiff - modules/role/manifests/cryptoportfolio.pp
Merge branch 'cleanup' into dev
[perso/Immae/Projets/Puppet.git] / modules / role / manifests / cryptoportfolio.pp
index 4b03e1682031ae5b41c6bc30f3b29dafa4606175..799e297475ff6047234bf8fba5f27fda12a5019e 100644 (file)
@@ -1,30 +1,40 @@
-class role::cryptoportfolio {
+class role::cryptoportfolio (
+  String            $user,
+  String            $group,
+  String            $home,
+  Optional[String]  $env                 = "prod",
+  Optional[String]  $webhook_url         = undef,
+  String            $pg_user,
+  String            $pg_user_replication,
+  String            $pg_db,
+  Optional[String]  $pg_hostname          = "localhost",
+  Optional[String]  $pg_port              = "5432",
+  Optional[String]  $web_host             = undef,
+  Optional[String]  $web_port             = "",
+  Optional[Boolean] $web_ssl              = true,
+  Optional[String]  $front_version        = undef,
+  Optional[String]  $front_sha256         = undef,
+  Optional[String]  $bot_version          = undef,
+  Optional[String]  $bot_sha256           = undef,
+) {
   include "base_installation"
 
+  include "profile::tools"
   include "profile::postgresql"
+  include "profile::apache"
+  include "profile::xmr_stak"
 
-  $password_seed = lookup("base_installation::puppet_pass_seed") |$key| { {} }
+  contain "role::cryptoportfolio::postgresql"
+  contain "role::cryptoportfolio::apache"
 
-  postgresql::server::db { 'cryptoportfolio':
-    user =>  'cryptoportfolio',
-    password =>  postgresql_password('cryptoportfolio', generate_password(24, $password_seed, "postgres_cryptoportfolio")),
-  }
+  contain "role::cryptoportfolio::notify"
 
-  postgresql::server::pg_hba_rule { 'allow localhost TCP access to cryptoportfolio user':
-    type        => 'host',
-    database    => 'cryptoportfolio',
-    user        => 'cryptoportfolio',
-    address     => '127.0.0.1/32',
-    auth_method => 'md5',
-    order       => "b0",
+  unless empty($bot_version) {
+    contain "role::cryptoportfolio::bot"
   }
-  postgresql::server::pg_hba_rule { 'allow localhost ip6 TCP access to cryptoportfolio user':
-    type        => 'host',
-    database    => 'cryptoportfolio',
-    user        => 'cryptoportfolio',
-    address     => '::1/128',
-    auth_method => 'md5',
-    order       => "b0",
+
+  # FIXME: restore backup
+  unless empty($front_version) {
+    contain "role::cryptoportfolio::front"
   }
-  ensure_packages("go")
 }