主要功能
在多至上萬(wàn)臺(tái)主機(jī)的系統(tǒng)中,集中定義配置,然后自動(dòng)應(yīng)用到所有主機(jī)。
自動(dòng)進(jìn)行哪些配置呢?主要有:
²
網(wǎng)口配置
²
修改各種配置文件
²
建立并保持符號(hào)鏈接
²
掛接(mount)NFS文件系統(tǒng)
²
檢查和保持文件的權(quán)限信息
²
檢查重要文件
²
幫助運(yùn)行用戶腳本
²
進(jìn)程管理
組件結(jié)構(gòu)
cfagent從cfservd下載規(guī)則及需要的文件,然后通過(guò)規(guī)則配置本地系統(tǒng),達(dá)到整個(gè)網(wǎng)絡(luò)的集中配置。
其規(guī)則定義有專門的結(jié)構(gòu)。
Cfagent一般可以配作定時(shí)任務(wù)定期“被動(dòng)”運(yùn)行。Cfservd除用作“文件服務(wù)”外,還有個(gè)特殊功能,可以“主動(dòng)”運(yùn)行本機(jī)的cfagent,這是通過(guò)遠(yuǎn)端的cfrun來(lái)激發(fā)的。
規(guī)則語(yǔ)言:
即一個(gè)節(jié)一個(gè)節(jié)的定義動(dòng)作類型,動(dòng)作類型是預(yù)定義好的,用戶不能添加。
節(jié)中可以用“類”來(lái)對(duì)特定的一組主機(jī)進(jìn)行的操作,類以兩個(gè)冒號(hào)結(jié)尾。
action-type:
class1::
list of things to do...
class2::
list of things to do...
action-type:
groups, control, copy,
homeservers, binservers, mailserver, mountables,
import, broadcast, resolve,
defaultroute, directories, miscmounts,
files, ignore, tidy,
required, links, disable, shellcommands, strategies
editfiles, processes
Control節(jié)中的actionsequence就表示全部動(dòng)作的執(zhí)行順序,之后的節(jié)就定義需要執(zhí)行的動(dòng)作。
如下面即表示,在SUN4的操作系統(tǒng)上創(chuàng)建/bin->/usr/bin的符號(hào)鏈接
# Comment...
control:
actionsequence = ( links )
links:
sun4::
/bin -> /usr/bin
# other links
osf::
# other links
舉例
從policyhost拷貝文件到本地:
copy:
$(master_cfinput) dest=$(workdir)/inputs
r=inf
mode=700
type=binary
exclude=*.lst
exclude=*~
exclude=#*
server=$(policyhost)
刪除多余的過(guò)期文件:
tidy:
#
# Cfexecd stores output in this directory.
# Make sure we don't build up files and choke on our own
words!
#
$(workdir)/outputs pattern=* age=7
向文件.cshrc添加行:
{ home/.cshrc
AppendIfNoSuchLine "# Sys admin/cfengine: put next
line here"
AppendIfNoSuchLine "setenv PRINTER newprinter"
}
鏈接:
Intro to cfengine for system administration
Tutorial/Reference
posted on 2008-07-28 11:12
我愛佳娃 閱讀(562)
評(píng)論(0) 編輯 收藏 所屬分類:
網(wǎng)管 、
工具使用