diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2021-12-29 20:13:55 +0100 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2021-12-29 20:13:55 +0100 |
commit | d04542e000b8f8fadce45af96d93fb904ca99115 (patch) | |
tree | e85ee2bb0472d9f83f051f31d2629bf4c96bb755 /modules/systemd_mount/manifests/init.pp | |
parent | Setup new site.pp. (diff) | |
parent | Migrate stuff from ansible. (diff) | |
download | webdav_server-d04542e000b8f8fadce45af96d93fb904ca99115.tar.gz webdav_server-d04542e000b8f8fadce45af96d93fb904ca99115.tar.xz |
Merge branch 'master' of /home/hugo/puppet into production
Diffstat (limited to 'modules/systemd_mount/manifests/init.pp')
-rw-r--r-- | modules/systemd_mount/manifests/init.pp | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/modules/systemd_mount/manifests/init.pp b/modules/systemd_mount/manifests/init.pp new file mode 100644 index 0000000..ff081e4 --- /dev/null +++ b/modules/systemd_mount/manifests/init.pp @@ -0,0 +1,42 @@ +define systemd_mount ( + String $what, # elrond:/files + String $where, # /usr/net + Boolean $automount = false, + String $wantedBy = 'default.target', +) { + + $mostly_fixed = regsubst($where, '/', '-', 'G') + $fixed = if $mostly_fixed[0] == '-' { + $mostly_fixed[1, -1] # drop first char + } else { + $mostly_fixed + } + + systemd::unit_file { "${fixed}.mount": + content => epp('systemd_mount/mount.epp', { + what => $what, + where => $where, + wantedby => if ($automount) { '' } else { "WantedBy=${wantedBy}" }, + }), + } + + if ($automount) { + systemd::unit_file { "${fixed}.automount": + content => epp('systemd_mount/automount.epp', { + where => $where, + wantedBy => "WantedBy=${wantedBy}", + }), + } + + service { "${fixed}.automount": + enable => true, + ensure => running, + } + } else { + service { "${fixed}.mount": + enable => true, + ensure => running, + } + } + +} |