Forge Home

hostname

Small Puppet module to easily set system hostname based on instance ID

28,424 downloads

22,847 latest version

2.1 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.

Support the Puppet Community by contributing to this module

You are welcome to contribute to this module by suggesting new features, currency updates, or fixes. Every contribution is valuable to help ensure that the module remains compatible with the latest Puppet versions and continues to meet community needs. Complete the following steps:

  1. Review the module’s contribution guidelines and any licenses. Ensure that your planned contribution aligns with the author’s standards and any legal requirements.
  2. Fork the repository on GitHub, make changes on a branch of your fork, and submit a pull request. The pull request must clearly document your proposed change.

For questions about updating the module, contact the module’s author.

Version information

  • 1.0.3 (latest)
  • 1.0.2
  • 1.0.1
  • 1.0.0
released Nov 30th 2016

Start using this module

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

Add this module to your Puppetfile:

mod 'jethrocarr-hostname', '1.0.3'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add jethrocarr-hostname
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install jethrocarr-hostname --version 1.0.3

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.

Download

Documentation

jethrocarr/hostname — version 1.0.3 Nov 30th 2016

puppet-hostname

Most cloud providers will generate a unique machine ID or name based on the parameters provided at launch time. On AWS, this will generally be "i-xyz123" on other providers like Digital Ocean it will be the human-assigned instance name eg "host1".

What they fail to do, is to set the FQDN of the server to anything useful. And sure, you could set it via your own Puppet code chucked into SOE, or you could add it as more bloat to your user data, but let's do something properly for once and have a nice tidy module for it. :-)

Features

  • Sets the FDQN hostname on a server.
  • Reload services that get impacted by hostname changes.
  • Planned: Also set DNS names on services like Route53.

Usage

Set the desired domain name via Hiera, and it will be appended:

hostname::domain: example.com

You can also define an array of services to reload after the hostname change: (just remember that the services must be defined in Puppet first)

hostname::reloads:
  - rsyslog

If you wish to override the default system hostname entirely, you can set both the hostname and the domain, eg:

hostname::hostname: host1
hostname::domain: example.com

Include the module in the usual fashion, ideally somewhere like your SOE module so your hostname is set before the installation of most services.

Requirements

No additional modules are required to make hostnames module work.

Development

Contributions via the form of Pull Requests always welcome. Ideas for PRs include:

  1. Setting of DNS on popular providers.
  2. Generate of machine IDs in new and creative ways.
  3. Finding the machine ID via reverse DNS?

License

This module is licensed under the Apache License, Version 2.0 (the "License"). See the LICENSE or http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.