Vagrant puppet - double provisioning

19 views
Skip to first unread message

Hemen Kapadia

unread,
Nov 2, 2015, 4:19:17 AM11/2/15
to Vagrant
My Vagrantfile is as below

VAGRANTFILE_API_VERSION = "2"

# master runs HDFS NameNode, YARN ResourceManager, HBase Master (optional)
# slaves run  HDFS DataNode, YARN NodeManager, HBase RegionServers (optional)

# increase ram as needed, add additional slave nodes if needed.

nodes = [
  { :type => 'master', 
    :hostname => 'master.local',   
    :ip => '192.168.48.10',
    :box => 'puppetlabs/ubuntu-12.04-64-puppet', 
    :cpus => '1', 
    :ram => '2048' },
 
  { :type => 'slave',  
    :hostname => 'hadoop1.local',  
    :ip => '192.168.48.11',
    :box => 'puppetlabs/ubuntu-12.04-64-puppet', 
    :cpus => '1', 
    :ram => '1024' },
 
  { :type => 'slave',  
    :hostname => 'hadoop2.local',  
    :ip => '192.168.48.12',
    :box => 'puppetlabs/ubuntu-12.04-64-puppet', 
    :cpus => '1', 
    :ram => '1024' },
 
  { :type => 'slave',  
    :hostname => 'hadoop3.local',  
    :ip => '192.168.48.13',
    :box => 'puppetlabs/ubuntu-12.04-64-puppet', 
    :cpus => '1', 
    :ram => '1024' },
 
]

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
 
  nodes.each do |node|
    config.vm.define node[:hostname] do |node_config|
      node_config.vm.box = node[:box]
      node_config.vm.box_version = "1.0.1"          # optional, can be removed to default to latest version
      node_config.vm.box_check_update = false        # disabling for now
      node_config.vm.host_name = node[:hostname]
      node_config.vm.network "private_network", ip: node[:ip]
      node_config.vm.provider :virtualbox do |vb|
        vb.customize ["modifyvm", :id, "--cpus", node[:cpus]]
        vb.customize ["modifyvm", :id, "--memory", node[:ram]]
        # vb.gui = true                             # uncomment this line to debug virtual machine startup issues
      end
    end
    # Shell provisioning - bootstrap for puppet
    # install - git, ruby and librarian-puppet
    config.vm.provision :shell, :path => 'shell/main.sh'

    # Puppet provisioning
    config.vm.provision "puppet" do |puppet|
      # puppet.options = "--verbose --debug"      # uncomment to enable verbose mode
      puppet.manifests_path = "puppet/manifests"
      puppet.manifest_file = node[:type] + ".pp"
      puppet.module_path = "puppet/modules"
    end 
  end
end


Within puppet/manifests I have files master.pp and slave.pp which I want to be picked up based on node[:type] value, but i notice that each of the 4 nodes is double provisioned, once with master.pp and then with slave.pp.

Not sure why that is the case. Help appreciated.

Regards,
Hemen
Reply all
Reply to author
Forward
0 new messages