X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=modules%2Frole%2Fmanifests%2Fcryptoportfolio.pp;h=046b79ef3f223f4445ef4ee0e462c48fef2bf87b;hb=76a321e1b7da9f122f35a9722d9f8f331b06f8aa;hp=16c2f960a47fabe31604842a65274b4f933b12c3;hpb=0a4ec3790f89873bf37a1362a6f7e70b103e9bc2;p=perso%2FImmae%2FProjets%2FPuppet.git diff --git a/modules/role/manifests/cryptoportfolio.pp b/modules/role/manifests/cryptoportfolio.pp index 16c2f96..046b79e 100644 --- a/modules/role/manifests/cryptoportfolio.pp +++ b/modules/role/manifests/cryptoportfolio.pp @@ -27,12 +27,60 @@ class role::cryptoportfolio { order => "b0", } - ensure_packages("go") - class { 'nginx': } nginx::resource::server { 'cryptoportfolio.immae.eu': listen_port => 80, proxy => 'http://localhost:8000', } + + ensure_packages(["go", "npm", "nodejs", "yarn"]) + + user { "cryptoportfolio": + name => "cryptoportfolio", + ensure => "present", + managehome => true, + home => "/opt/cryptoportfolio", + system => true, + password => '!!', + } + + $front_version = lookup("cryptoportfolio::front_version") |$key| { {} } + $front_sha256 = lookup("cryptoportfolio::front_sha256") |$key| { {} } + + unless empty($front_version) { + file { "/opt/cryptoportfolio/front": + ensure => directory, + mode => "0700", + owner => "cryptoportfolio", + group => "cryptoportfolio", + } + + file { "/opt/cryptoportfolio/front/${front_version}": + ensure => directory, + mode => "0700", + owner => "cryptoportfolio", + group => "cryptoportfolio", + require => File["/opt/cryptoportfolio/front"], + } + + archive { "/opt/cryptoportfolio/front/${front_version}.tar.gz": + path => "/opt/cryptoportfolio/front/${front_version}.tar.gz", + source => "https://git.immae.eu/releases/cryptoportfolio/front/front_${front_version}.tar.gz", + creates => "/opt/cryptoportfolio/front/${front_version}/README.md", + checksum_type => "sha256", + checksum => $front_sha256, + cleanup => false, + extract => true, + extract_path => "/opt/cryptoportfolio/front/${front_version}", + require => File["/opt/cryptoportfolio/front/${front_version}"], + } + + file { "/opt/cryptoportfolio/front/current": + ensure => "link", + target => "/opt/cryptoportfolio/front/${front_version}", + require => Archive["/opt/cryptoportfolio/front/${front_version}.tar.gz"] + } + } + }