zoukankan      html  css  js  c++  java
  • Build Puppet Clusters with Vagrant

    $ cd ~/docs/propuppetex/chapter3

    $ cat Vagrantfile

    Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|

    config.vm.box = "centos64"

    config.vm.define "ppt" do |ppt|

    ppt.vm.hostname = "puppet.boco.com.cn"
    
    ppt.vm.network "private_network", ip: "192.168.50.3",
    
        virtualbox__intnet: "gcptest-network"
    
    ppt.vm.provider :virtualbox do |vbox|
    
      vbox.customize ["modifyvm", :id, "--natnet1", "10.3/16"]
    
    end
    
    ppt.vm.provision :shell, path: "master.sh"
    

    end

    config.vm.define "web" do |web|

    web.vm.hostname = "web.boco.com.cn"
    
    web.vm.network "private_network", ip: "192.168.50.4",
    
        virtualbox__intnet: "gcptest-network"
    
    web.vm.provider :virtualbox do |vbox|
    
      vbox.customize ["modifyvm", :id, "--natnet1", "10.3/16"]
    
    end
    
    web.vm.provision :shell, path: "web.sh"
    

    end

    end

    $ cat master.sh

    echo '*' > /etc/puppet/autosign.conf

    sed -i '/[.*]/ a autosign = true' /etc/puppet/puppet.conf # add "autosign = true" in [main] and [agent]

    echo "192.168.50.3 puppet.boco.com.cn puppet" >> /etc/hosts

    echo "192.168.50.4 web.boco.com.cn web" >> /etc/hosts

    mkdir /etc/puppet/manifests

    cat > /etc/puppet/manifests/site.pp <<-EOF

    node 'web' {

    file { '/home/vagrant/aaa.conf':

    content => 'this is made by puppet master!',
    

    }

    }

    EOF

    service iptables stop

    $ cat web.sh

    sed -i '1 a master = puppet' /etc/puppet/puppet.conf # add "master = puppet" after the line [main]

    echo "192.168.50.3 puppet.boco.com.cn puppet" >> /etc/hosts

    echo "192.168.50.4 web.boco.com.cn web" >> /etc/hosts

    echo "proxy=http://10.21.3.31:8888" >> /etc/yum.conf

    service iptables stop

    Now run "puppet master --no-daemonize --verbose" on ppt, run "puppet agent --test" on web, you can file the file "aaa.conf" at /home/vagrant.

  • 相关阅读:
    leetcode 14. 最长公共前缀
    leetcode13. 罗马数字转整数
    leetcode 21.合并两个有序链表
    leetcode14-最长公共前缀
    leetcode13-罗马数字转整数
    leetcode11- 盛最多水的容器
    leetcode9-回文数
    leetcode7- 整数反转
    leetcode 1-两数之和
    文件的上传
  • 原文地址:https://www.cnblogs.com/darkmatter/p/3610638.html
Copyright © 2011-2022 走看看