use puppet module with vagrant, install apache

294 views
Skip to first unread message

Jorge Copia

unread,
Nov 12, 2014, 9:06:58 PM11/12/14
to vagra...@googlegroups.com
Hi, I try to install apache on ubuntu virtual machine with puppet provision.

I have install  puppetlabs/apache on host computer, and my manifest puppet is:

include apache

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

exec { "update":
    command
=> "apt-get update",
}

class { "apache::mod::php":
   
require => Exec["update"],    
}

apache
::vhost { "personal-site":
    port
=> 80,
    docroot
=> "/vagrant",
}

file
{ "/vagrant/index.php":
 content
=> "<?php \$title='From the php'; ?> <h1> <?php echo \$title; </h1>",

}

But, when I run, vagrant up, the terminal show this error:
apache::mod::php requires apache::mod::prefork or apache::mod::itk; please enable mpm_module => 'prefork' or mpm_module => 'itk' on Class['apache'] at /tmp/vagrant-puppet-3/modules-0/apache/manifests/mod/php.pp:17 on node vagrant-ubuntu-precise-64

I don't know to do.

PD: Version apache puppet installed is:
puppetlabs-apache (v1.2.0)
puppetlabs-concat (v1.1.2)
puppetlabs-stdlib (v4.4.0)

Adam Crews

unread,
Nov 13, 2014, 2:09:21 AM11/13/14
to vagra...@googlegroups.com
This is more of a puppet issue than a vagrant issue, regardless, the fix is simple.  You just need to tell apache to use the prefork method.

On debian/ubuntu apache defaults to 'worker'.  To tell the puppet module to configure it as worker, change your 'include apache' to be:

class { 'apache':
  mpm_module => 'prefork',
}

Also note that you have a couple typos:
in the exec path, you need a leading / on usr/bin.
in the content you are missing a closing ?>

Here's a gist that works for me:

-Adam


--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jorge Copia

unread,
Nov 13, 2014, 7:43:15 PM11/13/14
to vagra...@googlegroups.com
Thanks for your help.

I'm correct all the mistakes, but a have a new wrong.

    The message is: default: undefined method `<<' for {}:Hash on node vagrant-ubuntu-precise-64

Later I try with your resources and this okey.

Then, I'm using vagrantbox.es  to find a Box. But the Box choose it generate a mistake and your box in bits example is correctlly. What's recommend to do?



--
You received this message because you are subscribed to a topic in the Google Groups "Vagrant" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/vagrant-up/hpQ2tCJUxjA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to vagrant-up+...@googlegroups.com.

Alvaro Miranda Aguilera

unread,
Nov 13, 2014, 7:52:52 PM11/13/14
to vagra...@googlegroups.com


Not all the boxes have puppet installed, so you should put a shell provisioner before to install puppet.


(no todas las vagrant boxes tienen puppet instalado, si que podrias usar un shell provisioner para instalar puppet)

alvaro.

Jorge Copia

unread,
Nov 13, 2014, 8:19:37 PM11/13/14
to vagra...@googlegroups.com
Gracias Alvaro, ambos box tienen puppet instalado, sin embargo son versiones distintas y eso puede ser el causante del error.

-- Thanks Alvaro, both box has puppet. However they are puppet version is different --


Reply all
Reply to author
Forward
0 new messages