Monday, September 15, 2014

Puppet: quick hiera setup

cat /home/soa/.puppet/hiera.yaml

:hierarchy:
  - common

:backends:
    - yaml

:yaml:
    :datadir: '/home/soa'


cat /home/soa/common.yaml

install_cleanssbatchorder : true


To test if hiera is working:

puppet apply -e "if hiera('install_cleanssbatchorder', false) { notify { 'pippo':}} "


this should print:

notice: pippo
notice: /Stage[main]//Notify[pippo]/message: defined 'message' as 'pippo'
notice: Finished catalog run in 0.02 seconds

Sunday, September 14, 2014

Puppet: minimalistic custom fact

in your module, create a lib/facter folder.
There, create a customxpathversion.rb file containing this code:

require 'puppet'

Facter.add("customxpathversion") do
  setcode 'cat /opt/oracle/scripts/config/customxpathversion.txt'
end


where the file customxpathversion.txt contains "1.10"

Now if in your puppet code you do
notify { "${::customxpathversion}" : }


you get 1.10

Of course one should handle errors etc. But it works and I don't have to bother about $LOAD_PATH. From command line "facter customxpathversion" will not work because probably it's not in the LOAD_PATH.
Here the whole documentation Update: you can use this custom fact from the facter command line if you set the FACTERLIB environment variable:
find / -name customxpathversion*

/tmp/vagrant-puppet-3/modules-0/pippo/lib/facter/customxpathversion.rb
^C
[soa@osb-vagrant ~]$ export FACTERLIB=/tmp/vagrant-puppet-3/modules-0/pippo/lib/facter/
[soa@osb-vagrant ~]$ facter customxpathversion
1.10

Monday, September 8, 2014

WebLogic: Installing WebLogic 10.3.5 binaries and creating a domain in 2 minutes

Sometimes one need to create a throwaway domain in minutes....I hate having to remember all the small details....
how to create a weblogic domain
login to myhost
sudo su - soa
cd /opt/oracle/software
make sure wls1035_generic.jar is there
type "java -d64 -version"
if this gives 'java version "1.6.0_33"' -> OK


vi silent.xml

<?xml version="1.0" encoding="UTF-8"?>
   <bea-installer>
     <input-fields>
       <data-value name="BEAHOME" value="/opt/oracle/fmw11_1_1_5" />
       <data-value name="WLS_INSTALL_DIR" value="/opt/oracle/fmw11_1_1_5/wlserver_10.3" />
       <data-value name="COMPONENT_PATHS"
value="WebLogic Server/Core Application Server|WebLogic Server/Administration Console|WebLogic Server/Configuration Wizard and Upgrade Framework|WebLogic Server/Web 2.0 HTTP Pub-Sub Server|WebLogic Server/WebLogic JDBC Drivers|WebLogic Server/Third Party JDBC Drivers|WebLogic Server/WebLogic Server Clients|WebLogic Server/WebLogic Web Server Plugins|WebLogic Server/UDDI and Xquery Support|Oracle Coherence/Coherence Product Files|Oracle Coherence/Coherence Examples"/>
       <data-value name="NODEMGR_PORT" value="5556" />
       <data-value name="INSTALL_SHORTCUT_IN_ALL_USERS_FOLDER" value="no"/>
    <data-value name="LOCAL_JVMS" value="/usr/lib/jvm/java-1.6.0-sun-1.6.0.33.x86_64"/>
   </input-fields>
</bea-installer>

java -d64 -jar /opt/oracle/software/wls1035_generic.jar -mode=silent -silent_xml=silent.xml
alias wlst="/opt/oracle/fmw11_1_1_5/wlserver_10.3/common/bin/wlst.sh"
vi createToolsDomain.py
readTemplate('/opt/oracle/fmw11_1_1_5/wlserver_10.3/common/templates/domains/wls.jar')

cd('Servers/AdminServer')
set('ListenPort', 7101)
set('ListenAddress','myhost.acme.com')
cd('/')
cd('Security/base_domain/User/weblogic')
cmo.setPassword('bla')
setOption('OverwriteDomain', 'true')
writeDomain('/opt/oracle/domains/toolsdomain')
closeTemplate()
exit()


run this:
wlst createToolsDomain.py
cd /opt/oracle/domains/toolsdomain
vi start.sh
nohup /opt/oracle/domains/toolsdomain/startWebLogic.sh > /opt/oracle/domains/toolsdomain/adminserver.out 2>&1 &

chmod 755 start.sh
Console in http://myhost.acme.com:7101/console/