Created
April 18, 2011 18:39
-
-
Save jlgreer/925890 to your computer and use it in GitHub Desktop.
This file contains 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
#$Id$ | |
################################################################################ | |
# | |
# Set up clients to mount NFS shares on the filer with autofs | |
# | |
# NOTE: the cf2 version of nfsClient drove, with a file copy, the configuration | |
# of the nic for the storage network. Leaving that out now, since | |
# a) we should make that configuration reusable (the need for secondary nic | |
# management is broader than nfsClient); | |
# b) we should templatize when we do it, and we should define req'mts and | |
# decide how this should look for everybody; | |
# c) the storage nic is already set up for the mothership anyway, which is the | |
# immediate need. | |
# | |
# Before making this more broadly available, we should solve the eth>0 problem. | |
# | |
# -JG, 20110416 | |
# | |
################################################################################ | |
# Pass the name of the interface on the storage network, so its viability can | |
# be confirmed before starting portmap and autofs. | |
bundle agent nfsClient(storage_iface) { | |
vars: | |
NfsClient:: | |
# To do local testing on this bundle, set fileserver to localhost | |
# "fileserver" slist => { "localhost" }; | |
"fileserver" slist => { @(var.fileserver) }; | |
"prefix" string => "$(var.masterfiles)/dcsunix/NfsClient/pub"; | |
"chkconfig_on_nfsclient" slist => { "portmap", "autofs" }; | |
classes: | |
NfsClient:: | |
"portmap_running" | |
expression => returnszero("/etc/init.d/portmap status > /dev/null 2>&1", "useshell"); | |
"autofs_running" | |
expression => returnszero("/etc/init.d/autofs status > /dev/null 2>&1", "useshell"); | |
"storage_iface_viable" | |
expression => returnszero("/sbin/ifconfig $(storage_iface) | /bin/grep inet > /dev/null 2>&1", "useshell"); | |
methods: | |
NfsClient:: | |
"chkconfig_on" | |
# Make sure the services NfsClient needs at boot are chkconfig'ed on | |
usebundle => chkconfig_on("$(chkconfig_on_nfsclient)"); | |
files: | |
NfsClient:: | |
# Just points to /etc/auto.misc | |
"/etc/auto.master" | |
copy_from => copy_std("$(prefix)/etc/auto.master", | |
"@(fileserver)", "false", "timestamp"), | |
classes => if_repaired("autofs_restart"), | |
perms => mode_owner_group("0444", "root", "root"), | |
action => actionsettings_fix_inform("inform"); | |
# Host-specific configuration | |
"/etc/auto.misc" | |
copy_from => copy_std("$(prefix)/etc/auto.misc.$(host)", | |
"@(fileserver)", "false", "timestamp"), | |
classes => if_repaired("autofs_restart"), | |
perms => mode_owner_group("0444", "root", "root"), | |
action => actionsettings_fix_inform("inform"); | |
commands: | |
# | |
# Note: the classes that condition these promises ensure proper ordering; | |
# first ensure the viability of the storage interface, then bring up portmap, | |
# then bring up autofs. | |
# | |
# In v2, in order to make sure everything converged in one agent run, it was | |
# important that these promises appear in order in policy. In v3, that's not | |
# a requirement, because the agent takes 3 passes through policy, and that's | |
# enough for all of the stages here. | |
# | |
NfsClient.autofs_restart:: | |
"/etc/init.d/autofs restart" | |
# /dev/null the output | |
contain => container_std("root", true), | |
action => actionsettings_fix_inform_noisylogs("inform"); | |
## The remaining promises should be run infrequently, and we want to know | |
## when they are, so set them to howl... | |
NfsClient.!storage_iface_viable:: | |
"/sbin/ifdown $(storage_iface) && /sbin/ifup $(storage_iface)" | |
contain => container_std("root", false), | |
action => actionsettings_fix_inform_noisylogs("verbose"); | |
NfsClient.storage_iface_viable.!portmap_running:: | |
"/etc/init.d/portmap restart" | |
# /dev/null the output | |
contain => container_std("root", true), | |
action => actionsettings_fix_inform_noisylogs("verbose"); | |
NfsClient.storage_iface_viable.portmap_running.!autofs_running:: | |
"/etc/init.d/autofs restart" | |
# /dev/null the output | |
contain => container_std("root", true), | |
action => actionsettings_fix_inform_noisylogs("verbose"); | |
} | |
# The 4 bundles below eventually need to move to library.cf - using nfsClient as | |
# a guinea pig for chkconfig_on | |
bundle agent chkconfig_on(service) { | |
classes: | |
"service_is_enabled" | |
expression => returnszero("/sbin/chkconfig --level 3 $(service)", "noshell"); | |
commands: | |
!service_is_enabled:: | |
"/sbin/chkconfig $(service) on"; | |
} | |
# Not yet used but belongs with chkconfig_on; needs testing before using in | |
# production policy, at which point it should move to library.cf | |
bundle agent chkconfig_off(service) { | |
classes: | |
"service_is_enabled" | |
expression => returnszero("/sbin/chkconfig --level 3 $(service)", "noshell"); | |
commands: | |
service_is_enabled:: | |
"/sbin/chkconfig $(service) off"; | |
} | |
# Not yet used but belongs with chkconfig_on; needs testing before using in | |
# production policy, at which point it should move to library.cf | |
bundle agent chkconfig_add(service) { | |
classes: | |
"service_is_in_chkconfig" | |
expression => returnszero("/sbin/chkconfig --list $(service)", "noshell"); | |
commands: | |
!service_is_in_chkconfig:: | |
"/sbin/chkconfig --add $(service)"; | |
} | |
# Not yet used but belongs with chkconfig_on; needs testing before using in | |
# production policy, at which point it should move to library.cf | |
bundle agent chkconfig_del(service) { | |
classes: | |
"service_is_in_chkconfig" | |
expression => returnszero("/sbin/chkconfig --list $(service)", "noshell"); | |
commands: | |
service_is_in_chkconfig:: | |
"/sbin/chkconfig --del $(service)"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment