X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=modules%2Frole%2Fmanifests%2Fcryptoportfolio.pp;h=67d88fb7b38c97e21e2c0780d1b3788e2a937c7a;hb=a4c92ff7477d09b480cab028411bc7c6b250604e;hp=6c760b580c9b0c9327e36a97fe85af492f275e08;hpb=d765eedf28199f6723dee5dab7c81a357be86f72;p=perso%2FImmae%2FProjets%2FPuppet.git diff --git a/modules/role/manifests/cryptoportfolio.pp b/modules/role/manifests/cryptoportfolio.pp index 6c760b5..67d88fb 100644 --- a/modules/role/manifests/cryptoportfolio.pp +++ b/modules/role/manifests/cryptoportfolio.pp @@ -41,6 +41,8 @@ class role::cryptoportfolio { $cf_bot_app_conf = "${cf_home}/bot_config.ini" $cf_bot_app_reports = "${cf_home}/bot_reports" + $cf_webhook_url = lookup("cryptoportfolio::slack_webhook") |$key| { "" } + file { "/var/lib/postgres/data/certs": ensure => directory, mode => "0700", @@ -179,6 +181,11 @@ class role::cryptoportfolio { password => '!!', } + file { "/usr/local/bin/slack-notify": + mode => "0755", + source => "puppet:///modules/role/cryptoportfolio/slack-notify.py", + } + $front_version = lookup("cryptoportfolio::front_version") |$key| { {} } $front_sha256 = lookup("cryptoportfolio::front_sha256") |$key| { {} } @@ -261,6 +268,15 @@ class role::cryptoportfolio { Archive["${cf_home}/trader_${bot_version}.tar.gz"] ], } + + unless empty($cf_webhook_url) { + exec { "bot-slack-notify": + refreshonly => true, + command => "/usr/local/bin/slack-notify Trader '${cf_webhook_url}' '${bot_version}'", + require => File["/usr/local/bin/slack-notify"], + subscribe => Exec["py-cryptoportfolio-dependencies"], + } + } } # FIXME: restore backup @@ -387,5 +403,14 @@ class role::cryptoportfolio { command => "/usr/bin/make static ENV=${cf_env}", refreshonly => true, } + + unless empty($cf_webhook_url) { + exec { "front-slack-notify": + refreshonly => true, + command => "/usr/local/bin/slack-notify Front '${cf_webhook_url}' '${front_version}'", + require => File["/usr/local/bin/slack-notify"], + subscribe => [Exec["go-cryptoportfolio-app"], Exec["web-cryptoportfolio-build"]], + } + } } }