Defined Type: openiosds::systemdmount
- Defined in:
- manifests/systemdmount.pp
Overview
Configure mountpoints
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'manifests/systemdmount.pp', line 2
define openiosds::systemdmount (
$device = undef,
$mountpoint = undef,
$fstype = 'xfs',
$fsoptions = 'defaults,noatime,noexec',
$after = undef,
$automount = true,
$automount_timeoutidlesec = '20',
$automount_directorymode = '0755',
) {
# Validation
validate_string($device)
validate_string($mountpoint)
validate_string($fstype)
validate_string($fsoptions)
if $after { validate_string($after) }
validate_bool($automount)
validate_integer($automount_timeoutidlesec)
$mountpoint_name = systemd_escape($mountpoint)
# Configuration file
exec { "mkdir_p_${device}":
command => "/usr/bin/mkdir -p \'${device}\'",
unless => "/usr/bin/test -e \'${device}\'",
} ->
exec { "mkdir_p_${mountpoint}":
command => "/usr/bin/mkdir -p \'${mountpoint}\'",
unless => "/usr/bin/test -d \'${mountpoint}\'",
} ->
file { $mountpoint:
ensure => directory,
mode => '0755',
owner => 'root',
group => 'root',
} ->
file { "/etc/systemd/system/${mountpoint_name}.mount":
ensure => present,
content => template('openiosds/systemd.mount.conf.erb'),
mode => '0644',
}
service { "${mountpoint_name}.mount":
ensure => running,
require => File["/etc/systemd/system/${mountpoint_name}.mount"],
}
if $automount {
file { "/etc/systemd/system/${mountpoint_name}.automount":
ensure => present,
content => template('openiosds/systemd.automount.conf.erb'),
mode => '0644',
require => File["/etc/systemd/system/${mountpoint_name}.mount"],
}
service { "${mountpoint_name}.automount":
enable => true,
require => [File["/etc/systemd/system/${mountpoint_name}.automount"],Service["${mountpoint_name}.mount"]],
}
}
}
|