随笔-124  评论-194  文章-0  trackbacks-0

主要功能

在多至上万台主机的系统中,集中定义配置,然后自动应用到所有主机。

自动进行哪些配置呢?主要有:

²       网口配置

²       修改各种配置文件

²       建立并保持符号链接

²       挂接(mount)NFS文件系统

²       检查和保持文件的权限信息

²       检查重要文件

²       帮助运行用户脚本

²       进程管理


组件结构

cfagent从cfservd下载规则及需要的文件,然后通过规则配置本地系统,达到整个网络的集中配置。

其规则定义有专门的结构。

Cfagent一般可以配作定时任务定期“被动”运行。Cfservd除用作“文件服务”外,还有个特殊功能,可以“主动”运行本机的cfagent,这是通过远端的cfrun来激发的。

规则语言:

即一个节一个节的定义动作类型,动作类型是预定义好的,用户不能添加。

节中可以用“类”来对特定的一组主机进行的操作,类以两个冒号结尾。

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节中的actionsequence就表示全部动作的执行顺序,之后的节就定义需要执行的动作。

如下面即表示,在SUN4的操作系统上创建/bin->/usr/bin的符号链接

# 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)

删除多余的过期文件:

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 我爱佳娃 阅读(538) 评论(0)  编辑  收藏 所属分类: 网管工具使用

只有注册用户登录后才能发表评论。


网站导航: