Forge Home


Manages host entries


5,911 latest version

4.3 quality score

We run a couple of automated
scans to help you access a
module's quality. Each module is
given a score based on how well
the author has formatted their
code and documentation and
modules are also checked for
malware using VirusTotal.

Please note, the information below
is for guidance only and neither of
these methods should be considered
an endorsement by Puppet.

Version information

  • 2.5.1 (latest)
released Jun 20th 2017
This version is compatible with:
  • Puppet Enterprise 2017.2.x, 2017.1.x, 2016.5.x, 2016.4.x
  • Puppet >= 3.0.0 < 5.0.0
  • Debian, RedHat, CentOS, OracleLinux, Scientific, Solaris, SLES, SLED, Ubuntu

Start using this module

  • r10k or Code Manager
  • Bolt
  • Manual installation
  • Direct download

Add this module to your Puppetfile:

mod 'gearboxscott-hosts', '2.5.1'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add gearboxscott-hosts
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install gearboxscott-hosts --version 2.5.1

Direct download is not typically how you would use a Puppet module to manage your infrastructure, but you may want to download the module in order to inspect the code.



gearboxscott/hosts — version 2.5.1 Jun 20th 2017

Origin Credits:

This module was originally forked from Garrett Honeycutt's puppet-module-hosts. The host resource was updated to allow the creation of FQDN in /etc/hosts files (Issue #40:

Doesn't appear the Garrett is maintaining this module anymore on the Puppet Forge. Reposting this module on the Puppet Forge with the correction in place.

hosts module

Manage host entries.

Can ensure entries for localhost, localhost6, and $::fqdn, including aliases and optionally purge unmanaged entries.

Build Status



This module is built for use with Puppet v3 (with and without the future parser) and Puppet v4 on the following platforms and supports Ruby versions 1.8.7, 1.9.3, 2.0.0, 2.1.0 and 2.3.1.

It should work with any *nix based system that uses /etc/hosts.




Boolean to enable ipv4 localhost entry

  • Default: true


Boolean to enable ipv6 localhost entry

  • Default: true


Boolean to enable entry for fqdn

  • Default: true


When enabled use the ${::fqdn} fact to determine the hosts entry for the local node.

  • Default: true


String or Array of aliases for fqdn

  • Default: $::hostname


String or Array of aliases for localhost

  • Default: [ 'localhost', 'localhost4', 'localhost4.localdomain4' ]


String or Array of aliases for localhost6

  • Default: [ 'localhost6', 'localhost6.localdomain6' ]


Boolean to optionally purge unmanaged entries from hosts

  • Default: false


String for path to hosts file

  • Default: /etc/hosts


Boolean to optionally collect all the exported Host resources

  • Default: false


Hash of host entries

  • Default: undef


Hiera example of host_entries

hosts::host_entries: '': ip: '' host_aliases:

  - 'servicename'