Re: Newbie: puppetlabs-apache, modules and proxying

1,896 views
Skip to first unread message

Hugo Rogg

unread,
Nov 8, 2012, 12:05:29 PM11/8/12
to puppet...@googlegroups.com
Meanwhile I figured out how to enable modules.
In my case I added this to the node's config.

apache::mod { 'proxy_ajp': }



Can't believe this is not documented or that I might have missed it. 

Hugo Rogg

unread,
Nov 8, 2012, 2:54:59 PM11/8/12
to puppet...@googlegroups.com

Finally I've also solved my other issue. Don't know though if it's the right way but I'm overwriting the class.
That's what I have now added to my node config.


class child_proxy inherits apache::mod::proxy {
 $proxy_requests = "Off"
 File [ "${apache::params::vdir}/proxy.conf"] {
  content => template('/path/to/my/own/proxy.conf.erb'),
 }
}

class {'child_proxy':}




On Tuesday, November 6, 2012 6:25:17 PM UTC+1, Hugo Rogg wrote:
Hi,

I'm quite new to puppet but feel like making some progress. :) 
Today I started using the puppetlabs-apache module. 

Two questions arose from that. I tried understanding by looking at the module's code, but too much of that still looks like advanced wizardry to me.
I hope this list is the right place to post my questions.

1) How can I enable custom modules?
I try to enable proxy_ajp.
Creating '/etc/httpd/mod.d/proxy_ajp.load ' manually and puppet will remove the module, so I assume puppet knows about the module
notice: /A2mod[proxy_ajp]/ensure: current_value present, should be absent (noop)

How to tell puppet to actually activate the module?
I've tried this in my node configuration:
class {'apache::mod::proxy_ajp': }
as the same semantic worked for the proxy_http module, but now puppet complains:
Error 400 on SERVER: Puppet::Parser::AST::Resource failed with error ArgumentError: Could not find declared class apache::mod::proxy_ajp

2) How to use a different proxy.conf template?
In this module:
puppetlabs-apache / manifests / mod / proxy.pp 
class apache::mod::proxy (
  $proxy_requests = "Off"
) {
  apache::mod { 'proxy': }
# Template uses $proxy_requests
  file { "${apache::params::vdir}/proxy.conf":
    ensure => present,
    content => template('apache/mod/proxy.conf.erb'),
  }
} 

there's a reference to the template proxy.conf.erb which is located in the modules folder. How can I override this in my node config (or anywhere else)? I want to use a template from a different location, because I believe the module should not be modified, just used.


Thanks for pointing me in the right direction.
Hugo

Jakov Sosic

unread,
Nov 12, 2012, 12:45:24 PM11/12/12
to puppet...@googlegroups.com
You can also do:

include apache::mod::proxy_ajp, which would be a much cleaner way. The
way you figured out is from parametrized classes and it is not the best
way to use it. I just hope jcbollinger didn't see it because he'll get
mad if he does :D

jcbollinger

unread,
Nov 13, 2012, 3:16:13 PM11/13/12
to puppet...@googlegroups.com


I see you've been paying attention.  :-)

I haven't actually been following this thread in any detail, but I would like to point out that

  apache::mod { 'proxy_ajp': }

is the declaration of a resource of type 'apache::mod', named 'proxy_ajp'.  Apache::mod is probably a defined type, though it could also be a custom native type.  That's not at all the same thing as

  include apache::mod::proxy_ajp

which assigns a class named 'apache::mod::proxy_ajp' to the node.  It would be possible for the implementation of type apache::mod to make the two statements substantially equivalent, but they are not inherently so.  Either way, no parametrized-class syntax is involved.

For the record, I have no objection to custom and defined types.


John

Jakov Sosic

unread,
Nov 13, 2012, 4:28:43 PM11/13/12
to puppet...@googlegroups.com
On 11/13/2012 09:16 PM, jcbollinger wrote:

> I see you've been paying attention. :-)

Yeah because I tend to read all the mails on this list. From time to
time my unread queue tends to grow over 500 messages, but as soon as I
get some spare time I tend to shrink it back to zero. It's a nice way to
get various ideas from other people, and avoid doing mistakes like
defining parametrized classes as resources :) Or at least to be aware of
the shortcomings of such approach.

> I haven't actually been following this thread in any detail, but I would
> like to point out that
>
> apache::mod { 'proxy_ajp': }
>
> is the declaration of a /resource/ of type 'apache::mod', named
> 'proxy_ajp'. Apache::mod is probably a defined type, though it could
> also be a custom native type. That's not at all the same thing as
>
> include apache::mod::proxy_ajp
>
> which assigns a /class/ named 'apache::mod::proxy_ajp' to the node. It
> would be possible for the implementation of type apache::mod to make the
> two statements substantially equivalent, but they are not inherently
> so. Either way, no parametrized-class syntax is involved.

Yeah, you're right... I'm using the same puppet module but like this:

...
include apache::mod::status
include apache::mod::proxy
include apache::mod::proxy_http
...

so I didn't pay attention to details :)

Now that I look at apache module from puppetlabs, apache::mod is indeed
defined type:

define apache::mod (
$package = undef
) {
$mod = $name
...
...
}


> For the record, I have no objection to custom and defined types.

I know :)


--
Jakov Sosic
www.srce.unizg.hr
Reply all
Reply to author
Forward
0 new messages