| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218 |
- # == Define: wls::wlstexec
- #
- # generic wlst script
- #
- # pass on the weblogic username or password
- # or provide userConfigFile and userKeyFile file locations
- #
- # === Examples
- #
- # case $operatingsystem {
- # centos, redhat, OracleLinux, Ubuntu, debian: {
- # $osMdwHome = "/opt/oracle/wls/wls11g"
- # $osWlHome = "/opt/oracle/wls/wls11g/wlserver_10.3"
- # $osDomainPath = "/opt/oracle/wls/wls11g/admin"
- # $user = "oracle"
- # $group = "dba"
- # }
- # windows: {
- # $osMdwHome = "c:/oracle/wls/wls11g"
- # $osWlHome = "c:/oracle/wls/wls11g/wlserver_10.3"
- # $osDomainPath = "c:/oracle/wls/wls11g/admin"
- # $user = "Administrator"
- # $group = "Administrators"
- # $serviceName = "C_oracle_wls_wls11g_wlserver_10.3"
- # }
- # }
- #
- # # default parameters for the wlst scripts
- # Wls::Wlstexec {
- # wlsDomain => "${osDomainPath}/osbDomain",
- # wlHome => $osWlHome,
- # fullJDKName => $jdkWls11gJDK,
- # user => $user,
- # group => $group,
- # address => "localhost",
- # wlsUser => "weblogic",
- # password => "weblogic1",
- # port => "5556",
- # }
- #
- # # create jdbc datasource for osb_server1
- # wls::wlstexec {
- #
- # 'createJdbcDatasourceHr':
- # wlstype => "jdbc",
- # wlsObjectName => "hrDS",
- # script => 'createJdbcDatasource.py',
- # params => ["dsName = 'hrDS'",
- # "jdbcDatasourceTargets = 'AdminServer,osb_server1'",
- # "dsJNDIName = 'jdbc/hrDS'",
- # "dsDriverName = 'oracle.jdbc.xa.client.OracleXADataSource'",
- # "dsURL = 'jdbc:oracle:thin:@master.alfa.local:1521/XE'",
- # "dsUserName = 'hr'",
- # "dsPassword = 'hr'",
- # "datasourceTargetType = 'Server'",
- # "globalTransactionsProtocol = 'xxxx'"
- # ],
- # }
- #
- #
- define wls::wlstexec ($version = '1111',
- $wlsDomain = undef,
- $wlstype = undef,
- $wlsObjectName = undef,
- $wlHome = undef,
- $fullJDKName = undef,
- $script = undef,
- $address = "localhost",
- $port = '7001',
- $wlsUser = undef,
- $password = undef,
- $userConfigFile = undef,
- $userKeyFile = undef,
- $user = 'oracle',
- $group = 'dba',
- $params = undef,
- $downloadDir = '/install',
- $logOutput = false,
- ) {
- # if these params are empty always continue
- if $wlsDomain == undef or $wlstype == undef or wlsObjectName == undef {
- $continue = true
- } else {
- # check if the object already exists on the weblogic domain
- $found = artifact_exists($wlsDomain ,$wlstype,$wlsObjectName ,$version)
- if $found == undef {
- $continue = true
- notify {"wls::wlstexec ${title} ${version} continue true cause nill":}
- } else {
- if ( $found ) {
- $continue = false
- } else {
- notify {"wls::wlstexec ${title} ${version} continue true cause not exists":}
- $continue = true
- }
- }
- }
- # use userConfigStore for the connect
- if $password == undef {
- $useStoreConfig = true
- } else {
- $useStoreConfig = false
- }
- if ( $continue ) {
- $javaCommand = "java -Dweblogic.security.SSL.ignoreHostnameVerification=true weblogic.WLST -skipWLSModuleScanning "
- case $operatingsystem {
- CentOS, RedHat, OracleLinux, Ubuntu, Debian, SLES: {
- $execPath = "/usr/java/${fullJDKName}/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:"
- $path = $downloadDir
- $JAVA_HOME = "/usr/java/${fullJDKName}"
- Exec { path => $execPath,
- user => $user,
- group => $group,
- logoutput => $logOutput,
- }
- File {
- ensure => present,
- replace => 'yes',
- mode => 0555,
- owner => $user,
- group => $group,
- }
- }
- Solaris: {
- $execPath = "/usr/jdk/${fullJDKName}/bin/amd64:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:"
- $path = $downloadDir
- $JAVA_HOME = "/usr/jdk/${fullJDKName}"
- Exec { path => $execPath,
- user => $user,
- group => $group,
- logoutput => $logOutput,
- }
- File {
- ensure => present,
- replace => 'yes',
- mode => 0775,
- owner => $user,
- group => $group,
- }
- }
- windows: {
- $execPath = "C:\\oracle\\${fullJDKName}\\bin;C:\\unxutils\\bin;C:\\unxutils\\usr\\local\\wbin;C:\\Windows\\system32;C:\\Windows"
- $path = $downloadDir
- $JAVA_HOME = "c:\\oracle\\${fullJDKName}"
- Exec { path => $execPath,
- logoutput => $logOutput,
- }
- File { ensure => present,
- replace => 'yes',
- mode => 0777,
- }
- }
- }
- # the py script used by the wlst
- file { "${path}/${title}${script}":
- path => "${path}/${title}${script}",
- content => template("wls/wlst/${script}.erb"),
- }
- case $operatingsystem {
- CentOS, RedHat, OracleLinux, Ubuntu, Debian, SLES, Solaris: {
- exec { "execwlst ${title}${script}":
- command => "${javaCommand} ${path}/${title}${script}",
- environment => ["CLASSPATH=${wlHome}/server/lib/weblogic.jar",
- "JAVA_HOME=${JAVA_HOME}"],
- require => File["${path}/${title}${script}"],
- }
- case $operatingsystem {
- CentOS, RedHat, OracleLinux, Ubuntu, Debian, SLES: {
- exec { "rm ${path}/${title}${script}":
- command => "rm -I ${path}/${title}${script}",
- require => Exec["execwlst ${title}${script}"],
- }
- }
- Solaris: {
- exec { "rm ${path}/${title}${script}":
- command => "rm ${path}/${title}${script}",
- require => Exec["execwlst ${title}${script}"],
- }
- }
- }
- }
- windows: {
- exec { "execwlst ${title}${script}":
- command => "C:\\Windows\\System32\\cmd.exe /c ${javaCommand} ${path}/${title}${script}",
- environment => ["CLASSPATH=${wlHome}\\server\\lib\\weblogic.jar",
- "JAVA_HOME=${JAVA_HOME}"],
- require => File["${path}/${title}${script}"],
- }
- exec { "rm ${path}/${title}${script}":
- command => "C:\\Windows\\System32\\cmd.exe /c rm ${path}/${title}${script}",
- require => Exec["execwlst ${title}${script}"],
- }
- }
- }
- }
- }
|