- From: Andrea Campi <
>
- To: "
" <
>
- Cc: "
" <
>
- Subject: [chef] Re: apache rewrite rules for apache cookbook
- Date: Mon, 9 Jan 2012 09:50:05 +0100
Bryan,
A couple of questions come to mind:
- what if you need several rules in a specific order? Should source, target
and flags be within an array?
- how would you apply different rules to different front ends? Maybe add a
roles key to the bag, and skip the entry unless the node has one of them?
IMHO an LWRP is the way to go for this. These days my personal rule of thumb
is: LWRP for generic, very reusable pieces; definitions for higher-level
functionality.
On Jan 9, 2012, at 7:38 AM, Bryan Berry
<
>
wrote:
>
Has anyone done any work modeling rewrite rules or ajp proxies with Chef?
>
>
Here is what I have in mind for the apache rewrite rules. Store the
>
individual rules in data_bags and create them using an LWRP.
>
>
data_bag/front_end_rewrites/main_page.json
>
{
>
"source": "http://www.example.com/*",
>
"target": "http://backend1.example.com/",
>
"flags": "P"
>
}
>
>
file: apache_proxy/recipes/default.rb
>
>
include_recipe "apache"
>
include_recipe "apache::mod_rewrite"
>
>
rules = data_bag_item('front_end_rewrites')
>
>
rules.each do |source,target,flags|
>
apache_rewrite do
>
source source
>
target target
>
flags flags
>
end
>
end
>
>
Does anyone see any problems w/ this approach?
>
>
Since the apache cookbook currently uses definitions, should I create
>
a new definition for apache_rewrite or create an LWRP? I have the
>
impression that LWRPs are now preferred to definitions.
>
>
Modeling ajp rules would be significantly more complex than the apache
>
rewrite rules. I haven't put much thought into them yet.
Archive powered by MHonArc 2.6.16.