Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Problems running Vagrant/Puppet on osx 10.7

I'm just getting started with Vagrant and Puppet. I'm able to get a Virtualbox running but now I want to automate the software that gets installed on it.

In my Vagrantfile I have:

Vagrant::Config.run do |config|

    config.vm.box = "precise64"

    config.vm.forward_port 80, 9090
    config.vm.forward_port 27017, 27017

    config.vm.provision :puppet do |puppet|
     puppet.manifests_path = "manifests"
     puppet.manifest_file  = "default.pp"
    end

end

in manifests/default.pp I have:

Exec { path => [ "/bin/", "/sbin/" , "/usr/bin/", "/usr/sbin/" ] }

class php5{
    package { "php5":
        ensure => present,
    }
}


include php5

However, when I run vagrant up I get the following error (snippet).

[default] Running Puppet with /tmp/vagrant-puppet/manifests/default.pp...
stdin: is not a tty
No LSB modules are available.
warning: Could not retrieve fact fqdn
err: /Stage[main]/Php5/Package[php5]/ensure: change from purged to present failed: Execution of '/usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold install php5' returned 100: Reading package lists...

I'm not really sure where the error lies, so here is some further information which might be useful

Ruby version

$ ruby -v 
ruby 1.8.7 (2011-12-28 patchlevel 357) [universal-darwin11.0]

gem sources

$ gem sources 
*** CURRENT SOURCES ***

http://rubygems.org/

Update 1: Following this post I installed facter and puppet now runs ok but the main problem is still happening.

Update 2: Correct answer marked, but I wanted to share my entire manifest file http://pastebin.com/LGNhVPV7

like image 360
ed209 Avatar asked Nov 03 '22 20:11

ed209


1 Answers

The 'apt-get install' error is probably happening because the VM hasn't finished an 'apt-get update' before Puppet tries to do the 'apt-get install'. Puppet won't handle the 'apt-get update' on its own when you request that a package be installed, but you can spell out that it should happen in your manifest easily enough.

Try adding the apt class Mr Leach mentions in his http://johnleach.co.uk/words/771/puppet-dependencies-and-run-stages post. This should ensure that 'apt-get update' is run before any packages are installed.

like image 119
pwan Avatar answered Nov 08 '22 06:11

pwan