Version information
This version is compatible with:
- Puppet Enterprise 2019.8.x, 2019.7.x, 2019.5.x, 2019.4.x, 2019.3.x, 2019.2.x, 2019.1.x, 2019.0.x, 2018.1.x, 2017.3.x, 2017.2.x, 2016.4.x
- Puppet >= 4.10.0 < 7.0.0
- , , , , , , , , , ,
Start using this module
Add this module to your Puppetfile:
mod 'pillarsdotnet-lmhosts', '0.2.1'
Learn more about managing modules with a PuppetfileDocumentation
lmhosts
Table of Contents
- Description
- Setup - The basics of getting started with lmhosts
- Usage - Configuration options and additional functionality
- Limitations - OS compatibility, etc.
- Development - Guide for contributing to the module
Description
This module manages the lmhosts
file.
The lmhosts
file allows certain information about your Windows network to be
pre-loaded without performing any network lookups.
Setup
For use with r10k
or
g10k
, add an entry to your
Puppetfile
as follows:
mod lmhosts,
:git -> 'https://github.com/pillarsdotnet/lmhosts'
For use with another module, add a dependency to its
metadata.json
file:
"dependencies": [
{
"name" : "pillarsdotnet/lmhosts",
"version_requirement": ">= 0.0.1 < 1.0.0"
},
]
Dependencies
For Windows clients, the
puppet/windows_env
module is required. Non-windows clients may ignore this dependency.
Usage
Generate a standard lmhosts file
This will create an lmhosts file containing an entry for localhost
, plus one
host entry for each node in the catalog.
include ::lmhosts
Add static entries for localhost and CORP-PDC
hieradata
lmhosts::list:
- address: '127.0.0.1'
host: 'localhost'
- address: '10.0.0.100'
host: 'corp-pdc'
puppet
include ::lmhosts
Reference
See REFERENCE.md
.
Development
Submit bug-reports, issues, and pull-requests to https://github.com/pillarsdotnet/puppet-lmhosts.
Changelog
See CHANGELOG.md
.
Reference
Table of Contents
Classes
lmhosts
: Manage the /etc/samba/lmhosts file.lmhosts::host::service
: Service codes for per-computer netbios services.
Defined types
lmhosts::alternates
: Adds an alternates block to the lmhosts file.lmhosts::host
: Add a host entry to the lmhosts file.lmhosts::include_path
: Add an #INCLUDE path to the lmhosts file.
Classes
lmhosts
This class manages entries within the Samba lmhosts file, based on documentation found at http://bit.ly/2L2zaYJ
Examples
class { 'lmhosts' :
list => [
{
'address' => '127.0.0.1',
'host' => 'localhost',
},
{ 'address' => '192.168.1.100',
'host' => 'pdc',
}
],
Parameters
The following parameters are available in the lmhosts
class.
list
Data type: Lmhosts::List
Ordered List of lmhosts entries.
Default value: [ { 'address' => '127.0.0.1', 'host' => 'localhost' } ]
no_export
Data type: Boolean
If true, do not export the current host for use by other nodes.
Default value: false
no_import
Data type: Boolean
If true, do not add exported host entries to this node's lmhosts file.
Default value: false
path
Data type: Stdlib::Absolutepath
Absolute path to the lmhosts file to manage.
Default value: [ '/etc/samba/lmhosts', "${facts['windows_env']['SYSTEMROOT']}\System32\drivers\etc\lmhosts" ][$facts['kernel'] ? { 'windows' => 1, default => 0 }]
lmhosts::host::service
This class provides reference variables.
- See also http://bit.ly/2J4CxvU
Defined types
lmhosts::alternates
Samba will attempt to load each alternate file in turn, stopping at the first available and ignoring the rest.
Examples
lmhosts::alternates { '/etc/lmhosts 1234':
alternates => [
'//pdc/share/lmhosts',
'//bdc/share/lmhosts',
]
}
Parameters
The following parameters are available in the lmhosts::alternates
defined type.
alternates
Data type: Array[Lmhosts::Include_path::Path]
The list of local or UNC file paths to load.
index
Data type: Lmhosts::Order
Used by stdlib::concat to assemble lmhosts fragments in the correct order.
Default value: regsubst($title, /\A(.+) \z/, '\2')
path
Data type: Stdlib::Absolutepath
The file path of the lmhosts file being managed.
Default value: regsubst($title, /\A(.+) \z/, '\1')
lmhosts::host
A host entry consists of an IPv4 address, an smb netbios name, and some optional flags.
Examples
lmhosts::host { '/etc/lmhosts localhost':
address: '127.0.0.1',
preload: true,
}
Parameters
The following parameters are available in the lmhosts::host
defined type.
address
Data type: Stdlib::IP::Address::V4::Nosubnet
The IPv4 address of this host entry.
ensure
Data type: Enum['absent','present']
Whether to remove ('absent') or add ('present') this host entry.
Default value: 'present'
domain
Data type: Optional[Lmhosts::Host::Name]
The Samba domain to which this host will be added, if diferent from the default domain.
Default value: undef
host
Data type: Lmhosts::Host::Name
The netbios name of this computer or service.
Default value: regsubst($title, /\A(.+) \z/, '\2')
index
Data type: Optional[Lmhosts::Order]
Used by the concat module to assemble the lmhosts file from parts.
Default value: undef
multiple
Data type: Boolean
If true, this is one of up to 25 entries for the same host.
Default value: false
path
Data type: Stdlib::Absolutepath
The location of the lmhosts file.
Default value: regsubst($title, /\A(.+) \z/, '\1')
preload
Data type: Boolean
If true (default), this entry should be preloaded into cache.
Default value: true
service
Data type: Optional[Integer[0x00,0xff]]
An optional integer service code. See $lmhosts::host::service
Default value: undef
lmhosts::include_path
If the order and path are unspecified, the title must consist of a filepath followed by a space and a valid order string.
Examples
lmhosts::include_path { '/etc/lmhosts 1234':
include_path => '//pdc/share/lmhosts',
}
Parameters
The following parameters are available in the lmhosts::include_path
defined type.
include_path
Data type: Lmhosts::Include_path::Path
Local path or UNC of the lmhosts fragment to include.
index
Data type: Lmhosts::Order
Used by stdlib::concat to assemble lmhosts fragments in the correct order.
Default value: regsubst($title, /\A(.+) \z/, '\2')
path
Data type: Stdlib::Absolutepath
The file path of the lmhosts file being managed.
Changelog
All notable changes to this project will be documented in this file.
Release 0.1.9
- Add pre-commit hooks.
Release 0.1.8
- Set #PRE by default.
Release 0.1.7
- More puppet-strings fixes.
Release 0.1.6
- Reworded defaults for puppet-strings compatibility.
Release 0.1.5
- Removed hiera layer and updated defaults.
Release 0.1.4 -- Initial release
Dependencies
- puppetlabs/stdlib (>= 5.0.0 < 7.0.0)
- puppet/windows_env (>= 3.2.0 < 4.0.0)