第一个例子,将例子保存到test.cf文件
- body common control # 主策略文件必须有"control body":包含一些设置和执行信息
- {
- bundlesequence => {"test"}; # bundlesequence指示bundle的调用顺序,这里test被调用
- }
- bundle agent test # bundle类型是agent的由cf-agent执行,包含promises(有点类似子程序)
- {
- reports: # promises的类型是reports,说明"Hello World"
- cfengine:: # 会输出到屏幕和日志里。后面会继续讲一些例子对输出重定向
- "Hello World!";
- }
# cf-promise -f ./test.cf 检查策略是否错误 # cf-agent -f ./test.cf 落实策略 # R: Hello World! 运行结果 # tail -1 /var/log/messages Mar 8 10:29:27 server cf3[13348]: R: Hello World!
转载于:https://blog.51cto.com/liuping0906/1151981