-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #342 from thiagomarinho/ohs_config
Defined type to configure OHS Standalone
- Loading branch information
Showing
5 changed files
with
164 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# NOTE: This is a template to configure mod_weblogic, generated by Puppet. | ||
|
||
LoadModule weblogic_module "${PRODUCT_HOME}/modules/mod_wl_ohs.so" | ||
|
||
Include mod_wl_ohs.d/*.conf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# == Define: orawls::ohs::config | ||
# | ||
# configures ohs locations and rewrites | ||
## | ||
define orawls::ohs::config ( | ||
$server_name, | ||
$domain_path, | ||
$owner, | ||
$group, | ||
$locations = undef, | ||
$rewrites = undef, | ||
) { | ||
|
||
$mod_wl_ohs_config_file = "${domain_path}/config/fmwconfig/components/OHS/instances/${server_name}/mod_wl_ohs.conf" | ||
$mod_wl_ohs_dir = "${domain_path}/config/fmwconfig/components/OHS/instances/${server_name}/mod_wl_ohs.d" | ||
|
||
if (!defined(File[$mod_wl_ohs_dir])) { | ||
file { $mod_wl_ohs_dir: | ||
ensure => directory, | ||
owner => $owner, | ||
group => $group, | ||
mode => '0640', | ||
} | ||
} | ||
|
||
if (!defined(File[$mod_wl_ohs_config_file])) { | ||
file { $mod_wl_ohs_config_file: | ||
ensure => present, | ||
source => 'puppet:///modules/orawls/mod_wl_ohs.conf', | ||
owner => $owner, | ||
group => $group, | ||
mode => '0640', | ||
} | ||
} | ||
|
||
file { "${mod_wl_ohs_dir}/${title}.conf": | ||
ensure => present, | ||
content => template('orawls/ohs/mod_wl_ohs_config.conf.erb'), | ||
owner => $owner, | ||
group => $group, | ||
mode => '0640', | ||
require => File[$mod_wl_ohs_dir], | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
require 'spec_helper' | ||
|
||
describe 'orawls::ohs::config', :type => :define do | ||
let(:title) {'default'} | ||
|
||
describe 'with one location' do | ||
let(:params) {{:server_name => 'ohs1', | ||
:domain_path => '/opt/test/wls/domains/domain1', | ||
:owner => 'oracle', | ||
:group => 'oracle', | ||
:locations => {'/console' => ['192.168.1.1:7001']}, | ||
}} | ||
it { | ||
should contain_file('/opt/test/wls/domains/domain1/config/fmwconfig/components/OHS/instances/ohs1/mod_wl_ohs.d').with({ | ||
'ensure' => 'directory', | ||
'owner' => 'oracle', | ||
'group' => 'oracle', | ||
}) | ||
|
||
should contain_file('/opt/test/wls/domains/domain1/config/fmwconfig/components/OHS/instances/ohs1/mod_wl_ohs.conf').with({ | ||
'ensure' => 'present', | ||
'owner' => 'oracle', | ||
'group' => 'oracle', | ||
}) | ||
|
||
should contain_file('/opt/test/wls/domains/domain1/config/fmwconfig/components/OHS/instances/ohs1/mod_wl_ohs.d/default.conf').with({ | ||
'ensure' => 'present', | ||
'owner' => 'oracle', | ||
'group' => 'oracle', | ||
}) | ||
.with_content(/\<LocationMatch "\/console"\>/) | ||
.with_content(/WebLogicHost 192.168.1.1/) | ||
.with_content(/WebLogicPort 7001/) | ||
.that_requires('File[/opt/test/wls/domains/domain1/config/fmwconfig/components/OHS/instances/ohs1/mod_wl_ohs.d]') | ||
} | ||
end | ||
|
||
describe 'with two locations' do | ||
let(:params) {{:server_name => 'ohs1', | ||
:domain_path => '/opt/test/wls/domains/domain1', | ||
:owner => 'oracle', | ||
:group => 'oracle', | ||
:locations => { | ||
'/console' => ['192.168.1.1:7001'], | ||
'/application' => ['192.168.1.2:7001', '192.168.1.3:7001'], | ||
}, | ||
}} | ||
it { | ||
should contain_file('/opt/test/wls/domains/domain1/config/fmwconfig/components/OHS/instances/ohs1/mod_wl_ohs.d/default.conf').with({ | ||
'ensure' => 'present', | ||
'owner' => 'oracle', | ||
'group' => 'oracle', | ||
}) | ||
.with_content(/\<LocationMatch "\/console"\>/) | ||
.with_content(/WebLogicHost 192.168.1.1/) | ||
.with_content(/WebLogicPort 7001/) | ||
.with_content(/\<LocationMatch "\/application"\>/) | ||
.with_content(/WebLogicCluster 192.168.1.2:7001,192.168.1.3:7001/) | ||
.that_requires('File[/opt/test/wls/domains/domain1/config/fmwconfig/components/OHS/instances/ohs1/mod_wl_ohs.d]') | ||
} | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# NOTE: This is a template to configure mod_weblogic, generated by Puppet. | ||
|
||
<% unless @rewrites.nil? || @rewrites.empty? %> | ||
<IfModule mod_rewrite> | ||
RewriteEngine on | ||
|
||
<% @rewrites.each do |from, rewrite| -%> | ||
RewriteRule <%= from %> <%= rewrite['to'] %> <%= (rewrite['options'].nil? || rewrite['options'].empty?) ? '' : "[#{rewrite['options']}]" %> | ||
<% end -%> | ||
</IfModule> | ||
<% end %> | ||
<% unless @locations.nil? || @locations.empty? %> | ||
<IfModule weblogic_module> | ||
<% @locations.each do |location, servers| %> | ||
<LocationMatch "<%= location %>"> | ||
SetHandler weblogic-handler | ||
|
||
<% if servers.size == 1 %> | ||
WebLogicHost <%= servers[0].split(/:/).first %> | ||
WebLogicPort <%= servers[0].split(/:/).last %> | ||
<% else %> | ||
WebLogicCluster <%= servers.map { |item| "#{item.split(/:/).first}:#{item.split(/:/).last}" }.join ',' %> | ||
<% end %> | ||
</LocationMatch> | ||
<% end %> | ||
</IfModule> | ||
<% end %> |