Skip to content

Instantly share code, notes, and snippets.

@jfrantz1-r7
Created April 6, 2020 15:31
Show Gist options
  • Select an option

  • Save jfrantz1-r7/5dd8d5ec37228036049a6709935b9272 to your computer and use it in GitHub Desktop.

Select an option

Save jfrantz1-r7/5dd8d5ec37228036049a6709935b9272 to your computer and use it in GitHub Desktop.
class sethostname {
file { "/etc/hostname":
ensure => present,
owner => root,
group => root,
mode => '0644',
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`",
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment