目录
1 概述32 安装准备32.1 操作系统环境32.2 版本33 安装43.1 下载Puppet自定义仓库43.2 master端安装Puppetserver43.3 agent端安装Puppet-agent54 运行Puppet64.1 master端启动puppet服务64.2 agent端启动puppet服务74.3 签发证书测试8
1 概述
浪潮信息KOS是浪潮信息基于Linux Kernel、OpenAnolis等开源技术自主研发的一款服务器操作系统,支持x86、ARM等主流架构处理器,性能和稳定性居于行业领先地位,具备成熟的 CentOS 迁移和替换能力,可满足云计算、大数据、分布式存储、人工智能、边缘计算等应用场景需求。详细介绍见官网链接https://www.ieisystem.com/kos/product-kos-xq.thtml?id=12126。
Puppet是一个IT基础设施自动化管理工具,它能够帮助系统管理员管理基础设施的整个生命周期:供应(provisioning)、配置(configuration)、联动(orchestration)及报告(reporting)。基于puppet ,可实现自动化重复任务、快速部署关键性应用以及在本地或云端完成主动管理变更和快速扩展架构规模等。Puppet对于系统管理员是抽象的,只依赖于ruby与facter,能管理多达40 多种资源,例如:file、user、group、host、package、service、cron、exec、yum repo等。详细介绍见官网链接https://www.puppet.com/。
2 安装准备
2.1 操作系统环境
版本信息:KeyarchOS 5.8sp1
硬件平台:X86_64
本次适配使用两台虚拟机,一台作为server端(master端),一台作为agent端。
2.2 版本
Puppetserver-7.14.0
Puppet-agent-7.27.0
厂商名称:Perforce Software, Inc.
3 安装
3.1 下载Puppet自定义仓库
两台机器均需执行以下步骤:
1、下载Puppet 实验室提供的自定义仓库,根据系统版本选择对应的rpm包
https://yum.puppetlabs.com/index.html
2、下载完成后进入存放路径,使用rpm -ivh命令安装:
3.2 master端安装Puppetserver
在master端执行以下操作:
1、安装puppetserver:
yum install puppetserver
2、设置主机名称后重启机器
hostnamectl set-hostname master.localdomain
reboot
3、修改/etc/hosts文件,添加agent和agent端的host信息:
其中,puppet对应本机ip,agent.localdomain对应agent端ip。
4、关闭防火墙:
systemctl disable firewalld
systemctl stop firewalld
systemctl status firewalld
3.3 agent端安装Puppet-agent
以下操作在agent端执行:
1、修改主机名后重启机器:
hostnamectl set-hostname agent.localdomain
reboot
2、配置/etc/hosts文件
将master端ip与其主机名信息添加至hosts文件。
3、安装puppet-agent
yum install puppet-agent
4、关闭防火墙
systemctl disable firewalld
systemctl stop firewalld
systemctl status firewalld
4 运行Puppet
4.1 master端启动puppet服务
1、启动puppetserver与puppet:
systemctl start puppetserver
systemctl status puppetserver
systemctl start puppet
systemctl status puppet
2、修改puppet配置文件,添加certname信息,定义自己签名认证的名称,即自己的主机名:
vim /etc/puppetlabs/puppet/puppet.conf
4.2 agent端启动puppet服务
1、修改puppet配置文件,添加certname信息,定义自己签名认证的名称,即自己的主机名;添加server信息即master主机名;添加runinterval信息,设置agent多长时间主动从master拉取一次资源:
vim /etc/puppetlabs/puppet/puppet.conf
2、启动puppet服务
systemctl start puppet
systemctl status puppet
4.3 签发证书测试
1、在agent端向master发起认证:
puppet agent -t
2、在master端查看认证请求:
puppetserver ca list --all
签发证书:
puppetserver ca sign --all
3、在agent端再次发起认证请求,可以看到已被认证:
puppet agent -t