Changeset View
Changeset View
Standalone View
Standalone View
site-modules/profile/manifests/mountpoints.pp
# Handle mount points | # Handle mount points | ||||
class profile::mountpoints { | class profile::mountpoints { | ||||
$mountpoints = lookup('mountpoints', Hash, 'deep') | $mountpoints = lookup('mountpoints', Hash, 'deep') | ||||
each($mountpoints) |$mountpoint, $config| { | each($mountpoints) |$mountpoint, $config| { | ||||
if (has_key($config, 'options') and $config['options'] =~ Array) { | if (has_key($config, 'options') and $config['options'] =~ Array) { | ||||
$mount_config = $config + { | $mount_config = $config + { | ||||
options => join($config['options'], ','), | options => join($config['options'], ','), | ||||
} | } | ||||
} else { | } else { | ||||
$mount_config = $config | $mount_config = $config | ||||
} | } | ||||
if pick($config['ensure'], 'present') == 'present' { | |||||
exec {"create ${mountpoint}": | exec {"create ${mountpoint}": | ||||
creates => $mountpoint, | creates => $mountpoint, | ||||
command => "mkdir -p ${mountpoint}", | command => "mkdir -p ${mountpoint}", | ||||
path => ['/bin', '/usr/bin', '/sbin', '/usr/sbin'], | path => ['/bin', '/usr/bin', '/sbin', '/usr/sbin'], | ||||
} -> file {$mountpoint:} | } -> file {$mountpoint:} | ||||
$requires = [File[$mountpoint]] | |||||
} else { | |||||
$requires = [] | |||||
} | |||||
mount { | mount { | ||||
vsellier: shouldn't the mount be conditional to the ensure value too ? | |||||
Done Inline Actions* => $mount_config will override all the default: values with ones that come from the $mount_config hash. So, when ensure => absent is passed in the config, that'll carry over to the resource. olasd: `* => $mount_config` will override all the `default:` values with ones that come from the… | |||||
Not Done Inline ActionsAh yes, you are right. powerful feature (too for me :) ) vsellier: Ah yes, you are right. powerful feature (too for me :) ) | |||||
default: | default: | ||||
ensure => present, | ensure => present, | ||||
dump => 0, | dump => 0, | ||||
pass => 0, | pass => 0, | ||||
options => 'defaults'; | options => 'defaults'; | ||||
$mountpoint: | $mountpoint: | ||||
* => $mount_config, | * => $mount_config, | ||||
require => File[$mountpoint], | require => $requires, | ||||
} | } | ||||
} | } | ||||
} | } |
shouldn't the mount be conditional to the ensure value too ?