1 准备

  • 2台 centos7 (master/server:192.168.1.103 agent/client:192.168.1.106)
  • 分别添加puppet自定义仓库 https://yum.puppet.com/puppet6-release-el-7.noarch.rpm

2 Master/Server

设置 hostname

hostnamectl set-hostname puppet.example.net --static

设置 hosts

vi /etc/hosts

增加

192.168.1.103 puppet.example.net

安装 puppet server

yum -y install puppet-server

启动puppetmaster

systemctl start puppetmaster

systemctl enable puppetmaster

3 Agent/Client

设置hostname

nmtui->set system hostname->agent1.example.net

设置hosts

vi /etc/hosts

增加

192.168.1.106 agent1.example.net
192.168.1.103 puppet.example.net

安装puppet agent

yum -y install puppet

设置 puppet.conf

// vi /etc/puppet/puppet.conf
[agent]
certname = agent1.example.net
server = puppet.example.net
report = true

启动

systemctl start puppet.service
systemctl enable puppet.service

4 测试

client执行:puppet agent --test

输出

Info: Creating a new SSL key for agent1.example.net
Info: Caching certificate for ca
Info: csr_attributes file loading from /etc/puppet/csr_attributes.yaml
Info: Creating a new SSL certificate request for agent1.example.net
Info: Certificate Request fingerprint (SHA256): DB:21:15:C8:90:E4:2D:54:53:4C:A5:9A:4A:00:50:E7:99:5B:73:EE:0C:23:F9:7B:36:99:34:CD:FE:E6:DF:DA
Info: Caching certificate for ca
Exiting; no certificate found and waitforcert is disabled

最后一行不是错误

master执行:

  • puppet cert list 输出:
"agent1.example.net" (SHA256) 14:7D:AA:34:C8:F1:70:28:B9:51:A6:7D:94:3F:69:92:8F:61:94:17:7D:4A:EF:F2:44:CC:4A:BC:6B:D5:C3:EC
  • puppet cert sign agent1.example.net 或者 puppet cert sign --all

    输出:

Notice: Signed certificate request for agent1.example.net
Notice: Removing file Puppet::SSL::CertificateRequest agent1.example.net at '/var/lib/puppet/ssl/ca/requests/agent1.example.net.pem'

client再次执行

puppet agent --test

输出:

Info: Caching certificate for agent1.example.net
Info: Caching certificate_revocation_list for ca
Info: Caching certificate for agent1.example.net
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Caching catalog for agent1.example.net
Info: Applying configuration version '1428474782'
Info: Creating state file /var/lib/puppet/state/state.yaml
Notice: Finished catalog run in 0.05 seconds

在master上编辑 /etc/puppet/manifests/site.pp

node default {
file {"/tmp/test.txt":
content=>"I'm testing puppet\n";
}
}

在agent上执行 puppet agent --test

[root@agent1]# puppet agent --test
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Caching catalog for stor01.centos7.com
Info: Applying configuration version '1563239001'
Notice: /Stage[main]/Main/Node[default]/File[/tmp/test.txt]/ensure: defined content as '{md5}3ac8d756cdcb2a7594aa115a2f03e065'
Notice: Finished catalog run in 0.01 seconds
[root@stor01 puppet]# cat /tmp/test.txt
I'm testing puppet

参考资料

