一.puppet介紹
- (1)什么是puppet
puppet是一種重量級自動化運(yùn)維工具肠虽,實(shí)現(xiàn)自動化運(yùn)維以及能夠幫助系統(tǒng)管理員管理基礎(chǔ)設(shè)施的整個生命周期幔戏。因此基于puppet可以實(shí)現(xiàn)自動化重復(fù)任務(wù)、快速部署關(guān)鍵性應(yīng)用以及本地或云端完成主動管理變更和快速擴(kuò)展架構(gòu)規(guī)模等
適用系統(tǒng):Linux ,Unix,Windows
和ansible的區(qū)別:ansible屬于輕量級自動化運(yùn)維系統(tǒng)税课,在一般的小型企業(yè)中應(yīng)用廣泛闲延,而puppet屬于重量級運(yùn)維工具- (2)puppet開發(fā)語言
puppet有自己的開發(fā)語言,遵循GPL協(xié)議(2.7.0-),基于ruby語言開發(fā)
2.7.0以后使用(Apache 2.0 license)
(3)puppet作用
可以實(shí)現(xiàn)配置文件韩玩,設(shè)置用戶垒玲,制定cron計(jì)劃任務(wù),安裝軟件包找颓,管理軟件系統(tǒng)等功能合愈。puppet把這些系統(tǒng)實(shí)體稱之為資源,puppet的設(shè)計(jì)目標(biāo)是簡化對這些資源的管理以及妥善處理資源間的依賴關(guān)系击狮。puppet可以管理40多種資源
例:file佛析、group、user 彪蓬、host寸莫、package、service档冬、cron膘茎、exec、yum repo等- (3)puppet工作結(jié)構(gòu)
puppet采用C/S星狀的結(jié)構(gòu)酷誓,所有的客戶端和一個或幾個服務(wù)器交互披坏。每個客戶端周期的(默認(rèn)半個小時)向服務(wù)器發(fā)送請求,獲得其最新的配置信息盐数,保證和該配置信息同步棒拂。每個puppet客戶端每半小時(可以設(shè)置)連接一次服務(wù)器端, 下載最新的配置文件,并且嚴(yán)格按照配置文件來配置客戶端. 配置完成以后,puppet客戶端可以反饋給服務(wù)器端一個消息. 如果出錯,也會給服務(wù)器端反饋一個消息.
下載地址:https://yum.puppet.com
官網(wǎng)地址:https://www.puppet.com- (4)puppet的工作模型
1.單工作模型:手動應(yīng)用清單(manifest)
下載:yum install puppet(epel源),在centos6中的epel源沒有該安裝包
主程序:/usr/bin/puppet
配置文件:/etc/puppet/puppet.conf
2.master/agent模型
有agent端周期性的向master發(fā)送應(yīng)用請求清單并應(yīng)用于本地
下載:
master端: yum install puppet puppet-server
agent端:yum install puppet
二.puppet基本應(yīng)用(單模型)
(1)puppet的簡單命令
- help : Display Puppet help.
- apply: Apply Puppet manifests locally
describe Display help about resource types
搜狗截圖20171126152439.png- agent: The puppet agent daemon
- master: The puppet master daemon
module: Creates, installs and searches for modules on the Puppet Forge
搜狗截圖20171126153009.png
(2)資源的定義
向資源類型的屬性賦值來實(shí)現(xiàn)玫氢,可稱為資源類型實(shí)例化帚屉,定義了資源實(shí)例的文件(清單),manifest
- 定義資源的語法:
type {'title':
attribute1 => value1,
attribute2 => value2,
}
注意事項(xiàng):type必須是小寫字符琐旁,title是一個字符串,在同一類型中必須唯一- 資源屬性的三個特殊屬性:
Namevar:簡稱為name
ensure:資源的目標(biāo)狀態(tài)
provider:指明資源的管理接口
最常用的是ensure
(3)最常見的幾種資源的介紹與配置
1.group
主要屬性:
name:組名
gid:組id
system:是否為系統(tǒng)組
ensure:目標(biāo)狀態(tài)
members:成員用戶
示例:
vim group.pp(建議.pp結(jié)尾便于區(qū)分)
group{ 'mygrp':
ensure => present,——設(shè)置的狀態(tài)
name => mygrp,——組的名字
system => true,——定義為系統(tǒng)組
}
配置完成后讓清單生效
puppet apply -v(顯示過程) --noop(干跑猜绣,不生效) group.pp
確定沒錯后灰殴,去掉--noop執(zhí)行觀察結(jié)果
2.user
屬性:
name:用戶名;
uid: UID;
gid:基本組ID;
groups:附加組牺陶,不能包含基本組伟阔;
comment:注釋;
expiry:過期時間 掰伸;
home:家目錄皱炉;
shell:默認(rèn)shell類型;
system:是否為系統(tǒng)用戶 狮鸭;
ensure:present/absent合搅;
password:加密后的密碼串;
示例:
vim user1.pp
user{'user1':
ensure => present,
}
其他都為默認(rèn)狀態(tài)
vim user2.pp
user{'myuser':
ensure => present,
name => user2,
uid => 3002,
shell => '/bin/tcsh',——指定shell類型默認(rèn)為/bin/bash
home => '/tmp/user1',——指定家目錄
groups => mygrp,——指定附加組
}
配置完成后執(zhí)行puppet apply -v user1.pp和user2.pp
查看結(jié)果
注意:也可以為同一個用戶設(shè)置多個附加組歧蕉,但是要定義之間的依賴關(guān)系才能生效
重新 vim user2.pp
group{'testgrp':
ensure => present,
}
user{'myuser':
ensure => present,
name => user2,
uid => 3002,
shell => '/bin/tcsh',——指定shell類型默認(rèn)為/bin/bash
home => '/tmp/user1',——指定家目錄
require => [Group['mygrp'],Group['testgrp']],——定義依賴關(guān)系時的Type的首字母必須大寫
}
配置完成后還要執(zhí)行 cat group.pp >> user2.pp灾部,否則無法將mygrp設(shè)置為user2的附加組
然后執(zhí)行 puppet apply -v user2.pp生效
引入關(guān)系元參數(shù)的概念 before/require
A before B: B依賴于A,定義在A資源中惯退;
{
...
before => Type['B'],
...
}
B require A: B依賴于A赌髓,定義在B資源中;
{
...
require => Type['A'],
...
}
示例:vim user2.pp
1 group{'testgrp':
2 ensure => present,
3 before => User['myuser'],——表示被user{'myuser'}所依賴
4 }
5
6
7 user{'myuser':
8 ensure => present,
9 name => 'user2',
10 uid => 3002,
11 shell => '/bin/tcsh',
12 home => '/tmp/user2',
13 groups => ['mygrp', 'testgrp'],
14
15 }
16
17 group{ 'mygrp':
18 ensure => present,
19 name => 'mygrp',
20 system => true,
21 before => User['myuser'],——表示被user{'myuser'}所依賴
22 }
3.package
核心屬性:
ensure: installed ,present,latest,absent
name :包名
source:程序包的安裝來源
provider:指明安裝方式
示例:
vim package.pp
package{'redis':
ensure => latest,
}
4.service
基本屬性:
ensure
enable
name
path:目標(biāo)路徑
hasrestart:是否啟動重啟功能催跪,用true和false來區(qū)分
restart:具體的重啟的命令
start
stop
status
示例:
vim redis.pp
service {'redis':
ensure => latest,
enable => false,——開機(jī)不自啟動
hasrestart => true, ——開啟重啟功能
restart => 'systemctl restart redis',
require => Pakage['redis']——表示依賴于package資源
}
package{'redis':
ensure => latest,
}
puppet apply -v redis.pp
表示一旦安裝redis包后锁蠕,自動開啟redis服務(wù)
5.file資源
ensure:Whether the file should exist, and if so what kind of file it should be. Possible values are present
, absent
, file
, directory
, and link
.
file:類型為普通文件,其內(nèi)容由content屬性生成或復(fù)制由source屬性指向的文件路徑來創(chuàng)建懊蒸;
link:類型為符號鏈接文件荣倾,必須由target屬性指明其鏈接的目標(biāo)文件;
directory:類型為目錄榛鼎,可通過source指向的路徑復(fù)制生成逃呼,recurse屬性指明是否遞歸復(fù)制;
path:文件路徑者娱;
source:源文件抡笼;
content:文件內(nèi)容;
target:符號鏈接的目標(biāo)文件黄鳍;
owner:屬主
group:屬組
mode:權(quán)限推姻;
atime/ctime/mtime:時間戳;
- 示例
vim file.pp
file{'/etc/redis.conf':
ensure => file,——目標(biāo)狀態(tài)為文件
source => '/root/redis.conf',——定義的原路徑
owner => 'redis',——所有者
group => 'root',——所屬組
mode => '0644',——權(quán)限
注意:因?yàn)樵趂ile中已經(jīng)定義了目標(biāo)路徑的絕對路徑框沟,因此可以不再寫path
}
為了效果明顯藏古,在執(zhí)行puppet apply -v file.pp之前先cp /etc/redis.conf /root/
vim /root/redis.conf
將bind地址改為0.0.0.0
然后執(zhí)行puppet apply -v file.pp
發(fā)現(xiàn)/etc/redis.conf中的bind地址改為0.0.0.0
實(shí)現(xiàn)復(fù)制功能
- 示例2:實(shí)現(xiàn)目錄到目錄的復(fù)制
vim directory.pp
1 file{'yum.repos.d':
2 ensure => directory,
3 path => '/tmp/yum.repos.d',
4 source => '/etc/yum.repos.d',
5 recurse => true,——遞歸功能目的是將原目錄中的文件也一并復(fù)制到目標(biāo)目錄下
6 }
- 如果將文件復(fù)制到指定目錄上——結(jié)果指定的目錄仍然是文件
vim mulu2.pp
file {'test':
ensure => directory,
path => '/tmp/test',
source => ['/etc/issue', '/etc/group'],
}

