Added network::hostname class which sets hostname according to $homename fact.
This commit is contained in:
parent
3b4040d862
commit
f64fe99dbc
1 changed files with 37 additions and 0 deletions
|
@ -57,6 +57,43 @@ class network::helper::debian {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Set system hostname according to $homename variable.
|
||||||
|
#
|
||||||
|
class network::hostname {
|
||||||
|
|
||||||
|
case $operatingsystem {
|
||||||
|
"debian","ubuntu": {
|
||||||
|
file { "/etc/hostname":
|
||||||
|
ensure => present,
|
||||||
|
content => "${homename}\n",
|
||||||
|
mode => 0644,
|
||||||
|
owner => "root",
|
||||||
|
group => "root",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"centos","fedora": {
|
||||||
|
augeas { "set-hostname":
|
||||||
|
context => "/files/etc/sysconfig/network",
|
||||||
|
changes => "set HOSTNAME ${homename}",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"openbsd": {
|
||||||
|
file { "/etc/myname":
|
||||||
|
ensure => present,
|
||||||
|
content => "${homename}\n",
|
||||||
|
mode => 0644,
|
||||||
|
owner => "root",
|
||||||
|
group => "wheel",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
default: {
|
||||||
|
fail("network::hostname not supported on ${operatingsystem}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
# Configure interface.
|
# Configure interface.
|
||||||
#
|
#
|
||||||
# === Parameters
|
# === Parameters
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue