[MODULES] apache configuration

12 views
Skip to first unread message

Elias Pereira

unread,
Aug 13, 2018, 9:37:03 AM8/13/18
to puppet...@googlegroups.com
Hello,

I'm using the apache module to set up new http / https servers and I'm having a problem.

I created a new class for the installation of a standard vhost for our institute. I set the default_vhost option to false in the apache class.

The problem is that with this option set to false, it always deletes the vhost that my class creates.

class apache::campus_default_vhost {

class { 'apache':
        mpm_module      => 'prefork',
        default_vhost   => false,
        default_ssl_vhost => false,
}

apache::listen { '80': }
apache::listen { '443': }

include apache::mod::alias
include apache::mod::rewrite
include apache::vhosts
include apache::mod::vhost_alias
include apache::mod::ssl

        if $::osfamily == 'Debian' {

                file { '/etc/apache2/certs':
                        ensure  => 'directory',
                        mode    => '0755',
                }

                file { "/etc/apache2/sites-available/${servername}.conf":
                        ensure  => present,
                        content => template('apache/vhost-deb.conf.erb'),
                }

                exec { "enable-${servername}-vhost":
                        command => "/usr/sbin/a2ensite ${servername}.conf ; /etc/init.d/apache2 restart",
                        require => [ File["/etc/apache2/sites-available/${servername}.conf"] ],
                        unless  => [
                                        "/usr/bin/test -e /etc/apache2/sites-enabled/${servername}.conf 2>/dev/null",
                                ],
                }

                file { '/etc/apache2/certs/sertao.crt':
                        ensure  => present,
                        content => template('apache/sertao.crt'),
                }

                file { '/etc/apache2/certs/sertao.key':
                        ensure  => present,
                        content => template('apache/sertao.key'),
                }

                file { '/etc/apache2/certs/ca_join_icpedu.crt':
                        ensure  => present,
                        content => template('apache/ca_join_icpedu.crt'),
                }

        } else {
                notify {'Não funciona em sua distribuição!':}
        }
}

Is this the normal operation of the class?


--
Elias Pereira
Reply all
Reply to author
Forward
0 new messages