Hayden Crocker
Hayden Crocker

Reputation: 519

How do I set documentroot for apache with puppet?

I've been trying to get apache to serve from /vagrant/ using puppet through vagrant, my manifest looks like this:

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

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

  service { "apache2":
    ensure => running,
    require => Package["apache2"],
    root => '/vagrant/'
  }
}

I would really appreciate the help.... I'm stunned at how bad the manifest documentation is.

Upvotes: 3

Views: 2357

Answers (2)

Jokin
Jokin

Reputation: 4218

easier than changing the httpd.conf with templates etc, it's to make a symlink from /var/www to /vagrant. Add

 file { '/var/www':
   ensure => 'link',
   target => '/vagrant',
   force => true,
}

to your puppet file and you are running.

Upvotes: 5

joshcody
joshcody

Reputation: 105

The service resource manages the process but doesn't have anything to do with the configuration files. Your manifest simply says "Make sure that apt is updated, apache2 is installed and running".

I think what you are looking for can be handled with templates (http://docs.puppetlabs.com/guides/templating.html).

Upvotes: 0

Related Questions