-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set hostname via Puppet instead of Vagrant
Vagrant >=2.2.4 errors out while trying to set the hostname of an LXC container (<fgrehm/vagrant-lxc#481>). This combination will soon be common in Cloud VPS instances running Debian Buster, so work around the bug by pushing hostname setting into our Puppet code and avoid the Vagrant built-in management for it. Bug: T236455 Change-Id: Ib1a8fe41a8c858a8a12ecf939fb6c7e55f07704d
- Loading branch information
Showing
4 changed files
with
37 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# == Class: mwv::hostname | ||
# | ||
# Set the hostname of the managed vm. | ||
# | ||
# === Parameters | ||
# | ||
# [*hostname*] | ||
# Bare hostname | ||
# [*fqdn*] | ||
# Fully qualified hostname | ||
# | ||
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, | ||
], | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters