Skip to content

Instantly share code, notes, and snippets.

@developerinlondon
Forked from VertigoRay/init.pp
Last active August 29, 2015 14:15
Show Gist options
  • Save developerinlondon/efbb9baaabc0c7cda970 to your computer and use it in GitHub Desktop.
Save developerinlondon/efbb9baaabc0c7cda970 to your computer and use it in GitHub Desktop.
class sethostname {
file { "/etc/hostname":
ensure => present,
owner => root,
group => root,
mode => 644,
content => "$::fqdn\n",
notify => Exec["set-hostname"],
}
exec { "set-hostname":
command => "/bin/hostname -F /etc/hostname",
unless => "/usr/bin/test `hostname` = `/bin/cat /etc/hostname`",
notify => Service[$rsyslog::params::service_name],
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment