Ask Your Question
0

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

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

Willian gravatar image

Hellow everyone,

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

Manifest.pp

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
 }

modules/apache_wrapper/manifest/init.pp

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

common.yaml

serpro::apache::vhost::https:
  "%{hiera('serpro::apache::ambiente')}.https":
    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
0

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

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.

e.g 
<fqdn>.yaml
proxy_pass: value1
<command>.yaml
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

Stats

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

Seen: 445 times

Last updated: Oct 10 '15