Vagrant Puppet Provision VM

339 views
Skip to first unread message

chengkai liang

unread,
Jul 30, 2013, 10:32:36 AM7/30/13
to puppet...@googlegroups.com
Hi All,
I am using Vagrant to provision a box (CentOS 6.x) with puppet provisioner.  The box is built by using veewee, with ruby 1.8.7 and puppet 3.2 iinstalled, and the vagrant environment layout is,

.
├── Gemfile
├── Gemfile.lock
├── Rakefile
├── Vagrantfile
├── definitions
│   └── centos-6.3.minimal
├── hiera
│   └── data
├── iso
│   ├── CentOS-6.3-x86_64-minimal.iso
│   └── VBoxGuestAdditions_4.2.12.iso
├── puppet
│   ├── Puppetfile
│   ├── environments
│   ├── manifests
│   └── modules
└── r10k.yaml

Puppet will execute the puppet/manfests/default.pp for executing all the modules include within in.  Now, I have the following modules list in this default.pp,

include stdlib
include hiera_config
include confluence_facts
include confluence_setup

One thing to note is that by default, hiera.yaml was installed at /etc/hiera.yaml, yet puppet is looking for hiera.yaml at /etc/puppet/hiera.yaml.  As a result, hiera_config is created to remedy the problem (puppet will complaint it can't find hiera.yaml in /etc/puppet directory).

Here problem, when running vagrant destroy -> vagrant up, during the provision phase, puppet complaint can't find /etc/puppet/hiera.yaml, and keep executing the reset of the modules but not hiera_config.  If I comment out all the modules but hiera_config, then this module gets executed.  And I can finally un-comment all the modules and execute them all successfully.

Why puppet behaves in this way?  Is there a way to enforce hiera_config being executed?

-Chengkai

daddy dp

unread,
Aug 1, 2013, 9:17:14 AM8/1/13
to puppet...@googlegroups.com
you can pass puppet options 
    puppet.options = ["--pluginsync","--verbose","--hiera_config /vagrant/modules/puppet/templates/master/hiera.yaml","--environment #{ROLE}"]
and sync folder with hiera data 
    config.vm.synced_folder "hieradata", "/etc/puppet/environments/#{ROLE}/hieradata"

chengkai liang

unread,
Aug 1, 2013, 12:52:11 PM8/1/13
to puppet...@googlegroups.com
This is a cool way to do it!

Thanks a lot


--
You received this message because you are subscribed to a topic in the Google Groups "Puppet Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/puppet-users/dTWWj_kPlxE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to puppet-users...@googlegroups.com.
To post to this group, send email to puppet...@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply all
Reply to author
Forward
0 new messages