puppet自动化运维之yumrepo资源

yumrepopuppet 管理资源。通过yumrepo资源管理客户端yum 仓库的一致性。

 

注:yumrepo资源可以通过file资源进行管理,这个可以根据实际情况而定!

 

格式:

 

yumrepo {"title":                               #生成的/etc/yum.repo/title.repo

          descr => "描述",

          baseurl => "路径",               #同手动配置一样

          gpgcheck => "[0|1]",            #默认选择0

          enabled => "[0|1]";               #是否开启,选择1

}

 

 

 

 

实例:

#

vi /etc/puppet/manifest/test.pp

 

yumrepo {"test":

          name => 'test',

          descr => "163repo",

          baseurl =>   "http://mirrors.163.com/centos/5.6/os/x86_64/",

          gpgcheck => "0",

          enabled => "1";

}

 

#

[root@client yum.repos.d]# ll

total 4

-rw-r--r-- 1 root root 112 Oct 15 03:58   local.repo

[root@client yum.repos.d]# puppet agent   --test -vv --server master.perofu.com

info: Caching catalog for   client.perofu.com

info: create new repo test in file   /etc/yum.repos.d/test.repo

info: Applying configuration version   '1395086201'

notice: /Stage[main]//Yumrepo[local]/descr:   descr changed '' to '163repo'

notice:   /Stage[main]//Yumrepo[local]/baseurl: baseurl changed '' to   'http://mirrors.163.com/centos/5.6/os/x86_64/'

notice:   /Stage[main]//Yumrepo[local]/enabled: enabled changed '' to '1'

notice: /Stage[main]//Yumrepo[local]/gpgcheck:   gpgcheck changed '' to '0'

info: changing mode of   /etc/yum.repos.d/test.repo from 600 to 644

notice: Finished catalog run in 0.34   seconds

[root@client yum.repos.d]# ll

total 8

-rw-r--r-- 1 root root 112 Oct 15 03:58 local.repo

-rw-r--r-- 1 root root  94 Mar 18 04:26 test.repo

[root@client yum.repos.d]# cat test.repo

[test]

name=163repo

baseurl=http://mirrors.163.com/centos/5.6/os/x86_64/

enabled=1

gpgcheck=0

[root@client yum.repos.d]#

 

            至此,puppet的yumrepo资源就结束了,接下来的是host资源的学习,请听下回分解!!!



转载于:https://my.oschina.net/fufangchun/blog/262676

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值