在 CentOS 7 上安装和配置 Puppet的更多相关文章

  1. 在 CentOS 7上安装并配置 Python 3.6 环境

    前言 按照此方法安装保证以下报错什么的统统都没有! 基础环境 系统:centos7.4 软件:python3 Retrying (Retry(total=0, connect=None, read=N ...

  2. Ubuntu/CentOS 系统上安装与配置Nginx

    一.在线安装: Ubuntu:sudo apt-get install nginx CentOS: sudo yum install nginx 二.安装后的位置: 1.服务地址:/etc/init. ...

  3. Ubuntu/Centos 系统上安装与配置Apache

    一.在线安装: Ubuntu:sudo apt-get install apache2 Centos: sudo yum install apache2 二.安装后的位置: 1.服务地址:/etc/i ...

  4. 怎样在 CentOS/RHEL 7/6 上安装和配置 Sendmail 服务器

    在 CentOS 上,可以通过 mailx 命令 或 sendmail 命令来给因特网发送电子邮件. 关于前者的文章比较多,关于后者的文章比较少. 这里记录了我在 CentOS 7 上安装和配置 se ...

  5. 在 CentOS 上安装和配置 OpenNebula

    转自:http://www.aikaiyuan.com/4889.html 我们提到的云计算一般有三种类型:软件即服务(Software as a Service, SaaS),平台即服务(Platf ...

  6. 怎样在CentOS 7.0上安装和配置VNC服务器

    VNC轻松连接远程Linux桌面 http://jingyan.baidu.com/article/6c67b1d6f1bac92786bb1e6d.html 这是一个关于怎样在你的 CentOS 7 ...

  7. 在Linux(CentOS 6.6)服务器上安装并配置基于Apache的SVN服务器

    #!/bin/bash # # 在Linux(CentOS 6.6)服务器上安装并配置基于Apache的SVN服务器: # # .安装服务 # .创建svn版本库 # .创建svn用户 # .配置sv ...

  8. 怎样在 CentOS 7.0 上安装和配置 VNC 服务器

    这是一个关于怎样在你的 CentOS 7 上安装配置 VNC 服务的教程.当然这个教程也适合 RHEL 7 .在这个教程里,我们将学习什么是 VNC 以及怎样在 CentOS 7 上安装配置 VNC ...

  9. 在Centos 7上安装配置 Apche Kafka 分布式消息系统集群

    Apache Kafka是一种颇受欢迎的分布式消息代理系统,旨在有效地处理大量的实时数据.Kafka集群不仅具有高度可扩展性和容错性,而且与其他消息代理(如ActiveMQ和RabbitMQ)相比,还 ...

随机推荐

  1. 【Matlab】运算符使用整理 * .* / \ .'

    [基本运算符] * :矩阵乘法or数与数相乘 .*:点乘,用于矩阵间对应元素的相乘,或数与数之间,数与矩阵之间的相乘. / :右除.a/b表示矩阵a乘以矩阵b的逆 \ :左除.a\b表示矩阵a的逆乘以 ...

  2. LuoguB2105 矩阵乘法 题解

    Content 给定一个 \(n\times m\) 的矩阵 \(A\) 和一个 \(m\times k\) 的矩阵 \(B\),求两个矩阵相乘得到的矩阵. \(n\times m\) 的矩阵 \(A ...

  3. grep的时候Binary file matches **.log 怎么解决

    操作 grep "hello world" test.log 结果 Binary file test.log matches 原因:grep认为test.log是二进制文件 解决方 ...

  4. awk 循环过滤EPC脚本

    无处理中EPC过滤脚本 #!/bin/bash if [ "$#" -lt 3 -o "$#" -gt 4 ];then #if [ "$#" ...

  5. 【C语言】Socket发送HTTP-TCP请求,数据有字符串插入

    问题描述: 场景:编写Socket接口,向LOKI发送POST请求查询数据 BUG发现位置:通过cJSON读取时间戳,发现被截断. 现象:通过read()去读取返回的数据,数据行中被插入字符:如下 c ...

  6. shell脚本报错:.sh: /bin/bash^M: 坏的解释器: 没有那个文件或目录

    .sh: /bin/bash^M: 坏的解释器: 没有那个文件或目录 这是因为shell脚本是Windows下编辑的 格式不一样 执行 sed -i 's/\r$//' 脚本名称.sh

  7. JAVA根据URL生成二维码图片、根据路径生成二维码图片

    引入jar包 zxing-2.3.0.jar.IKAnalyzer2012_u6.jar 下载地址:https://yvioo.lanzous.com/b00nlbp6h                ...

  8. SpringBoot 自定义注解

    新增注解类 NotRepeatSubmit.java package com.example.demo.annotation; import java.lang.annotation.ElementT ...

  9. 金智维RPA培训(一)产品基础架构-RPA学习天地

    1.产品组成分为:Server,control,agent三个组件,支持CS和BS架构.独有的中继服务器可以解决跨网段的问题,这里应该还是采用了多网卡模式. 其中:Agent负责对流程的执行工作.Co ...

  10. 一个VScode主题网站

    分享一个我常用的VScode主题网站 https://vscodethemes.com/dark 它提供了 深色和浅色主题供大家选择 查看主题插件 下载 深色 浅色