Puppet自动化运维:从虚拟机创建到事实扩展
1. 使用Vagrant创建虚拟机并安装Puppet
在使用Vagrant创建虚拟机并安装Puppet时,可按以下步骤操作:
1.初始化Vagrant:bash mkdir cookbook cd cookbook vagrant init
2.清理Vagrantfile注释:bash sed -i -e '3,${/^\s*#/d}' Vagrantfile
3.添加Puppet安装脚本:在Vagrant.configure("2")行之前添加以下脚本:ruby $rhel = <<EOF rpm -q puppet-agent if [ $? -ne 0 ]; then yum install -y http://yum.puppet.com/puppet5/puppet5-release-el-7.noarch.rpm yum install -y puppet-agent fi EOF $debian = <<EOF dpkg -s puppet-agent >/dev/null if [ $? -ne 0 ]; then wget https://apt.puppet.com/puppet5-release-stretch.deb dpkg -i puppet5-release-stretch.deb apt-get update apt