顯示如圖仍然是文件,并且只有一個生效
* 示例3:定義link鏈接
vim link.pp
file{'redis.conf':
ensure => link,
path => '/tmp/redis.conf',
target =.> '/etc/redis.conf',——定義目標(biāo),path指向target定義的路徑
}
puppet apply -v link.pp
綜上我們可以定義一個綜合性的清單來實(shí)現(xiàn)安裝redis忍燥,還要完成文件的復(fù)制的功能拧晕,從而觸發(fā)redis服務(wù)重啟
vim redis.pp
package{'redis':
ensure => latest,
name => 'redis',
}
file{'redis.conf':
ensure =>file,
path => '/etc/redis.conf',
source => '/root/redis.conf',
mode => '0644',
owner => 'root',
group => 'redis',
require => Package['redis'],
}
servcie{'redis':
ensure => running
name => 'redis',
hasrestart => true,
restart => 'systemctl restart redis',
subscribe => File['redis.conf'],——類似require,定義依賴關(guān)系
}
- subscribe:b依賴a,并且b監(jiān)控a資源的變化產(chǎn)生的事件
注意:也可以在file資源中加入notify => Service['redis'],(通知service資源本資源的變化)此時service中的subcribe可以注釋掉
為了效果顯著可以將redis刪除再執(zhí)行
puppet apply -v redis.pp - 在實(shí)際應(yīng)用中也可將file中的require和service中的subscribe去掉梅垄,直接在package的最后加入->(表示package被file資源依賴),并在file最后加入~>(表示file資源既要先于service資源生效厂捞,并通知service資源自己因?yàn)樽兓a(chǎn)生的事件)
- 或者在redis.pp清單中的最后加入 Package['redis']->File['redis.conf']~>Service['redis']
6.exec資源
主要實(shí)現(xiàn)puppet對shell的調(diào)用,完成軟件的安裝
屬性:
command** (namevar):要運(yùn)行的命令;
cwd:The directory from which to run the command.指定命令執(zhí)行的目錄靡馁,如果目錄不存在欲鹏,則命令執(zhí)行失敗
creates:文件路徑,僅此路徑表示的文件不存在時臭墨,command方才執(zhí)行赔嚎;
user/group:運(yùn)行命令的用戶身份;
path:The search path used for command execution. Commands must be fully qualified if no path is specified.
onlyif:此屬性指定一個命令胧弛,此命令正常(退出碼為0)運(yùn)行時尤误,當(dāng)前command才會運(yùn)行;
unless:此屬性指定一個命令叶圃,此命令非正常(退出碼為非0)運(yùn)行時袄膏,當(dāng)前command才會運(yùn)行;
refresh:重新執(zhí)行當(dāng)前command的替代命令掺冠;
refreshonly:僅接收到訂閱的資源的通知時方才運(yùn)行沉馆;
示例1:
vim exec.pp
exec{'makedir':
command => 'mkdir /tmp/hi.dir',
path => '/bin:/bin/sbin:/usr/bin:/usr/sbin',——指定路徑,否則無法執(zhí)行command命令
creates => '/tmp/hi.dir',——不存在該路徑時才執(zhí)行command命令
}
puppet apply -v exec.pp
示例2
vim exec2.pp
exec{'createsuer':
command => 'useradd user7',
path => '/bin:/sbin:/usr/bin:/usr/sbin',
unless => 'id user7',——當(dāng)使用id命令找不到該用戶時德崭,才執(zhí)行command命令
}
示例3:
vim exec3.pp定義觸發(fā)安裝zabbix-agent,zabbix-sender的觸發(fā)條件
exec{'installpkg':
command => 'yum -y install zabbix-agent zabbix-sender',
path => '/bin:/sbin:/usr/bin:/usr/sbin',
onlyif => 'yum repolist |grep -i zabbix',定義觸發(fā)command執(zhí)行的命令
}
vim exec4.pp 實(shí)現(xiàn)備份
file{'/etc/redis.conf':
source => '/root/redis.conf',
ensure => file,
}
exec{'backupfile':
command => 'cp /etc/redis.conf /backups/',
path => ['/bin','/sbin', '/usr/bin', 'usr/sbin'],
refreshonly => true,
subscribe => File['/etc/redis.conf'],
}
前提先創(chuàng)建backups這個目錄
執(zhí)行 puppet apply -v exec4.pp
7.cron資源
屬性
command:要執(zhí)行的任務(wù)斥黑;
ensure:present/absent;
hour:
minute:
monthday:
month:
weekday:
user:以哪個用戶的身份運(yùn)行命令
target:添加為哪個用戶的任務(wù)
name:cron job的名稱眉厨;
示例:
vim cron.pp
cron {'timesync':
command => '/usr/sbin/ntpdate 172.18.0.1 &> /dev/null',——定義同步時間命令
ensure => present,
minute => '/3',——每三分鐘執(zhí)行一次
user => 'root', ——以root身份運(yùn)行
}
###8.notify資源
定義通知任務(wù)
屬性:
message: 信息內(nèi)容
name: 信息名稱
示例:
vim notify.pp
notify {'helloworld':
message => 'hello everyone ,aolo',
}
三.puppet變量
(1)數(shù)據(jù)類型
字符型:引號可有可無锌奴;但單引號為強(qiáng)引用,雙引號為弱引用憾股;
數(shù)值型:默認(rèn)均識別為字符串鹿蜀,僅在數(shù)值上下文才以數(shù)值對待;
數(shù)組:[]中以逗號分隔元素列表服球;
布爾型值:true, false茴恰;
hash:{}中以逗號分隔k/v數(shù)據(jù)列表; 鍵為字符型斩熊,值為任意puppet支持的類型往枣;{ 'mon' => 'Monday', 'tue' => 'Tuesday', };
undef:未定義 粉渠;
(2)正則表達(dá)式:
(?<ENABLED OPTION>:<PATTERN>)
(?-<DISABLED OPTION>:<PATTERN>)
OPTIONS:
i:忽略字符大小寫分冈;
m:把.當(dāng)換行符;
x:忽略<PATTERN>中的空白字符
(?i-mx:PATTERN)
不能賦值給變量 霸株,僅能用在接受=或!操作符的位置雕沉;
(3)puppet的變量種類
facts:
由facter提供;top scope去件;
內(nèi)建變量:
master端變量
$servername, $serverip, $serverversion
agent端變量
$clientcert, $clientversion, $environment
parser變量
$module_name
用戶自定義變量:
變量有作用域坡椒,稱為Scope饺著;
top scope: $::var_name
node scope
class scope
使用facter -p來查看facts變量
(4)puppet流程控制語句:
if語句:
if CONDITION {
...
} else {
...
}
CONDITION的給定方式:
(1) 變量
(2) 比較表達(dá)式
(3) 有返回值的函數(shù)
示例:
vim pkg.pp
$pkgname='nginx'
package {'installpkg':
name => "$pkgname",
ensure => latest,
}
或者
$pkgname = 'nginx'
package{"$pkgname":
ensure => latest,
}
if語句
vim if.pp
if $osfamily == 'Debian' {——if $osfamily =~/(?i-mx:debian)/
$apachename = 'apache2'
} else {
$apachename = 'httpd'
}
package{"$apachename":
ensure => latest,
}
以上為雙分支寫法,還可以定義多分支寫法
vim if2.pp
if $osfamliy == 'Debian' {
$apachename = 'apache2'
} elsif $osfamily == 'Windows'{
$apachename = 'apache'
} else {
$ apachename = 'httpd'
}
package {" $anachename":
ensure => latest,
}
case語句
case CONTROL_EXPRESSION {
case1: { ... }
case2: { ... }
case3: { ... }
...
default: { ... }
}
CONTROL_EXPRESSION:
(1) 變量
(2) 表達(dá)式
(3) 有返回值的函數(shù)
各case的給定方式:
(1) 直接字串肠牲;
(2) 變量
(3) 有返回值的函數(shù)
(4) 正則表達(dá)式模式;
(5) default
示例:
vim case.pp
case $osfamily{
"Windows" : { $webpkg = 'apache' }
/(?i-mx: debian)/: { $webpkg = 'apache2' }
default: { $webpkg = 'httpd' }
}
selector 語句
CONTROL_VARIABLE ? {
case1 => value1,
case2 => value2,
default => valueN,
}
CONTROL_VARIABLE的給定方法:
(1) 變量
(2) 有返回值的函數(shù)
各case的給定方式:
(1) 直接字串靴跛;
(2) 變量
(3) 有返回值的函數(shù)
(4) 正則表達(dá)式模式缀雳;
(5) default
注意:不能使用列表格式;但可以是其它的selecor梢睛;
示例:
vim selector.pp
$webpkg = $osfamily ? {
"Windows" => 'apache',
/(?i-mx: debian)/ => 'apache2',
default => 'htttpd',
}
package {"$webpkg":
ensure => latest,
}
class(類)語句
類:puppet中命名的代碼模塊肥印,常用于定義一組通用目標(biāo)的資源,可在puppet全局調(diào)用绝葡;
類可以被繼承深碱,也可以包含子類;
語法格式:
class NAME {
...puppet code...
}
class NAME(parameter1, parameter2) {
...puppet code...
}
類代碼只有聲明后才會執(zhí)行藏畅,調(diào)用方式:
(1) include CLASS_NAME1, CLASS_NAME2, ...
(2) class{'CLASS_NAME':
attribute => value,
}
示例:
vim class.pp
class instweb{
$webpkg = $osfamily ? {
"Windows" => 'apache',
/(?i-mx:debian)/ => 'apache2',
default => 'httpd',
}
package { "$webpkg":
ensure => latest,
}
include instweb——調(diào)用class類敷硅,否則不生效
class的綜合應(yīng)用
vim class2.pp
class dbserver ($pkg,$srv) {
package{"$pkg":
ensure => latest,
}
service{"$srv":
ensure => running,
}
}
if $operatingsystem == "CentOS" or $operatingsystem == "RedHat"{
case $operatingsystemmajrelease {
'7': { $pkgname = 'mariadb-server' $srvname='mariadb'}
default: { $pkgname = 'mysql-server' $srvname= 'mysqld' }
}
}
class{'dbserver':——子類繼承父類
pkg => "$pkgname",
srv => "$srvname",
}
class的類繼承方法
首先mkdir redis.modules/
cd redis.modules/
cp /etc/redis.conf ./redis-salve.conf
cp /etc/redis.conf ./redis-master.conf
實(shí)現(xiàn)redis的主從復(fù)制,先在172.18.254.242上進(jìn)行配置愉阎,然后將redis.pp復(fù)制到172.18.250.89(作為主節(jié)點(diǎn))绞蹦,再講redis.conf復(fù)制到172.18.250.223(從節(jié)點(diǎn))
vim redis.pp
1 class redis {
2 package{'redis' :
3 ensure => latest,
4
5 }
6
7 service{'redis':
8
9 ensure => running,
10 enable => true,
11 hasrestart => true,
12 restart => 'systemctl restart redis ',
13 require => Package['redis'],——定義依賴關(guān)系
14 }
15
16
17 }
18 class redis::master inherits redis {
19 file{'/etc/redis.conf':
20
21 ensure => file,
22 source => '/root/redis.module/redis-master.conf',
23 owner => redis,
24 group => root,
25 require => Package['redis'],——依賴package
26 }
27
28 Service['redis'] {——在子類中為父類的資源新增屬性或覆蓋指定的屬性的值:
29
30 restart => 'systemctl restart redis.service',
31 # require +> File['/etc.redis.conf'],——代表覆蓋父類資源
32 subscribe => File['/etc/redis.conf'],
33 }
34 }
35
36
37 class redis::slave inherits redis {
38 file{'/etc/redis.conf':
39
40 ensure => file,
41 source => '/root/redis.module/redis-slave.conf',
42 owner => redis,
43 group => root,
44 require => Package['redis'],
45 }
46
47 Service['redis'] {
48
49 restart => 'systemctl restart redis.service',
50 # require +> File['/etc.redis.conf'],
51 subscribe => File['/etc/redis.conf'],
52 }
53 }
54 # include redis::master
此時在主節(jié)點(diǎn)上執(zhí)行
只需要在最后一行中調(diào)用 include redis::master
在從節(jié)點(diǎn)上執(zhí)行 include redis:: slave
為了效果顯著在從節(jié)點(diǎn)上 vim redis.module/redis-slave.conf
加入slaveof 172.18.250.89 6379
在主從節(jié)點(diǎn)上安裝puppet,執(zhí)行puppet apply -v redis.conf
此時vim /etc/redis.conf(在從節(jié)點(diǎn)上)
設(shè)置成功
在主節(jié)點(diǎn)上redis-cli
set key '' who am i''
get key
在從節(jié)點(diǎn)上也能顯示"who am i"
則證明主從復(fù)制成功
四.puppet模板
erb:模板語言榜旦,embedded ruby幽七;
puppet兼容的erb語法:
https://docs.puppet.com/puppet/latest/reference/lang_template_erb.html
file{'title':
ensure => file,
path =>
content => template('/PATH/TO/ERB_FILE'),
}
文本文件中內(nèi)嵌變量替換機(jī)制:
<%= @VARIABLE_NAME %>
示例:定義nginx類的調(diào)用,實(shí)現(xiàn)模板的調(diào)用erb
mkdir nginx.module/
mv nginx.conf nginx.conf.erb
vim nginx.conf.erb
vim nginx.pp
1 class nginx{
2
3 package { 'nginx':
4 ensure => latest,
5
6
7 } ->
8 file {'/etc/nginx/nginx.conf':
9 ensure => file,
10 content => template('/root/nginx.module/nginx.conf.erb'),——以content形式導(dǎo)入模板溅呢,相當(dāng)于source
11
12
13 } ~>
14 service{'nginx':
15
16 ensure => running,
17 }
18 }
19
20 include nginx
puppet apply -v nginx.pp
執(zhí)行完成后vim /etc/nginx/nginx.conf
在從節(jié)點(diǎn)上 cd redis.module/
cp redis-slave.conf redis-slave.conf.erb
vim redis.pp
class redis {
package{'redis' :
ensure => latest,
}
service{'redis':
ensure => running,
enable => true,
hasrestart => true,
restart => 'systemctl restart redis ',
require => Package['redis'],
}
}
class redis::master inherits redis {
file{'/etc/redis.conf':
ensure => file,
source => '/root/redis.module/redis-master.conf',
owner => redis,
group => root,
require => Package['redis'],
}
Service['redis'] {
restart => 'systemctl restart redis.service',
# require +> File['/etc.redis.conf'],
subscribe => File['/etc/redis.conf'],
}
}
注意:class redis::slave($masterip,$masterport='6379') inherits redis {
file{'/etc/redis.conf':
ensure => file,
注意: content => template('/root/redis.module/redis-slave.conf.erb'),
owner => redis,
group => root,
require => Package['redis'],
}
Service['redis'] {
restart => 'systemctl restart redis.service',
# require +> File['/etc.redis.conf'],
subscribe => File['/etc/redis.conf'],
}
}
#include redis::slave——注釋lnclude
class{'redis::slave':
masterip => '172.18.250.89',——直接調(diào)用子類
}
此配置是為了實(shí)現(xiàn)自動化對redis的主從復(fù)制
因此為了使效果顯著澡屡,在從節(jié)點(diǎn)上執(zhí)行 rpm -e redis
rm -rf /etc/redis.rpmconf
此時再執(zhí)行 puppet apply -v redis.conf
ss -ntl
vim /etc/redis.conf