yumrepo是puppet 管理资源。通过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资源的学习,请听下回分解!!!