Centos 7 Saltstack自动化部署weblogic 12c-阿里云开发者社区

开发者社区> 开发与运维> 正文

Centos 7 Saltstack自动化部署weblogic 12c

简介:

# pwd

/etc/salt/base


# tree cluster/

cluster/

├── files

│   ├── creat.rsp             ------1

│   ├── startSer01.sh      ------2

│   └── startSer02.sh      ------3

└── weblogic.sls             ------4


1.creat.rsp

read template from "/home/weblogic/Oracle/Middleware/Oracle_Home/wlserver/common/templates/wls/wls.jar";

set JavaHome "/usr/java/jdk1.8.0_141";

set ServerStartMode "dev";

find Server "AdminServer" as AdminServer;

set AdminServer.ListenAddress "";

set AdminServer.ListenPort "7001";

create Cluster "Cluster-0" as Clustername1;


create Server "Server-1" as BASE;

set BASE.ListenAddress "";

set BASE.ListenPort "8001";

set BASE.cluster "Cluster-0";


create Server "Server-2" as BASE2;

set BASE2.ListenAddress "";

set BASE2.ListenPort "8002";

set BASE.cluster "Cluster-0";


find User "weblogic" as weblogic;

set weblogic.password "weblogic123";

write domain to "/home/weblogic/domains/jydomains";

close template;




2.startSer01.sh


#!/bin/bash

export  USER_MEM_ARGS="-Xms1024m -Xmx2048m -XX:PermSize=1024m"

pidb=$(ps -ef|grep java|grep 'weblogic.Name=Server-1'|awk '{print $2}')

echo 'kill '$pidb

kill -9 $pidb 1>/dev/null

sleep 5

domains=/home/weblogic/domains/jydomains

cd $domains

./bin/startManagedWebLogic.sh Server-1 http://IP:7001 1>$domains/servers/Server-1/logs/Server-1.log  2>$domains/servers/Server-1/logs/Server-1-stderr.log &


3.startSer02.sh

#!/bin/bash

export  USER_MEM_ARGS="-Xms1024m -Xmx2048m -XX:PermSize=1024m"

pidb=$(ps -ef|grep java|grep 'weblogic.Name=Server-2'|awk '{print $2}')

echo 'kill '$pidb

kill -9 $pidb 1>/dev/null

sleep 5

domains=/home/weblogic/domains/jydomains

cd $domains

./bin/startManagedWebLogic.sh Server-2 http://IP:7001 1>$domains/servers/Server-2/logs/Server-2.log  2>$domains/servers/Server-2/logs/Server-2-stderr.log &



4.weblogic.sls 

include:

  - weblogic.install



startSer01:

  file.managed:

    - name: /home/weblogic/domains/jydomains/startSer01.sh

    - source: salt://cluster/files/startSer01.sh

    - user: weblogic

    - group: weblogic

    - mode: 755


startSer02:

  file.managed:

    - name: /home/weblogic/domains/jydomains/startSer02.sh

    - source: salt://cluster/files/startSer02.sh

    - user: weblogic

    - group: weblogic

    - mode: 755


weblogic-service:

  file.managed:

    - name: /tmp/creat.rsp

    - source: salt://cluster/files/creat.rsp

    - user: weblogic

    - group: weblogic

    - mode: 755


  cmd.run:

    - name:  export  CONFIG_JVM_ARGS='-Djava.security.egd=file:/dev/urandom' &&  /home/weblogic/Oracle/Middleware/Oracle_Home/wlserver/common/bin/config.sh -mode=silent -silent_script=/tmp/creat.rsp & 

    - user: weblogic




# tree weblogic/

weblogic/

├── files

│   ├── fmw_12.2.1.2.0_infrastructure.jar     ------1

│   ├── fmw_12.2.1.2.0_infrastructure.rsp    ------2

│   ├── jdk-8u141-linux-x64.rpm                -------3

│   └── oraInst.loc                                         ------4

└── install.sls                                                 ------5



1.fmw_12.2.1.2.0_infrastructure.jar

2.fmw_12.2.1.2.0_infrastructure.rsp

[ENGINE]

Response File Version=1.0.0.0.0

[GENERIC]

DECLINE_AUTO_UPDATES=true

MOS_USERNAME=

MOS_PASSWORD=<SECURE VALUE>

AUTO_UPDATES_LOCATION=

SOFTWARE_UPDATES_PROXY_SERVER=

SOFTWARE_UPDATES_PROXY_PORT=

SOFTWARE_UPDATES_PROXY_USER=

SOFTWARE_UPDATES_PROXY_PASSWORD=<SECURE VALUE>

ORACLE_HOME=/home/weblogic/Oracle/Middleware/Oracle_Home

INSTALL_TYPE=Fusion Middleware Infrastructure

MYORACLESUPPORT_USERNAME=

MYORACLESUPPORT_PASSWORD=<SECURE VALUE>

DECLINE_SECURITY_UPDATES=true

SECURITY_UPDATES_VIA_MYORACLESUPPORT=false

PROXY_HOST=

PROXY_PORT=

PROXY_USER=

PROXY_PWD=<SECURE VALUE>

COLLECTOR_SUPPORTHUB_URL=



3.jdk-8u141-linux-x64.rpm


4.oraInst.loc

inventory_loc=/home/weblogic/oraInventory

inst_group=weblogic


5.install.sls


include:

  - pkg.jdk-init


weblogic:

  group.present:

    - name: weblogic

    - gid: 2000

  user.present:

    - fullname: weblogic

    - shell: /bin/bash

    - password: 'Pa$$w0rd'

    - home: /home/weblogic

    - uid: 2000

    - gid: 2000

    


/tmp/oraInst.loc:

    file.managed:

    - source: salt://weblogic/files/oraInst.loc

    - mode: 755

    - user: weblogic

    - group: weblogic


/tmp/fmw_12.2.1.2.0_infrastructure.rsp:

  file.managed:

    - source: salt://weblogic/files/fmw_12.2.1.2.0_infrastructure.rsp

    - mode: 755

    - user: weblogic

    - group: weblogic


weblogic-install:

  file.managed:

    - name: /tmp/fmw_12.2.1.2.0_infrastructure.jar

    - source: salt://weblogic/files/fmw_12.2.1.2.0_infrastructure.jar

    - mode: 755

    - user: weblogic

    - group: weblogic


  cmd.run:

    - name: /usr/java/jdk1.8.0_141/bin/java  -jar /tmp/fmw_12.2.1.2.0_infrastructure.jar -silent -responseFile /tmp/fmw_12.2.1.2.0_infrastructure.rsp -invPtrLoc /tmp/oraInst.loc   & 

    - user: weblogic

    - require:

      - file: weblogic-install 








      本文转自潘阔 51CTO博客,原文链接:http://blog.51cto.com/pankuo/1982971,如需转载请自行联系原作者

版权声明:本文首发在云栖社区,遵循云栖社区版权声明:本文内容由互联网用户自发贡献,版权归用户作者所有,云栖社区不为本文内容承担相关法律责任。云栖社区已升级为阿里云开发者社区。如果您发现本文中有涉嫌抄袭的内容,欢迎发送邮件至:developer2020@service.aliyun.com 进行举报,并提供相关证据,一经查实,阿里云开发者社区将协助删除涉嫌侵权内容。

分享:
开发与运维
使用钉钉扫一扫加入圈子
+ 订阅

集结各类场景实战经验,助你开发运维畅行无忧

其他文章