puppet连载11:linux清除yum缓存、删除puppet锁

清除yum\puppet缓存

mkdir -p /etc/puppet/modules/linuxclean/{manifests,templates,files}
vi /etc/puppet/modules/linuxclean/manifests/init.pp
class linuxclean::puppetclean {
exec {"rm -rf /var/lib/puppet/state/agent_catalog_run.lock":
path => ["/usr/bin","/usr/sbin","/bin","/sbin"],
onlyif => 'ls /var/lib/puppet/state/agent_catalog_run.lock',
}
}
class linuxclean::yumclean {
exec {["rm -f /var/lib/rpm/__",
"rpm --rebuilddb -v -v",
"yum clean dbcache",
"yum clean metadata",
"yum clean rpmdb",
"yum clean headers",
"yum clean all",
"rm -rf /var/cache/yum/timedhosts.txt",
"rm -rf /var/cache/yum/
",
"yum makecache",]:
path => ["/usr/bin","/usr/sbin","/bin","/sbin"],
timeout => 600,
}
}

上一篇:学习开发手册的三个阶段:阅读、实操与理解之再读《Java开发手册》


下一篇:puppet连载七:linux基础组件安装模块