Defined Type: orawls::utils::webtier

Defined in:
manifests/utils/webtier.pp

Overview

utils::webtier define

Add a Webtier to the Enterprise manager

Parameters:

  • version (Integer) (defaults to: $::orawls::weblogic::version)

    used weblogic software like 1036

  • wls_domains_dir (Optional[String]) (defaults to: $::orawls::weblogic::wls_domains_dir)

    root directory for all the WebLogic domains

  • middleware_home_dir (String) (defaults to: $::orawls::weblogic::middleware_home_dir)

    directory of the Oracle software inside the oracle base directory

  • domain_name (String) (defaults to: undef)

    the domain name which to connect to

  • adminserver_address (String) (defaults to: 'localhost')

    the adminserver network name or ip, default = localhost

  • adminserver_port (Integer) (defaults to: 7001)

    the adminserver port number, default = 7001

  • weblogic_user (String) (defaults to: 'weblogic')

    the weblogic administrator username

  • weblogic_password (String) (defaults to: undef)

    the weblogic domain password

  • weblogic_home_dir (String) (defaults to: $::orawls::weblogic::weblogic_home_dir)

    directory of the WebLogic software inside the middleware directory

  • jdk_home_dir (String) (defaults to: $::orawls::weblogic::jdk_home_dir)

    full path to the java home directory like /usr/java/default

  • os_user (String) (defaults to: $::orawls::weblogic::os_user)

    the user name with oracle as default

  • os_group (String) (defaults to: $::orawls::weblogic::os_group)

    the group name with dba as default

  • log_output (Boolean) (defaults to: $::orawls::weblogic::log_output)

    show all the output of the the exec actions

  • download_dir (String) (defaults to: $::orawls::weblogic::download_dir)

    the directory for temporary created files by this class

  • action_name (Enum['create','delete']) (defaults to: 'create')

    create or delete

  • webgate_configure (Boolean) (defaults to: false)

    congigure webgate

  • webgate_agentname (String) (defaults to: undef)

    webgate agent name

  • webgate_hostidentifier (String) (defaults to: undef)

    webgate hostidentifier

  • oamadminserverhostname (String) (defaults to: 'localhost')

    oam adminserver hostname

  • oamadminserverport (Integer) (defaults to: 7001)

    oam adminserver port number

  • domain_configure (Boolean) (defaults to: true)

    11g register ohs instance with a domain

  • instance_name (String) (defaults to: undef)
  • machine_name (Optional[String]) (defaults to: undef)


30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
# File 'manifests/utils/webtier.pp', line 30

