From 76a321e1b7da9f122f35a9722d9f8f331b06f8aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isma=C3=ABl=20Bouya?= Date: Sun, 18 Feb 2018 15:02:03 +0100 Subject: Create cryptoportfolio user --- modules/archive | 1 + modules/role/manifests/cryptoportfolio.pp | 48 +++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 160000 modules/archive (limited to 'modules') diff --git a/modules/archive b/modules/archive new file mode 160000 index 0000000..9af5cad --- /dev/null +++ b/modules/archive @@ -0,0 +1 @@ +Subproject commit 9af5cad2bbaafe0498032c38a37835e4ccba7d22 diff --git a/modules/role/manifests/cryptoportfolio.pp b/modules/role/manifests/cryptoportfolio.pp index 4643f9e..046b79e 100644 --- a/modules/role/manifests/cryptoportfolio.pp +++ b/modules/role/manifests/cryptoportfolio.pp @@ -35,4 +35,52 @@ class role::cryptoportfolio { } 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"] + } + } + } -- cgit v1.2.3