Skip to content

convectionlabs/puppet-module-hosts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

puppet-module-hosts

A wrapper around the Puppet Host Resource for managing operating system host entries via Hiera.

Requirements


  • Puppet version 3 or greater with Hiera support
  • Puppet Modules:
OS Family Module
ALL clabs/core

Usage


Load the host class via Puppet code or ENC:

include hosts

Configuration


All configuration settings should be defined using Hiera.

Minimum Hosts Standard

A standard/minimal hosts configuration is always present for convenience.

The follow shows the minimal standard in YAML format:

hosts::add:
    'localhost':
        'ensure'        : 'present'
        'ip'            : '127.0.0.1'
        'host_aliases'  :
            - 'localhost.localdomain'
        'comment'       : '## IPv4 loopback'
    'localhost6':
        'ensure'        : 'present'
        'ip'            :
        'host_aliases'  :
            - 'ip6-localhost'
            - 'ip6-loopback'
            - 'localhost6.localdomain6'
        'comment'       : '## IPv6 loopback & friends'

    'ip6-localnet':
        'ensure'        : 'present'
        'ip'            : 'fe00::0'
    'ip6-mcastprefix':
        'ensure'        : 'present'
        'ip'            : 'ff00::0'
    'ip6-allnodes': 
        'ensure'        : 'present'
        'ip'            : 'ff02::1'
    'ip6-allrouters': 
        'ensure'        : 'present'
        'ip'            : 'ff02::2'
    'ip6-allhosts': 
        'ensure'        : 'present'
        'ip'            : 'ff02::3'

    %{::fqdn}:
        'ensure'        : 'present'
        'ip'            : %{::ipaddress}
        'host_aliases'  : 
            - %{::hostname}
        'comment'       : '## Other hosts, starting with myself'

Example: Alter standard host entries

You may alter the the standard host entries as needed.

In the following example with Hiera Deeper Merging enabled:

  • disable the localhost6 entry
  • add an additional alias to a host while inheriting/preserving the remaining standard entries

Hiera config: hosts/myhostname.yaml

hosts::add:
    'localhost6':
        'ensure' : 'absent'
    %{::hostname}:
        'host_aliases':
            - 'myalias.foo.com'

Example: Adding a new host entry

In the following example:

  • add an additional host entry
  • preserve/inherit the remaining standard entries
hosts::add:
    'mynewhost':
        'ip'            : '1.2.3.4'
        'host_aliases'  :
            - 'mynewhost.mydomain.com'

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published