Skip to content

Instantly share code, notes, and snippets.

@VertigoRay
Created July 17, 2013 20:39
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save VertigoRay/6024253 to your computer and use it in GitHub Desktop.
Save VertigoRay/6024253 to your computer and use it in GitHub Desktop.
Puppet - sethostname /etc/puppet/modules/common/sethostname/manifests/init.pp
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