summaryrefslogtreecommitdiffstats
path: root/modules/tozt/manifests/persistent.pp
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2018-11-13 00:19:06 -0500
committerJesse Luehrs <doy@tozt.net>2018-11-13 00:19:06 -0500
commitbf33ac997636c4b6c199cfff1e171ffaff437c91 (patch)
tree2f3d94f0ad3fddde69fec83c4d65356d60dea479 /modules/tozt/manifests/persistent.pp
parentb5fe67cdda8f05ffe814a923b1a69f7169b9db5c (diff)
downloadpuppet-tozt-bf33ac997636c4b6c199cfff1e171ffaff437c91.tar.gz
puppet-tozt-bf33ac997636c4b6c199cfff1e171ffaff437c91.zip
actually, let's make this shared again
Diffstat (limited to 'modules/tozt/manifests/persistent.pp')
-rw-r--r--modules/tozt/manifests/persistent.pp40
1 files changed, 40 insertions, 0 deletions
diff --git a/modules/tozt/manifests/persistent.pp b/modules/tozt/manifests/persistent.pp
new file mode 100644
index 0000000..0726455
--- /dev/null
+++ b/modules/tozt/manifests/persistent.pp
@@ -0,0 +1,40 @@
+class tozt::persistent {
+ file {
+ "/media":
+ ensure => directory;
+ "/media/persistent":
+ ensure => directory,
+ require => File["/media"],
+ }
+
+ $fstab_line = "/dev/disk/by-id/scsi-0DO_Volume_tozt-persistent /media/persistent ext4 rw,relatime 0 2"
+ exec { "populate fstab":
+ provider => shell,
+ command => "echo '${fstab_line}' >> /etc/fstab",
+ unless => "/usr/bin/grep -qF '${fstab_line}' /etc/fstab",
+ require => File["/media/persistent"],
+ }
+
+ exec { "mount /media/persistent":
+ provider => shell,
+ command => "/usr/bin/mount /media/persistent",
+ unless => "grep ' /media/persistent ' /proc/mounts",
+ require => [
+ File["/media/persistent"],
+ Exec["populate fstab"],
+ ]
+ }
+
+ file {
+ [
+ "/media/persistent/public_html",
+ "/media/persistent/paste",
+ "/media/persistent/git",
+ "/media/persistent/certbot",
+ "/media/persistent/cargo",
+ "/media/persistent/rustup",
+ ]:
+ ensure => directory,
+ require => Exec["mount /media/persistent"];
+ }
+}