Skip to content

Latest commit

 

History

History
246 lines (144 loc) · 5.6 KB

REFERENCE.md

File metadata and controls

246 lines (144 loc) · 5.6 KB

Reference

Table of Contents

Classes

  • hosts: Manage /etc/hosts

Functions

Public Functions

Private Functions

  • hosts::collect_lo: Collect addresses on the loopback interface from fact networking.
  • hosts::collect_other: Collect addresses from all interfaces except loopback from fact networking.
  • hosts::excludefilter: Helper function for exclusion of addresses
  • hosts::includefilter: Helper function for inclusion of addresses
  • hosts::tabs: Helper function for creating right amount of tabs for alignment.

Classes

hosts

Manage /etc/hosts

Examples

With default entries only
include hosts
With all primary addresses
class { 'hosts':
  'one_primary_ipv4' => false,
  'one_primary_ipv6' => false,
}

Parameters

The following parameters are available in the hosts class:

file

Data type: Stdlib::Absolutepath

The file to manage.

Default value: '/etc/hosts'

one_primary_ipv4

Data type: Boolean

If true, only use the first address from primary_ipv4.

Default value: true

one_primary_ipv6

Data type: Boolean

If true, only use the first address from primary_ipv6.

Default value: true

enable_ipv4

Data type: Boolean

If false, don't add IPv4 loopback or primary addresses. (IPv4 addresses from hosts::entries is still added)

Default value: true

enable_ipv6

Data type: Boolean

If false, don't add IPv6 loopback or primary addresses. (IPv6 addresses from hosts::entries is still added)

Default value: true

include_ipv4

Data type: Array[String]

A list of regexp. If the list is empty all IPv4 addresses are included. If the list is not empty all IPv4 addresses matching any of the regexps are included.

Default value: []

include_ipv6

Data type: Array[String]

A list of regexp. If the list is empty all IPv6 addresses are included. If the list is not empty all IPv6 addresses matching any of the regexps are included.

Default value: []

exclude_ipv4

Data type: Array[String]

A list of regexp. Exclude IPv4 addresses that matches any of the regexps.

Default value: []

exclude_ipv6

Data type: Array[String]

A list of regexp. Exclude IPv6 addresses that matches any of the regexps.

Default value: []

include_ifs

Data type: Array[String]

A list of regexp. If the list is empty addresses from all interfaces are included. If the list is not empty only addresses from interfaces matching any of the regexps are included.

Default value: []

exclude_ifs

Data type: Array[String]

A list of regexp. Exclude addresses from interfaces that match any of the regexps.

Default value: []

loopback_if

Data type: String

The name of the loopback interface.

Default value: 'lo'

lo_ipv4

Data type: Array[Stdlib::IP::Address::V4::Nosubnet]

List of IPv4 addresses for localhost. Empty list means no entry.

Default value: hosts::collect_lo('ip',$loopback_if)

lo_ipv6

Data type: Array[Stdlib::IP::Address::V6::Nosubnet]

List of IPv6 addresses for localhost. Empty list means no entry.

Default value: hosts::collect_lo('ip6',$loopback_if)

primary_ipv4

Data type: Array[Stdlib::IP::Address::V4::Nosubnet]

List of IPv4 addresses. Empty list means no entry.

Default value: hosts::collect_other('ip',$loopback_if, $include_ifs,$exclude_ifs)

primary_ipv6

Data type: Array[Stdlib::IP::Address::V6::Nosubnet]

List of IPv6 addresses. Empty list means no entry.

Default value: hosts::collect_other('ip6',$loopback_if, $include_ifs,$exclude_ifs)

lo_names

Data type: Array[String]

List of names for localhost.

Default value: [ 'localhost' ]

primary_names

Data type: Array[String]

List of names for primary addresses.

Default value: [ $::fqdn, $::hostname ]

root_group

Data type: Variant[Integer[0],String[1]]

Group that should own the hosts file.

Default value: 'root'

entries

Data type: Hash

A hash with additional host entries to add. Entries in this hash overrides automatic hostentries for IP's on local interfaces. The content can be either comment => { ip => [ names ], ... } or just ip => [ names ].

Default value: {}

Functions