Skip to content

Commit

Permalink
Merge pull request #422 from ministryofjustice/oasys/bip-build-improv…
Browse files Browse the repository at this point in the history
…ement2

Added libraries and cache reload in code and removed delay in service startup
  • Loading branch information
wullub authored Dec 6, 2023
2 parents 96ecf1f + c7ad2e0 commit 6b1717f
Show file tree
Hide file tree
Showing 18 changed files with 180 additions and 53 deletions.
2 changes: 2 additions & 0 deletions ansible/roles/oasys-bip/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ oas_mds_password_file: "{{ stage }}/oas_mds_password.txt"
oas_biplatform_password_file: "{{ stage }}/oas_biplatform_password.txt"
weblogic_password_file: "{{ stage }}/weblogic_password.txt"
admin_password_file: "{{ stage }}/weblogic_password.txt"
admin_port: 7001
bip_repository_file: bip_repository_12Oct2023.tar
weblogic_admin_username: weblogic
admin_server: AdminServer
managed_server: bi_server1
scripts_dir: /home/oracle/admin/scripts
weblogic_servers:
Expand Down
20 changes: 14 additions & 6 deletions ansible/roles/oasys-bip/tasks/clone_bip_software.yml
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@
collected_files.files
}}
- name: Pause for 15 minutes to let admin server start properly in few cases even though it was running connecting to it was causing issues for few mins
- name: Pause for 15 minutes. Sometimes the cloning can go wrong without a delay. Not sure why.
ansible.builtin.pause:
minutes: 15

Expand All @@ -238,18 +238,26 @@
poll: 30
when: not ansible_check_mode

- name: Boot.properties file creation for bi_server1
- name: Boot.properties file creation for managed server
ansible.builtin.copy:
src: "{{ domain_home }}/{{ domain_name }}/servers/AdminServer/security/boot.properties"
dest: "{{ domain_home }}/{{ domain_name }}/servers/bi_server1/security/boot.properties"
src: "{{ domain_home }}/{{ domain_name }}/servers/{{ admin_server }}/security/boot.properties"
dest: "{{ domain_home }}/{{ domain_name }}/servers/{{ managed_server }}/security/boot.properties"
owner: oracle
group: oinstall
mode: "0600"
remote_src: true

- name: Pause for 15 minutes to let admin server start properly in few cases even though it was running connecting to it was causing issues for few mins
- name: Fix startManagedWebLogic.sh
ansible.builtin.template:
src: "startManagedWebLogic.sh.j2"
dest: "{{domain_home}}/{{domain_name}}/bin/startManagedWebLogic.sh"
owner: oracle
group: oinstall
mode: "0750"

- name: Pause for 1 minute. Not sure why.
ansible.builtin.pause:
minutes: 15
minutes: 1

- name: Enable Standalone BI Publisher to Add Privileges for Application Roles
become_user: oracle
Expand Down
2 changes: 1 addition & 1 deletion ansible/roles/oasys-bip/tasks/install-jdk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
mode: get
overwrite: latest
loop:
- /u01/software/jdk/jdk-7u80-linux-x64.rpm
- /jdk/jdk-7u80-linux-x64.rpm
when: image_builder_s3_bucket_name is defined

- name: Install jdk rpm binary
Expand Down
5 changes: 5 additions & 0 deletions ansible/roles/oasys-bip/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,8 @@
tags:
- bip_db_create
- never

- import_tasks: service_managedserver.yml
tags:
- amibuild
- ec2provision
10 changes: 10 additions & 0 deletions ansible/roles/oasys-bip/tasks/service_managedserver.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
- name: Pause for 30 minutes to let admin server start properly in few cases even though it was running connecting to it was causing issues for few mins
ansible.builtin.pause:
minutes: 20

- name: Start weblogic managed server
ansible.builtin.service:
name: "{{ item }}"
state: started
loop:
- wls_managedserver
31 changes: 17 additions & 14 deletions ansible/roles/oasys-bip/tasks/services.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
---
- name: Reload necessary links and cache to the most recent shared libraries
ansible.builtin.shell: ldconfig

