CentOS 7下安装配置Puppet
来源:互联网 发布:python 对象 编辑:程序博客网 时间:2024/05/29 16:49
一、Puppet简介
Puppet是一种Linux、Unix平台的集中配置管理系统,使用ruby语言,可管理配置文件、用户、cron任务、软件包、系统服务等。Puppet把这些系统实体称之为资源,Puppet的设计目标是简化对这些资源的管理以及妥善处理资源间的依赖关系。
二、Puppet工作流程
1、客户端Puppetd调用facter,facter探测出主机的一些变量,例如主机名,内存大小,ip地址等。pupppetd 把这些信息通过ssl连接发送到服务器端;
2、服务器端的Puppetmaster 检测客户端的主机名,然后找到manifest里面对应的node配置, 并对该部分内容进行解析,facter送过来的信息可以作为变量处理,node牵涉到的代码才解析,其他没牵涉的代码不解析。解析分为几个阶段,语法检查,如果语法错误就报错。如果语法没错,就继续解析,解析的结果生成一个中间的“伪代码”,然后把伪代码发给客户端;
3、客户端接收到“伪代码”,并且执行,客户端把执行结果发送给服务器;
4、服务器端把客户端的执行结果写入日志。
三、安装准备(已关闭防火墙和selinux)
名称系统ip主机名masterCentOS 7192.168.152.131master.domain.comslavecentos 7192.168.152.132slave.domain.com四、安装步骤
4.1、master服务器配置
添加puppet自定义仓库
[root@master ~]# rpm -ivh https://yum.puppetlabs.com/el/7/products/x86_64/puppetlabs-release-7-10.noarch.rpm
安装puppetserver
[root@master ~]# yum install puppet-server
设置开机启动
[root@master ~]# systemctl enable puppetmaster.service
编辑hosts文件是两台服务器互通
[root@master ~]# vi /etc/hosts
添加如下两行
192.168.152.131 master.domain.com
192.168.152.132 slave.domain.com
[root@master ~]# vi /etc/puppet/puppet.conf
添加如下内容:
[master]
certname=master.domain.com//服务端的名字
启动服务
[root@master ~]# systemctl start puppetmaster.service
开机启动
[root@master ~]# systemctl enbale puppetmaster.service
4.2、配置客户端
[root@slave ~]# rpm -ivh https://yum.puppetlabs.com/el/7/products/x86_64/puppetlabs-release-7-10.noarch.rpm
[root@slave ~]# yum install puppet
[root@slave ~]#vi /etc/puppet/puppet.conf
添加如下内容:
[agent]
certname = slave.domain.com
server = master.domain.com
report = true
[root@slave ~]# systemctl start puppet.service
[root@slave ~]# systemctl enable puppet.service
测试:
[root@slave ~]# puppet agent --server=master.domain.com --verbose --no-daemonize --debug
[root@master manifests]# vi site.pp
服务器上配置site.pp
node default{
file{
"/mnt/pu":
owner =>"lila",
group=>"lila",
}
}
客户端执行
[root@slave mnt]# puppet agent -t
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Caching catalog for slave.domain.com
Info: Applying configuration version '1487772773'
Notice: /Stage[main]/Main/Node[default]/File[/mnt/pu]/owner: owner changed 'root' to 'lila'
Notice: /Stage[main]/Main/Node[default]/File[/mnt/pu]/group: group changed 'root' to 'lila'
Notice: Finished catalog run in 0.02 seconds
[root@slave mnt]# ll
total 4
-rw-rw-rw- 1 lila lila 6 Feb 22 08:08 pu
- CentOS 7下安装配置Puppet
- ubuntu下 puppet安装配置
- centos下用yum安装puppet
- CentOS 6.4安装Puppet
- puppet安装配置
- puppet 安装配置
- puppet 安装配置
- puppet安装配置
- Puppet 安装配置
- puppet 安装与配置
- PUPPET安装及PUPPET KICK 配置
- puppet原理、安装及配置
- puppet原理、安装及配置
- puppet的安装和配置
- puppet的安装及配置
- Puppet 安装配置快速入门
- puppet的yum安装配置
- CentOS 下配置安装
- mysql concat()
- flash重点截图
- okgo+rxjava简单的demo
- Elasticsearch自定义插件
- 软连接
- CentOS 7下安装配置Puppet
- 均匀分布和高斯分布
- PHP自动判断字符串是gb2312还是utf8编码
- centos7.3 二进制安装Mariadb10.2.8
- JAVA 根据设置的概率生成随机数
- php设计模式总结-工厂模式
- 最大间距—LintCode
- SQL语句2
- 注解@Primary使用概述