puppet安装配置文档for ubuntu

本文档详细介绍了在Ubuntu系统上安装并配置Puppet的步骤,包括配置source list、安装、设置master和agent、建立连接以及客户端运行。在master节点创建manifests文件,定义节点配置,并在agent节点上看到配置效果。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1.配置puppet source list

vi /etc/apt/source.list.d/puppetlabs.list
加入以下内容:
# Puppetlabs products
deb http://apt.puppetlabs.com precise main
deb-src http://apt.puppetlabs.com precise main


# Puppetlabs dependencies
deb http://apt.puppetlabs.com precise dependencies
deb-src http://apt.puppetlabs.com precise dependencies
执行apt-get update来更新源


2.安装

master端执行
apt-get install puppet puppetmaster facter
agetn端执行
apt-get install puppet facter


3.配置master

创建/etc/puppet/manifests/site.pp

在其中写入

import 'nodes.pp'
$puppetserver = 'test0002.cloud.cn'

新建/etc/puppet/manifests/nodes.pp用于测试

在其中写入:

node 'test0003.cloud.cn'{
  file{
    "/tmp/helloWorld":
    content=>"jimmy say hello to you\n",
    mode => 0644;
  }
}


4.配置agent

puppet安装好后要修改
/etc/default/puppet中的
START=yes才可以允许puppet运行


5.建立agent到master的连接

agent端执行
puppet agent --server=test0002.cloud.cn --no-daemonize --verbose 
master端执行
puppet cert --all and --list
可以通过puppet cert list --all查看所有已授权的连接


6.puppet模块目录结构

modue_name/
manifest/init.pp
files
templates
init.pp文件中要有一个和模块名称相同的类。
class module_name {
configuration...
}
最后使用include函数将一个模块应用到一个结点。
node 'example.puppet.com' {
include module_name
}


7.客户端运行

puppet agent --server=test0002.cloud.cn --no-daemonize --verbose --onetime --noop

可以执行

cat /tmp/helloWorld可以看到

jimmy say hello to you

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值