Ask Your Question

How create a module wrapper using as a basic the module apache from puppetlabs?

asked 2015-10-10 00:07:41 -0600

Willian gravatar image

Hellow everyone,

I'm trying create two role (apache and apache_jboss). I will describe the situation.


class role::apache {
     include profile::base
     include profile::apache
class role::apache_jboss {
     include profile::base
     include profile::apache
     include profile::apache::jboss  # or include profile::apache_jboss I don't know yet!
class profile::apache {
     $serveradmin  = hiera("serpro::apache::serveradmin")
     $ssl_path     = hiera("serpro::apache::ssl::path")
     $ssl_crt_file = hiera("serpro::apache::vhost::ssl::file_crt")
     include apache_wrapper       
  # My firsh problem is here... I don't know how to implement the class apache_wrapper...
  # how I send the parameters ($ssl_path, for example) to apache_wrapper?

class profile::apache_jboss {
     $proxy_pass = hiera("")   # How I receive only the proxy_pass????
     apache::balancer { "${codigoservico}":
       proxy_set => {'stickysession' => 'JSESSIONID'}
    apache::balancermember { "${::ipaddress}-member01":
            balancer_cluster => "${codigoservico}",
            url              => "ajp://${::ipaddress}:8009",
            options          => ['ping=5', 'disablereuse=on', 'retry=5', 'ttl=120'],
    # I solving the firsh doubt, I will change this profile to a include the class apache_wrapper::jboss


class apache_wrapper (
    $ssl_crt_hash   = " ",
    $ssl_key_hash  = " ",
    $apache_mod   = "event",
    $conf_dir       = "/etc/httpd/conf/"
    class {"apache":
       conf_dir => "${conf_dir}",


    priority:      false
    ip:            "%{::ipaddress}"
    vhost_name:    "%{::ipaddress}"
    port:          "443"
    proxy_pass:   # My second problem is here. How I separate the proxy_pass on manifest.pp?
      path:           "%{hiera('serpro::apache::alias')}"
      url:            "balancer:://%{hiera('serpro::apache::balancer::name')}"
      reverse_urls:   "balancer:://%{hiera('serpro::apache::balancer::name')}"

In short, I have two problems or doubt: 1 - How I implement the profile calling the class apache_wrapper 2 - How I separate on common.yaml and call in the manifest the part of balancer.

I hope you have understood!!!

Cheers, Willian

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2015-10-10 02:40:13 -0600

lupin gravatar image

You can make the profiles your implementation/abstraction of your modules and get rid of apache_wrapper.

e.g. profile::apache

class profile::apache (
    $serveradmin  = hiera("serpro::apache::serveradmin")
     $ssl_path     = hiera("serpro::apache::ssl::path")
     $ssl_crt_file = hiera("serpro::apache::vhost::ssl::file_crt")
  ) {

   include '::apache'
   apache::vhosts { 'jedi':
      serveradmin => $serveradmin, 
      ssl_path       => $ssl_path,
      $ss_crt_file  => $ssl_crt_file, 

then on roles

class role::webserver {
   include '::profile::base'
   include '::profile::apache'

for your hiera issue I don't get what exactly the problem is, if you need to have different value for same parameter you need to put them on separate yaml file.

proxy_pass: value1
proxy_pass: value2
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2015-10-10 00:07:41 -0600

Seen: 619 times

Last updated: Oct 10 '15