define orawls::utils::webtier(
  Integer $version                                        = $::orawls::weblogic::version,
  String $weblogic_home_dir                               = $::orawls::weblogic::weblogic_home_dir,
  String $middleware_home_dir                             = $::orawls::weblogic::middleware_home_dir,
  String $jdk_home_dir                                    = $::orawls::weblogic::jdk_home_dir,
  String $domain_name                                     = undef,
  Optional[String] $wls_domains_dir                       = $::orawls::weblogic::wls_domains_dir,
  String $adminserver_address                             = 'localhost',
  Integer $adminserver_port                               = 7001,
  Enum['create','delete'] $action_name                    = 'create',
  Boolean $webgate_configure                              = false,
  String $webgate_agentname                               = undef,
  String $webgate_hostidentifier                          = undef,
  String $oamadminserverhostname                          = 'localhost',
  Integer $oamadminserverport                             = 7001,
  Boolean $domain_configure                               = true, # 11g register ohs instance with a domain
  String $instance_name                                   = undef,
  Optional[String] $machine_name                          = undef,
  String $weblogic_user                                   = 'weblogic',
  String $weblogic_password                               = undef,
  String $os_user                                         = $::orawls::weblogic::os_user,
  String $os_group                                        = $::orawls::weblogic::os_group,
  String $download_dir                                    = $::orawls::weblogic::download_dir,
  Boolean $log_output                                     = $::orawls::weblogic::log_output,
){
  if ( $wls_domains_dir == undef ) {
    $domains_dir = "${middleware_home_dir}/user_projects/domains"
  } else {
    $domains_dir =  $wls_domains_dir
  }
  $domain_dir = "${domains_dir}/${domain_name}"

  $exec_path = "${jdk_home_dir}/bin:${lookup('orawls::exec_path')}"

  if ( $version == 1212 or $version == 1213 or $version >= 1221 ){
    file { "${download_dir}/${title}_createWebtier.py":
      ensure  => present,
      content => template('orawls/wlst/wlstexec/fmw/createWebtier.py.erb'),
      backup  => false,
      replace => true,
      mode    => '0775',
      owner   => $os_user,
      group   => $os_group,
    }

    if $action_name == 'create' {
      exec { "execwlst webtier ${title}":
        command     => "${middleware_home_dir}/ohs/common/bin/wlst.sh ${download_dir}/${title}_createWebtier.py ${weblogic_password}",
        environment => ["JAVA_HOME=${jdk_home_dir}"],
        path        => $exec_path,
        creates     => "${domain_dir}/system_components/OHS/${instance_name}",
        user        => $os_user,
        group       => $os_group,
        logoutput   => $log_output,
        require     => File["${download_dir}/${title}_createWebtier.py"],
      }
    } else {
      exec { "execwlst webtier ${title}":
        command     => "${middleware_home_dir}/ohs/common/bin/wlst.sh ${download_dir}/${title}_createWebtier.py ${weblogic_password}",
        environment => ["JAVA_HOME=${jdk_home_dir}"],
        path        => $exec_path,
        onlyif      => "test -d ${domain_dir}/system_components/OHS/${instance_name}",
        user        => $os_user,
        group       => $os_group,
        logoutput   => $log_output,
        require     => File["${download_dir}/${title}_createWebtier.py"],
      }
    }
  } else {

    $instance_home = "${middleware_home_dir}/Oracle_WT1/instances/${instance_name}"
    $instance_id   = "${middleware_home_dir}/Oracle_WT1/instances/${instance_name}/config/OHS/${instance_name}"

    file { "${download_dir}/${title}_configureWebtier.rsp":
      ensure  => present,
      content => template('orawls/wlst/wlstexec/fmw/configureWebtier.rsp.erb'),
      backup  => false,
      replace => true,
      mode    => '0775',
      owner   => $os_user,
      group   => $os_group,
    }

    exec { "config webtier ${title}":
      command     => "/bin/sh -c 'unset DISPLAY;${middleware_home_dir}/Oracle_WT1/bin/config.sh -silent -response ${download_dir}/${title}_configureWebtier.rsp -waitforcompletion'",
      environment => ["JAVA_HOME=${jdk_home_dir}"],
      path        => $exec_path,
      creates     => "${middleware_home_dir}/Oracle_WT1/instances/${instance_name}",
      user        => $os_user,
      group       => $os_group,
      logoutput   => $log_output,
      require     => File["${download_dir}/${title}_configureWebtier.rsp"],
    }

    if ( $webgate_configure == true ) {

      # Note: rreg really should NOT be run from the "WebGate" machine
      # instead it should be run on the OAM server, the output artifacts stored in a secure place,
      # and then copied from there upon installation of the WebGate
      # for now this is an OK start

      # first create the input file:
      file { "${middleware_home_dir}/Oracle_IDM1/oam/server/rreg/input/${webgate_agentname}.xml":
        ensure  => present,
        content => template('orawls/oam/rreg_input.xml.erb'),
        backup  => false,
        replace => true,
        mode    => '0440',
        owner   => $os_user,
        group   => $os_group,
      }

      file { "${middleware_home_dir}/Oracle_IDM1/oam/server/rreg/bin/oamreg.sh":
        ensure => file,
        mode   => '0700',
      }

      # in the real world rreg wouldn't be run on the host running the WebTier bits
      exec { "Run rreg for WebGate instance ${webgate_agentname}":
        #command     => "/bin/echo -e ${middleware_home_dir}/Oracle_IDM1/oam/server/rreg/bin/oamreg.sh inband input/${webgate_agentname}.xml",
        command     => "/bin/echo -e ${weblogic_user}\\\\n${weblogic_password}\\\\n|${middleware_home_dir}/Oracle_IDM1/oam/server/rreg/bin/oamreg.sh inband input/${webgate_agentname}.xml -noprompt",
        environment => ["JAVA_HOME=${jdk_home_dir}"],
        cwd         => "${middleware_home_dir}/Oracle_IDM1/oam/server/rreg",
        creates     => "${middleware_home_dir}/Oracle_IDM1/oam/server/rreg/output/${webgate_agentname}",
        path        => $exec_path,
        user        => $os_user,
        group       => $os_group,
        logoutput   => $log_output,
        require     => [File["${middleware_home_dir}/Oracle_IDM1/oam/server/rreg/input/${webgate_agentname}.xml"],File["${middleware_home_dir}/Oracle_IDM1/oam/server/rreg/bin/oamreg.sh"]]
      }

      exec { "Deploy webgate to ${instance_id}":
        command     => "${middleware_home_dir}/Oracle_OAMWebGate1/webgate/ohs/tools/deployWebGate/deployWebGateInstance.sh -w ${instance_id} -oh ${middleware_home_dir}/Oracle_OAMWebGate1",
        environment => "LD_LIBRARY_PATH='${middleware_home_dir}/Oracle_WT1/lib'",
        cwd         => "${middleware_home_dir}/Oracle_OAMWebGate1/webgate/ohs/tools/deployWebGate",
        creates     => "${instance_id}/webgate",
        path        => $exec_path,
        user        => $os_user,
        group       => $os_group,
        logoutput   => $log_output,
        require     => [Exec["config webtier ${title}"],Exec["Run rreg for WebGate instance ${webgate_agentname}"],],
      }

      # copy the output from rreg to the WebGate
      # in the real world the rreg artifacts would:
      # * be copied to this host during host provisioning
      #   OR
      # * would be stored on a fileserver accessible from this host
      #   e.g. from puppet:
      file { "Copy rreg artifacts for ${instance_id}":
        path    => "${instance_id}/webgate/config",
        source  => "${middleware_home_dir}/Oracle_IDM1/oam/server/rreg/output/${webgate_agentname}",
        recurse => true,
        require => [Exec["Deploy webgate to ${instance_id}"],Exec["Run rreg for WebGate instance ${webgate_agentname}"],],
      }

      exec { "EditHttpConf to enable webgate ${title}":
        command     => "${middleware_home_dir}/Oracle_OAMWebGate1/webgate/ohs/tools/setup/InstallTools/EditHttpConf -w ${instance_id} -oh ${middleware_home_dir}/Oracle_OAMWebGate1",
        environment => ["LD_LIBRARY_PATH=${middleware_home_dir}/Oracle_WT1/lib",
                        "ORACLE_HOME=${middleware_home_dir}/Oracle_OAMWebGate1"],
        cwd         => "${middleware_home_dir}/Oracle_OAMWebGate1/webgate/ohs/tools/setup/InstallTools",
        path        => $exec_path,
        unless      => "grep -c '${instance_id}/webgate.conf' ${instance_id}/httpd.conf",
        user        => $os_user,
        group       => $os_group,
        logoutput   => $log_output,
        require     => [Exec["Deploy webgate to ${instance_id}"],File["Copy rreg artifacts for ${instance_id}"],],
      }

      # after enabling a WebGate you need to bounce OHS
      exec { "Stop OHS instance ${title}":
        command   => "/bin/sh -c 'unset DISPLAY;${middleware_home_dir}/Oracle_WT1/instances/${instance_name}/bin/opmnctl stopall'",
        path      => $exec_path,
        user      => $os_user,
        group     => $os_group,
        logoutput => $log_output,
        require   => Exec["EditHttpConf to enable webgate ${title}"],
      }

      exec { "Start OHS instance ${title}":
        command   => "/bin/sh -c 'unset DISPLAY;${middleware_home_dir}/Oracle_WT1/instances/${instance_name}/bin/opmnctl startall'",
        path      => $exec_path,
        user      => $os_user,
        group     => $os_group,
        logoutput => $log_output,
        require   => Exec["Stop OHS instance ${title}"],
      }
    }
  }
}