christopherbalz
christopherbalz

Reputation: 730

Vagrant 1.2.2 Not Running Puppet Manifest

The vm resulting from vagrant up seems to work fine. But I can't seem to get vagrant to add apache (the webserver) to it, in the simplest of configurations. I'm using Puppet.

I've made sure to vagrant destroy and then vagrant up. Upon vagrant ssh, apache isn't there (no apachectl, no httpd).

Details below:

Environment:

bash-3.2$ vagrant --version
Vagrant version 1.2.2
bash-3.2$ uname -a
Darwin foo.com 12.3.0 Darwin Kernel Version 12.3.0: Sun Jan  6 22:37:10 PST 2013; root:xnu-2050.22.13~1/RELEASE_X86_64 x86_64
bash-3.2$ 
bash-3.2$ pwd
/Users/bar/cbalz
bash-3.2$ ls -ail
total 24
1500058 drwxr-xr-x   7 bar  staff   238 Aug  6 16:27 .
 379691 drwxr-xr-x+ 37 bar  staff  1258 Aug  6 11:29 ..
1500065 drwxr-xr-x   3 bar  staff   102 Aug  6 11:23 .vagrant
1500631 -rw-r--r--   1 bar  staff  4948 Aug  6 16:25 Vagrantfile
1500619 -rw-r--r--   1 bar  staff    33 Aug  6 13:34 index.html
1500107 drwxr-xr-x   3 bar  staff   102 Aug  6 16:28 manifests
1500704 drwxr-xr-x   2 bar  staff    68 Aug  6 14:24 www
bash-3.2$ 

foo:cbalz bar$ ls -ail manifests
total 8
1500107 drwxr-xr-x  3 bar  staff  102 Aug  6 16:28 .
1500058 drwxr-xr-x  7 bar  staff  238 Aug  6 16:27 ..
1500806 -rw-r--r--  1 bar  staff  405 Aug  6 16:28 precise64.pp
foo:cbalz bar$

Vagrantfile :

foo:cbalz bar$ more Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|
# ...
config.vm.box = "precise64"
# ...
# Customization:
Vagrant::Config.run do |config|
  config.vm.box = "precise64"

  # Enable the Puppet provisioner
  config.vm.provision :puppet do |puppet|
     puppet.manifests_path = "/Users/bar/cbalz/manifests"
     puppet.manifest_file  = "precise64.pp"
     puppet.options = "--verbose --debug"
  end
end
# ...
end

Puppet Manifest File:

foo:cbalz bar$ cat manifests/precise64.app 
# Basic Puppet Apache manifest

class apache {
  exec { 'apt-get update':
    command => '/usr/bin/apt-get update'
  }

  package { "apache2":
    ensure => present,
  }

  service { "apache2":
    ensure => running,
    require => Package["apache2"],
  }
  # ...
 }

Set-up:

$ vagrant destroy; vagrant up
Are you sure you want to destroy the 'default' VM? [y/N] y
[default] Forcing shutdown of VM...
[default] Destroying VM and associated drives...
Bringing machine 'default' up with 'virtualbox' provider...
[default] Importing base box 'precise64'...
[default] Matching MAC address for NAT networking...
[default] Setting the name of the VM...
[default] Clearing any previously set forwarded ports...
[default] Fixed port collision for 22 => 2222. Now on port 2203.
[default] Creating shared folders metadata...
[default] Clearing any previously set network interfaces...
[default] Preparing network interfaces based on configuration...
[default] Forwarding ports...
[default] -- 22 => 2203 (adapter 1)
[default] Booting VM...
[default] Waiting for VM to boot. This can take a few minutes.
[default] VM booted and ready for use!
[default] Configuring and enabling network interfaces...
[default] Mounting shared folders...
[default] -- /vagrant

Run:

$ vagrant ssh
Welcome to Ubuntu 12.04 LTS (GNU/Linux 3.2.0-23-generic x86_64)

 * Documentation:  https://help.ubuntu.com/
Welcome to your Vagrant-built virtual machine.
Last login: Fri Sep 14 06:23:18 2012 from 10.0.2.2
;vagrant@precise64:~$ apachectl
The program 'apachectl' is currently not installed.  You can install it by typing:
sudo apt-get install apache2.2-common
vagrant@precise64:~$ httpd
No command 'httpd' found, did you mean:
 Command 'xttpd' from package 'xtide' (universe)
httpd: command not found
vagrant@precise64:~$ 

Upvotes: 2

Views: 1510

Answers (1)

kontulai
kontulai

Reputation: 886

Try removing

Vagrant::Config.run do |config| config.vm.box = "precise64"

from the Vagrantfile so that the configuration looks like below:

# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|
# ...
  config.vm.box = "precise64"

  # Enable the Puppet provisioner
  config.vm.provision :puppet do |puppet|
    puppet.manifests_path = "/Users/bar/cbalz/manifests"
    puppet.manifest_file  = "precise64.pp"
    puppet.options = "--verbose --debug"
  end
# ...
end

Upvotes: 2

Related Questions