Defined Type: lmhosts::host
- Defined in:
- manifests/host.pp
Summary
Add a host entry to the lmhosts file.Overview
A host entry consists of an IPv4 address, an smb netbios name, and some optional flags.
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'manifests/host.pp', line 40
define lmhosts::host (
Stdlib::IP::Address::V4::Nosubnet $address,
Enum['absent','present'] $ensure = 'present',
Optional[Lmhosts::Host::Name] $domain = undef,
Lmhosts::Host::Name $host = regsubst($title, /\A(.+)[ ]([^\\\/:*?"<>|]{1,15})\z/, '\\2'),
Optional[Lmhosts::Order] $index = undef,
Boolean $multiple = false,
Stdlib::Absolutepath $path = regsubst($title, /\A(.+)[ ]([^\\\/:*?"<>|]{1,15})\z/, '\\1'),
Boolean $preload = true,
Optional[Integer[0x00,0xff]] $service = undef,
) {
$_address = sprintf('%-15s', $address)
$_domain = $domain ? {
undef => '',
default => " #DOM:${domain}"
}
$_host = $service ? {
undef => sprintf('%-22s', $host),
default => sprintf('"%-15s\\0x%2x"', $host, $service),
}
$_multiple = $multiple? {
false => '',
default => ' #MH',
}
$_preload = $preload ? {
false => '',
default => ' #PRE',
}
$_content = strip("${_address} ${_host}${_multiple}${_preload}")
concat::fragment { "lmhosts::host ${title}":
content => "${_content}\r\n",
order => $index,
target => $path,
}
}
|