- name: Stop Weblogic and nodemanager
become_user: oracle
ansible.builtin.shell: |
Expand All @@ -19,7 +22,7 @@
group: oinstall
mode: "0700"

- name: Copy nodemanager systemd helper scripts
- name: Copy weblogic systemd helper scripts
ansible.builtin.template:
src: "10.3{{ item }}"
dest: "{{ item }}"
Expand Down Expand Up @@ -68,18 +71,18 @@
loop:
- wls_nodemanager
- wls_adminserver
# - name: Pause for 30 minutes to let admin server start properly in few cases even though it was running connecting to it was causing issues for few mins
# ansible.builtin.pause:
# minutes: 30

- name: Pause for 15 minutes to let admin server start properly in few cases even though it was running connecting to it was causing issues for few mins
ansible.builtin.pause:
minutes: 15

- name: Start weblogic services
ansible.builtin.service:
name: "{{ item }}"
state: started
loop:
- wls_managedserver
# - name: Start weblogic managed server
# become: yes
# ansible.builtin.service:
# name: "{{ item }}"
# state: started
# loop:
# - wls_managedserver

- name: Pause for 15 minutes to let admin server start properly in few cases even though it was running connecting to it was causing issues for few mins
ansible.builtin.pause:
minutes: 15
# - name: Pause for 15 minutes to let admin server start properly in few cases even though it was running connecting to it was causing issues for few mins
# ansible.builtin.pause:
# minutes: 15
9 changes: 0 additions & 9 deletions ansible/roles/oasys-bip/tasks/setup-log-rotate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,6 @@
set_fact:
weblogic_managed_app: "{{ weblogic_managed_app_list.name }}"

- name: Start services if not already running
ansible.builtin.service:
name: "{{ item }}"
state: started
loop:
- wls_nodemanager
- wls_adminserver
- wls_managedserver

- block:
- name: Copy log setup managed app configuration files
ansible.builtin.template:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[Unit]
Description=WebLogic Admin Server
After=wls_nodemanager.service

[Service]
Type=simple
After=wls_nodemanager
TimeoutStartSec=300
ExecStart={{ scripts_dir }}/startWebLogic.sh
ExecStartPost={{ scripts_dir }}/waitWebLogic.sh
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[Unit]
Description=WebLogic managed server Service
After=wls_adminserver.service

[Service]
Type=simple
After=wls_adminserver
TimeoutStartSec=300
ExecStart={{ scripts_dir }}/startManagedWebLogic.sh
ExecStartPost={{ scripts_dir }}/waitManagedWebLogic.sh
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
adminURL = configProps.get("admin.url")
msName = configProps.get("ms.name")

# Connect to the AdminServer.
# Connect to the {{ admin_server }}.
connect(adminUsername, adminPassword, adminURL)

edit()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
domain.adminServerName=AdminServer
domain.adminurl={{ weblogic_domain_hostname }}:7001
domain.adminServerName={{ admin_server }}
domain.adminurl={{ weblogic_domain_hostname }}:{{ admin_port }}
4 changes: 2 additions & 2 deletions ansible/roles/oasys-bip/templates/AdminServer.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# AdminServer connection details.
admin.username={{ weblogic_admin_username }}
admin.password={{ weblogic_admin_password }}
admin.url={{ weblogic_domain_hostname }}:7001
admin.url={{ weblogic_domain_hostname }}:{{ admin_port }}

# Managed Server
ms.name=AdminServer
ms.name={{ admin_server }}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/expect
set PASSWORD [lindex $argv 0]

