diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2018-02-24 23:31:16 +0100 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2018-02-24 23:32:39 +0100 |
commit | 236d7e6de849b1ee41e9ec1c81e670918a83264e (patch) | |
tree | 83932e6102a6d62d575d5a75bf323be32cf410ea /modules/role | |
parent | 6d512d3fc73ece6aba5842e73b3b662cd904433d (diff) | |
download | Puppet-236d7e6de849b1ee41e9ec1c81e670918a83264e.tar.gz Puppet-236d7e6de849b1ee41e9ec1c81e670918a83264e.tar.zst Puppet-236d7e6de849b1ee41e9ec1c81e670918a83264e.zip |
Add bot package
Diffstat (limited to 'modules/role')
-rw-r--r-- | modules/role/manifests/cryptoportfolio.pp | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/modules/role/manifests/cryptoportfolio.pp b/modules/role/manifests/cryptoportfolio.pp index d670486..9ed3375 100644 --- a/modules/role/manifests/cryptoportfolio.pp +++ b/modules/role/manifests/cryptoportfolio.pp | |||
@@ -35,6 +35,8 @@ class role::cryptoportfolio { | |||
35 | 35 | ||
36 | $cf_front_app_static_conf = "${cf_front_app}/cmd/web/env/prod.env" | 36 | $cf_front_app_static_conf = "${cf_front_app}/cmd/web/env/prod.env" |
37 | 37 | ||
38 | $cf_bot_app = "${cf_home}/bot" | ||
39 | |||
38 | file { "/var/lib/postgres/data/certs": | 40 | file { "/var/lib/postgres/data/certs": |
39 | ensure => directory, | 41 | ensure => directory, |
40 | mode => "0700", | 42 | mode => "0700", |
@@ -176,6 +178,43 @@ class role::cryptoportfolio { | |||
176 | $front_version = lookup("cryptoportfolio::front_version") |$key| { {} } | 178 | $front_version = lookup("cryptoportfolio::front_version") |$key| { {} } |
177 | $front_sha256 = lookup("cryptoportfolio::front_sha256") |$key| { {} } | 179 | $front_sha256 = lookup("cryptoportfolio::front_sha256") |$key| { {} } |
178 | 180 | ||
181 | $bot_version = lookup("cryptoportfolio::bot_version") |$key| { {} } | ||
182 | $bot_sha256 = lookup("cryptoportfolio::bot_sha256") |$key| { {} } | ||
183 | |||
184 | unless empty($bot_version) { | ||
185 | ensure_packages(["python", "python-pip"]) | ||
186 | |||
187 | file { $cf_bot_app: | ||
188 | ensure => "directory", | ||
189 | mode => "0700", | ||
190 | owner => $cf_user, | ||
191 | group => $cf_group, | ||
192 | require => User[$cf_user], | ||
193 | } | ||
194 | |||
195 | archive { "${cf_home}/${bot_version}.tar.gz": | ||
196 | path => "${cf_home}/${bot_version}.tar.gz", | ||
197 | source => "https://git.immae.eu/releases/cryptoportfolio/trader/trader_${bot_version}.tar.gz", | ||
198 | checksum_type => "sha256", | ||
199 | checksum => $bot_sha256, | ||
200 | cleanup => false, | ||
201 | extract => true, | ||
202 | user => "cryptoportfolio", | ||
203 | username => $facts["ec2_metadata"]["hostname"], | ||
204 | password => generate_password(24, $password_seed, "ldap"), | ||
205 | extract_path => $cf_bot_app, | ||
206 | require => [User[$cf_user], File[$cf_bot_app]], | ||
207 | } ~> | ||
208 | exec { "py-cryptoportfolio-dependencies": | ||
209 | cwd => $cf_bot_app, | ||
210 | user => $cf_user, | ||
211 | environment => ["HOME=${cf_home}"], | ||
212 | command => "/usr/bin/make install", | ||
213 | require => User[$cf_user], | ||
214 | refreshonly => true, | ||
215 | } | ||
216 | } | ||
217 | |||
179 | unless empty($front_version) { | 218 | unless empty($front_version) { |
180 | ensure_packages(["go", "npm", "nodejs", "yarn"]) | 219 | ensure_packages(["go", "npm", "nodejs", "yarn"]) |
181 | 220 | ||