Defined Type: hadoop::nfs::mount

Defined in:
manifests/nfs/mount.pp

Overview

Define: hadoop::nfs::mount

Mount NFS provided by HDFS NFS gateway. If hdfs_deployed is false, it will unmount instead.

The mountpoint doesn’t have to be collocated with the HDFS NFS gateway. When collocated, hadoop::nfs::service is required when mounting.

Parameters:

  • ensure (Any) (defaults to: mounted)
  • hdfs_deployed (Any) (defaults to: $hadoop::hdfs_deployed)
  • nfs_hostname (Any) (defaults to: $::fqdn)
  • nfs_mount_options (Any) (defaults to: $hadoop::nfs_mount_options)
  • nfs_mount_base_options (Any) (defaults to: 'vers=3,proto=tcp,nolock,noacl,sync')


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
# File 'manifests/nfs/mount.pp', line 7

define hadoop::nfs::mount(
  $ensure = mounted,
  $hdfs_deployed = $hadoop::hdfs_deployed,
  $nfs_hostname = $::fqdn,
  $nfs_mount_options = $hadoop::nfs_mount_options,
  $nfs_mount_base_options = 'vers=3,proto=tcp,nolock,noacl,sync',
) {
  include ::stdlib

  if !defined(Class['hadoop']) {
    fail('\'hadoop\' class is required for hadoop::nfs::mount')
  }

  $nfs_mount = $title

  if $nfs_mount_options and $nfs_mount_options != '' {
    $options = "${nfs_mount_base_options},${nfs_mount_options}"
  } else {
    $options = $nfs_mount_base_options
  }

  if $hdfs_deployed {
    $_ensure = $ensure
  } else {
    $_ensure = 'unmounted'
  }

  # no owner/permissions, it can be already mounted
  file { $nfs_mount:
    ensure => 'directory',
  }
  ->
  mount { $nfs_mount:
    ensure  => $_ensure,
    atboot  => true,
    device  => "${nfs_hostname}:/",
    fstype  => 'nfs',
    options => $options,
  }

  ensure_packages($hadoop::packages_system_nfs)
  Package[$hadoop::packages_system_nfs] -> Mount[$nfs_mount]
}