]> git.immae.eu Git - perso/Immae/Projets/Puppet.git/commitdiff
Create cryptoportfolio user
authorIsmaël Bouya <ismael.bouya@normalesup.org>
Sun, 18 Feb 2018 14:02:03 +0000 (15:02 +0100)
committerIsmaël Bouya <ismael.bouya@normalesup.org>
Sun, 18 Feb 2018 18:28:36 +0000 (19:28 +0100)
.gitmodules
environments/production/data/nodes/vps494082.yaml
modules/archive [new submodule]
modules/role/manifests/cryptoportfolio.pp

index 8071288e675d7406799f0d554e0ccc621a665025..e893f139cc6cf8db9b5117defe4d06323e11ab9c 100644 (file)
@@ -34,7 +34,9 @@
 [submodule "modules/nginx"]
        path = modules/nginx
        url = git://git.immae.eu/github/voxpupuli/puppet-nginx.git
+[submodule "modules/archive"]
+       path = modules/archive
+       url = git://git.immae.eu/github/voxpupuli/puppet-archive.git
 [submodule "python/ovh"]
        path = python/ovh
        url = git://git.immae.eu/github/ovh/python-ovh
-
index 1e14c8f85025794ec4a3c1a4dfed426c9e7d18b2..e9f2e54ed797277df8594ad624d216e1b9596f01 100644 (file)
@@ -1 +1,3 @@
 base_installation::system_hostname: cryptoportfolio.immae.eu
+cryptoportfolio::front_version: v0.0.1
+cryptoportfolio::front_sha256: 1a2ec0d1d2b4c3efa7f7cae063c55dda174d058f31d8b6fb50f76492061d37f3
diff --git a/modules/archive b/modules/archive
new file mode 160000 (submodule)
index 0000000..9af5cad
--- /dev/null
@@ -0,0 +1 @@
+Subproject commit 9af5cad2bbaafe0498032c38a37835e4ccba7d22
index 4643f9e03f2989e3f4a2cfba75659c8927d6a1ee..046b79ef3f223f4445ef4ee0e462c48fef2bf87b 100644 (file)
@@ -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"]
+    }
+  }
+
 }