spawn {{ middleware_home }}/oracle_common/common/bin/wlst.sh {{ stage }}/addBIPCodeGrants.py t3://{{ weblogic_servername }}:7001 weblogic
spawn {{ middleware_home }}/oracle_common/common/bin/wlst.sh {{ stage }}/addBIPCodeGrants.py t3://{{ weblogic_servername }}:{{ admin_port }} weblogic
expect "\Please enter password:\]"
send "$PASSWORD\r"
expect eof
8 changes: 4 additions & 4 deletions ansible/roles/oasys-bip/templates/bi_config_moveplan.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<configProperty id="Server1">
<configProperty>
<name>Server Name</name>
<value>AdminServer</value>
<value>{{ admin_server }}</value>
<itemMetadata>
<dataType>STRING</dataType>
<scope>READ_ONLY</scope>
Expand All @@ -49,7 +49,7 @@
</configProperty>
<configProperty>
<name>Listen Port</name>
<value>7001</value>
<value>{{ admin_port }}</value>
<itemMetadata>
<dataType>INTEGER</dataType>
<scope>READ_WRITE</scope>
Expand All @@ -59,7 +59,7 @@
<configProperty id="Server2">
<configProperty>
<name>Server Name</name>
<value>bi_server1</value>
<value>{{ managed_server }}</value>
<itemMetadata>
<dataType>STRING</dataType>
<scope>READ_ONLY</scope>
Expand Down Expand Up @@ -157,7 +157,7 @@
</configProperty>
<configProperty>
<name>Multicast Port</name>
<value>7001</value>
<value>{{ admin_port }}</value>
<itemMetadata>
<dataType>INTEGER</dataType>
<scope>READ_WRITE</scope>
Expand Down
6 changes: 3 additions & 3 deletions ansible/roles/oasys-bip/templates/bi_server1.properties
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# AdminServer Connection
# {{ admin_server }} Connection

admin.username={{ weblogic_admin_username }}
admin.password={{ weblogic_admin_password }}
admin.url={{ weblogic_domain_hostname }}:7001
admin.url={{ weblogic_domain_hostname }}:{{ admin_port }}

# Managed Server
ms.name=bi_server1
ms.name={{ managed_server }}
4 changes: 2 additions & 2 deletions ansible/roles/oasys-bip/templates/domain.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ path.domain.config={{ domain_home }}
# Credentials
admin.username={{ weblogic_admin_username }}
admin.password={{ weblogic_admin_password }}
admin.url={{ weblogic_domain_hostname }}:7001
admin.port=7001
admin.url={{ weblogic_domain_hostname }}:{{ admin_port }}
admin.port={{ admin_port }}
admin.address={{ weblogic_domain_hostname }}

# Domain details
Expand Down
12 changes: 6 additions & 6 deletions ansible/roles/oasys-bip/templates/nm_moveplan.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,31 +59,31 @@
</itemMetadata>
</configProperty>
<configProperty>
<name>AdminServer Listen Address</name>
<name>{{ admin_server }} Listen Address</name>
<value>{{ weblogic_domain_hostname }}</value>
<itemMetadata>
<dataType>STRING</dataType>
<scope>READ_WRITE</scope>
</itemMetadata>
</configProperty>
<configProperty>
<name>AdminServer Listen Port</name>
<value>7001</value>
<name>{{ admin_server }} Listen Port</name>
<value>{{ admin_port }}</value>
<itemMetadata>
<dataType>INTEGER</dataType>
<scope>READ_WRITE</scope>
</itemMetadata>
</configProperty>
<configProperty>
<name>AdminServer User Name</name>
<name>{{ admin_server }} User Name</name>
<value>weblogic</value>
<itemMetadata>
<dataType>STRING</dataType>
<scope>READ_WRITE</scope>
</itemMetadata>
</configProperty>
<configProperty>
<name>AdminServer Password File</name>
<name>{{ admin_server }} Password File</name>
<value>{{ weblogic_password_file }}</value>
<itemMetadata>
<dataType>STRING</dataType>
Expand All @@ -94,7 +94,7 @@
<configProperty>
<name>Custom Trust Keystore File</name>
<value/>
<Description>Provide the value of Custom Trust KeyStore File of the domain, if value of the config property "AdminServer Listen Port" mentioned above represents SSL port of the server.</Description>
<Description>Provide the value of Custom Trust KeyStore File of the domain, if value of the config property "{{ admin_server }} Listen Port" mentioned above represents SSL port of the server.</Description>
<itemMetadata>
<dataType>STRING</dataType>
<scope>READ_WRITE</scope>
Expand Down
Loading

0 comments on commit 6b1717f

Please sign in to comment.