Hello Latina:

on your line where you have include apache, change to something like this

class{  'apache': 

default_mods => true, 

default_vhost => false, 

default_ssl_vhost => false, 

}

This will trigger the apache class and allow you to pass param's to it.

Thanks
Joseph

On Sunday, April 19, 2015 at 10:34:59 PM UTC-4, Latina Endo wrote:
>
> I’m trying to configure 1 webserver to host 2 different domains (
> example1.com and example2.com) I need both to listen on 80 and 443. There 
> are no subdomains.
>
> I’m using puppetlabs’s apache module with the following configuration:
>
> *class profiles::webserver1 {*
>
> *include apache*
>
> *#Create the user*
>
> *user { 'example1':*
>
> *  ensure => present,*
>
> *  uid     => 12120,*
>
> *  managehome => true,*
>
> *  }->*
>
> *#Ensure mysql starts up*
>
> *#class { '::mysql::server':*
>
> *#  service_enabled =>  true,*
>
> *#  }*
>
> *apache::vhost { 'default':*
>
> *  ensure  => false,*
>
> *  port => 80,*
>
> *  }*
>
> *#install wordpress and configure mysql*
>
> *wordpress::instance { '/opt/example1':*
>
> *  version => '4.1.1',*
>
> *  wp_owner => 'example1',*
>
> *  wp_group => 'example1',*
>
> *  db_user => 'example1',*
>
> *  db_name => 'example1',*
>
> *  db_password => 'thisshouldsuperbedone',*
>
> *  }->*
>
> *#Install php*
>
> *class { '::apache::mod::php':*
>
> *  content => '*
>
> *  AddHandler php5-script .php*
>
> *  AddType text/html .php',*
>
> *  }*
>
> *#Enable mod_rewrite*
>
> *#apache::mod { 'rewrite': }*
>
> *#Create apache vhost*
>
> *apache::vhost { 'example1.com <http://example1.com>':*
>
> *  port          => '80',*
>
> *  docroot       => '/opt/example1',*
>
> *  fallbackresource => '/index.php',*
>
> *  directories   => [*
>
> * { path        => '/opt/example1',*
>
> *    allow_override => ['AuthConfig', 'Indexes'],*
>
> * },*
>
> *  ],*
>
> *  }->*
>
> *#Create ssl vhost*
>
> *apache::vhost { 'ssl.example1.com <http://ssl.example1.com>':*
>
> *  port => '443',*
>
> *  docroot => '/opt/example1',*
>
> *  ssl => true,*
>
> *  }*
>
> *##===second domain===##*
>
> *#Create the user*
>
> *user { 'example2':*
>
> *  ensure => present,*
>
> *  uid => 12121,*
>
> *#  managehome => true,*
>
> *  }->*
>
> *#Create apache vhost*
>
> *apache::vhost { 'example2.com <http://example2.com>':*
>
> *  port          => '80',*
>
> *  docroot       => '/opt/example2',*
>
> *  fallbackresource => '/index.php',*
>
> *  directories   => [*
>
> * { path        => '/opt/example2',*
>
> *    allow_override => ['AuthConfig', 'Indexes'],*
>
> * },*
>
> *  ],*
>
> *  }->*
>
> *#Create ssl vhost*
>
> *apache::vhost { 'ssl.example2.com <http://ssl.example2.com>':*
>
> *  port => '443',*
>
> *  docroot => '/opt/example2',*
>
> *  ssl => true,*
>
> *  }*
>
> *}*
>
>
> My problem is, a file called 15-default.conf is being created and its 
> matching when i try to reach the site via either domainname. If i do 
> https:// then it takes me to the right domain content. If i go and manually 
> delete the 15-default.conf and restart httpd everything works as expected.
>
> Reading the module’s documentation i see:
> default_vhost
>
> Sets up a default virtual host. Defaults to 'true', set to 'false' to set 
> up customized virtual hosts 
> <https://forge.puppetlabs.com/puppetlabs/apache#configure-a-virtual-host>.
>
> But I’m not sure how to write that out on the profile/manifest, if I do 
>
> *apache::vhost { 'default':*
>
> *  ensure  => false,*
>
> *  port => 80,*
>
> *  }*
>
>
> I get the following error:
>
> Error: Duplicate declaration: Apache::Vhost[default] is already declared 
> in file /etc/puppet/modules/apache/manifests/init.pp:361; cannot redeclare 
> at /etc/puppet/modules/profiles/manifests/example1.pp:22 on node example2
>
>
> How can i keep that default file being created and is this a “proper” way 
> to try to setup the 2 vhosts in apache.
>
>
> Thanks!
>
> -Latina
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/92fd0401-e5f8-421d-9761-55ef631ee178%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to