您的位置:首页 > 其它

Puppet-2:Puppet 配置第一个Agent

2015-09-22 00:00 239 查看
创建必要的目录。Manifests存放模块的主要配置文件init.pp

Puppet在应用类后会首先加载init.pp读取必要的信息

如果init.pp使用templates函数,会读取templates目录下的erb模块文件

当前的变量也会传入templates函数中

mkdir -p /etc/puppet/modules/test/{manifests,templates,files}
vi /etc/puppet/modules/test/manifests/init.pp

定义类:
class test{
file{"/tmp/$hostname.txt":
context => "Hello world";
}
}

定义模板
vi /etc/puppet/modules/test/templates/test.esb
hostname <%= fqdn %>

定义节点信息:节点目录可以任意定义,只需再site配置文件中import即可ru:
vi /etc/pupprt/manifests/nodes/agent1.harry.com.pp
node 'agent1.harry.com'{
include test
}

在site.pp文件中import节点信息
vi /etc/puppet/manifests/site.pp
import nodes/agent1.harry.com.pp
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: