Created
March 5, 2012 21:31
-
-
Save nickanderson/1981225 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
body common control { | |
bundlesequence => { | |
"main", | |
}; | |
inputs => { | |
"cfengine_stdlib.cf", | |
}; | |
} | |
bundle agent main { | |
methods: | |
"any" usebundle => rh_set_hostname("node1", "domain.com"); | |
} | |
bundle agent rh_set_hostname(hostname, domainname){ | |
# Expects desired shorthostname and domain name both as strings; | |
# Usage: | |
# vars: | |
# "hostname" string => "jim"; | |
# "domain" string => "bob.com"; | |
# | |
# methods: | |
# "hostname" usebundle => rh_set_hostname("$(hostname)", "$(domain)"); | |
# | |
files: | |
"/tmp/network" | |
edit_line => replace_or_add("HOSTNAME=.*", "HOSTNAME=$(hostname)"), | |
classes => if_repaired("update_running_hostname"), | |
comment => "Redhat docs are WRONG, if you set this to fqdn it | |
will cause the hostname command to return the fqdn | |
instead of the shorthostname"; | |
"/tmp/network" | |
edit_line => replace_or_add("NISDOMAIN=.*", "NISDOMAIN=$(domainname)"), | |
classes => if_repaired("update_running_hostname"), | |
comment => "Set the domainname"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment