diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2018-03-05 17:29:29 +0100 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2018-03-05 17:36:54 +0100 |
commit | a4c92ff7477d09b480cab028411bc7c6b250604e (patch) | |
tree | 5a8394a64cf4a1d3fb9ffcdb3c8ed3328b94fb79 /modules/role/manifests | |
parent | d765eedf28199f6723dee5dab7c81a357be86f72 (diff) | |
download | Puppet-a4c92ff7477d09b480cab028411bc7c6b250604e.tar.gz Puppet-a4c92ff7477d09b480cab028411bc7c6b250604e.tar.zst Puppet-a4c92ff7477d09b480cab028411bc7c6b250604e.zip |
Add notification for app deployment
Diffstat (limited to 'modules/role/manifests')
-rw-r--r-- | modules/role/manifests/cryptoportfolio.pp | 25 |
1 files changed, 25 insertions, 0 deletions
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 { | |||
41 | $cf_bot_app_conf = "${cf_home}/bot_config.ini" | 41 | $cf_bot_app_conf = "${cf_home}/bot_config.ini" |
42 | $cf_bot_app_reports = "${cf_home}/bot_reports" | 42 | $cf_bot_app_reports = "${cf_home}/bot_reports" |
43 | 43 | ||
44 | $cf_webhook_url = lookup("cryptoportfolio::slack_webhook") |$key| { "" } | ||
45 | |||
44 | file { "/var/lib/postgres/data/certs": | 46 | file { "/var/lib/postgres/data/certs": |
45 | ensure => directory, | 47 | ensure => directory, |
46 | mode => "0700", | 48 | mode => "0700", |
@@ -179,6 +181,11 @@ class role::cryptoportfolio { | |||
179 | password => '!!', | 181 | password => '!!', |
180 | } | 182 | } |
181 | 183 | ||
184 | file { "/usr/local/bin/slack-notify": | ||
185 | mode => "0755", | ||
186 | source => "puppet:///modules/role/cryptoportfolio/slack-notify.py", | ||
187 | } | ||
188 | |||
182 | $front_version = lookup("cryptoportfolio::front_version") |$key| { {} } | 189 | $front_version = lookup("cryptoportfolio::front_version") |$key| { {} } |
183 | $front_sha256 = lookup("cryptoportfolio::front_sha256") |$key| { {} } | 190 | $front_sha256 = lookup("cryptoportfolio::front_sha256") |$key| { {} } |
184 | 191 | ||
@@ -261,6 +268,15 @@ class role::cryptoportfolio { | |||
261 | Archive["${cf_home}/trader_${bot_version}.tar.gz"] | 268 | Archive["${cf_home}/trader_${bot_version}.tar.gz"] |
262 | ], | 269 | ], |
263 | } | 270 | } |
271 | |||
272 | unless empty($cf_webhook_url) { | ||
273 | exec { "bot-slack-notify": | ||
274 | refreshonly => true, | ||
275 | command => "/usr/local/bin/slack-notify Trader '${cf_webhook_url}' '${bot_version}'", | ||
276 | require => File["/usr/local/bin/slack-notify"], | ||
277 | subscribe => Exec["py-cryptoportfolio-dependencies"], | ||
278 | } | ||
279 | } | ||
264 | } | 280 | } |
265 | 281 | ||
266 | # FIXME: restore backup | 282 | # FIXME: restore backup |
@@ -387,5 +403,14 @@ class role::cryptoportfolio { | |||
387 | command => "/usr/bin/make static ENV=${cf_env}", | 403 | command => "/usr/bin/make static ENV=${cf_env}", |
388 | refreshonly => true, | 404 | refreshonly => true, |
389 | } | 405 | } |
406 | |||
407 | unless empty($cf_webhook_url) { | ||
408 | exec { "front-slack-notify": | ||
409 | refreshonly => true, | ||
410 | command => "/usr/local/bin/slack-notify Front '${cf_webhook_url}' '${front_version}'", | ||
411 | require => File["/usr/local/bin/slack-notify"], | ||
412 | subscribe => [Exec["go-cryptoportfolio-app"], Exec["web-cryptoportfolio-build"]], | ||
413 | } | ||
414 | } | ||
390 | } | 415 | } |
391 | } | 416 | } |