diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2018-04-21 01:09:28 +0200 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2018-04-21 10:21:23 +0200 |
commit | d5f4e591f9cfedefdd4a71515b46c78e9a77e2ad (patch) | |
tree | 58624f2d05cf74587ecf74fba92618f0c60b4bc9 /modules/role/manifests/cryptoportfolio | |
parent | 9f430d51eec914c00249b9dc73e82500d312d7af (diff) | |
download | Puppet-d5f4e591f9cfedefdd4a71515b46c78e9a77e2ad.tar.gz Puppet-d5f4e591f9cfedefdd4a71515b46c78e9a77e2ad.tar.zst Puppet-d5f4e591f9cfedefdd4a71515b46c78e9a77e2ad.zip |
Add redis to cryptoportfolio
Diffstat (limited to 'modules/role/manifests/cryptoportfolio')
-rw-r--r-- | modules/role/manifests/cryptoportfolio/bot.pp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/modules/role/manifests/cryptoportfolio/bot.pp b/modules/role/manifests/cryptoportfolio/bot.pp index 082e820..2f01c98 100644 --- a/modules/role/manifests/cryptoportfolio/bot.pp +++ b/modules/role/manifests/cryptoportfolio/bot.pp | |||
@@ -3,6 +3,7 @@ class role::cryptoportfolio::bot inherits role::cryptoportfolio { | |||
3 | 3 | ||
4 | $cf_bot_app = "${home}/bot" | 4 | $cf_bot_app = "${home}/bot" |
5 | $cf_bot_app_conf = "${home}/bot_config.ini" | 5 | $cf_bot_app_conf = "${home}/bot_config.ini" |
6 | $cf_bot_app_conf_hourly = "${home}/bot_config_hourly.ini" | ||
6 | $cf_bot_app_reports = "${home}/bot_reports" | 7 | $cf_bot_app_reports = "${home}/bot_reports" |
7 | 8 | ||
8 | ensure_packages(["python", "python-pip"]) | 9 | ensure_packages(["python", "python-pip"]) |
@@ -80,6 +81,36 @@ class role::cryptoportfolio::bot inherits role::cryptoportfolio { | |||
80 | ], | 81 | ], |
81 | } | 82 | } |
82 | 83 | ||
84 | if versioncmp($trader_version, "v1.3") >= 0 { | ||
85 | file { $cf_bot_app_conf_hourly: | ||
86 | owner => $user, | ||
87 | group => $group, | ||
88 | mode => "0600", | ||
89 | content => template("role/cryptoportfolio/bot_config_hourly.ini.erb"), | ||
90 | require => [ | ||
91 | User["$user:"], | ||
92 | Archive["${home}/trader_${trader_version}.tar.gz"], | ||
93 | ], | ||
94 | } | ||
95 | |||
96 | cron::job::multiple { "py-cryptoportfolio-hourly": | ||
97 | ensure => present, | ||
98 | environment => ["HOME=${home}","PATH=/usr/bin/"], | ||
99 | require => [ | ||
100 | File[$cf_bot_app_conf_hourly], | ||
101 | Archive["${home}/trader_${trader_version}.tar.gz"] | ||
102 | ], | ||
103 | jobs => [ | ||
104 | { | ||
105 | command => "cd $cf_bot_app ; python main.py --config $cf_bot_app_conf_hourly", | ||
106 | user => $user, | ||
107 | minute => 30, | ||
108 | description => "Print the current state to redis", | ||
109 | }, | ||
110 | ], | ||
111 | } | ||
112 | } | ||
113 | |||
83 | unless empty($webhook_url) { | 114 | unless empty($webhook_url) { |
84 | exec { "bot-slack-notify": | 115 | exec { "bot-slack-notify": |
85 | refreshonly => true, | 116 | refreshonly => true, |