Puppet Class: mwv::hostname

Defined in:
puppet/modules/mwv/manifests/hostname.pp

Overview

Class: mwv::hostname

Set the hostname of the managed vm.

Parameters

hostname

Bare hostname

fqdn

Fully qualified hostname

Parameters:

  • hostname (Any)
  • fqdn (Any)


12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'puppet/modules/mwv/manifests/hostname.pp', line 12

class mwv::hostname (
    $hostname,
    $fqdn,
) {
    exec { 'set-hostname':
        command => "/usr/bin/hostnamectl set-hostname ${hostname}",
        unless  => "/bin/hostname -s|/bin/grep -Eq '^${hostname}'",
    }
    host { $fqdn:
        ensure       => 'present',
        ip           => '127.0.0.2',
        host_aliases => [
            $hostname,
        ],
    }
}