From 612e79623e2f69255de96ee4d592c79d5c418346 Mon Sep 17 00:00:00 2001 From: sandhya Gandalwar Date: Mon, 14 Aug 2023 12:10:26 +0100 Subject: [PATCH 01/19] First draft code --- ansible/roles/oasys-bip/defaults/main.yml | 17 + ansible/roles/oasys-bip/meta/main.yml | 6 + .../roles/oasys-bip/tasks/certificate-fix.yml | 160 +++++++++ .../oasys-bip/tasks/create-managed-app.yml | 126 +++++++ .../oasys-bip/tasks/create-xtag-domain.yml | 63 ++++ .../oasys-bip/tasks/extract-s3-archive.yml | 45 +++ ansible/roles/oasys-bip/tasks/get-facts.yml | 52 +++ ansible/roles/oasys-bip/tasks/install-jdk.yml | 33 ++ .../roles/oasys-bip/tasks/install-server.yml | 64 ++++ ansible/roles/oasys-bip/tasks/main.yml | 118 +++++++ .../oasys-bip/tasks/moj-admin-scripts.yml | 37 ++ .../oasys-bip/tasks/oracle-limits-update.yml | 16 + ansible/roles/oasys-bip/tasks/packages.yml | 38 ++ .../roles/oasys-bip/tasks/patch-weblogic.yml | 50 +++ ansible/roles/oasys-bip/tasks/service.yml | 30 ++ .../oasys-bip/tasks/setup-log-rotate.yml | 43 +++ ansible/roles/oasys-bip/tasks/swap.yml | 26 ++ ansible/roles/oasys-bip/tasks/users.yml | 14 + .../templates/10.3/etc/logrotate.d/nomis-web | 10 + .../etc/systemd/system/nodemanager.service | 16 + .../systemd/system/wls_adminserver.service | 13 + .../systemd/system/wls_managedserver.service | 13 + .../systemd/system/wls_nodemanager.service | 13 + .../templates/10.3/home/oracle/.bash_profile | 24 ++ .../10.3/home/oracle/admin/scripts/README.md | 42 +++ .../admin/scripts/create_managed_app.py | 324 ++++++++++++++++++ .../home/oracle/admin/scripts/get_param.py | 50 +++ .../home/oracle/admin/scripts/ms_state.py | 30 ++ .../home/oracle/admin/scripts/ms_state.sh | 11 + .../admin/scripts/set_ms_log_rotation.py | 57 +++ .../home/oracle/admin/scripts/set_param.py | 57 +++ .../oracle/admin/scripts/stopNodeManager.sh | 8 + .../admin/scripts/wait_for_entry_in_log.sh | 22 ++ .../oracle/admin/scripts/weblogic.properties | 2 + .../oracle/admin/scripts/weblogicControl.py | 130 +++++++ .../AdminServer/security/boot.properties | 3 + .../software/weblogic/AdminServer.properties | 7 + .../weblogic/WLS_XTAG_OUTBOUND_01.properties | 46 +++ .../u01/software/weblogic/domain.properties | 15 + .../10.3/u01/software/weblogic/silent.xml | 10 + .../oasys-bip/templates/bip_install.rsp.j2 | 159 +++++++++ .../oasys-bip/templates/bip_password.tmp.j2 | 3 + .../roles/oasys-bip/templates/oraInst.loc.j2 | 2 + 43 files changed, 2005 insertions(+) create mode 100644 ansible/roles/oasys-bip/defaults/main.yml create mode 100644 ansible/roles/oasys-bip/meta/main.yml create mode 100644 ansible/roles/oasys-bip/tasks/certificate-fix.yml create mode 100644 ansible/roles/oasys-bip/tasks/create-managed-app.yml create mode 100644 ansible/roles/oasys-bip/tasks/create-xtag-domain.yml create mode 100644 ansible/roles/oasys-bip/tasks/extract-s3-archive.yml create mode 100644 ansible/roles/oasys-bip/tasks/get-facts.yml create mode 100644 ansible/roles/oasys-bip/tasks/install-jdk.yml create mode 100644 ansible/roles/oasys-bip/tasks/install-server.yml create mode 100644 ansible/roles/oasys-bip/tasks/main.yml create mode 100644 ansible/roles/oasys-bip/tasks/moj-admin-scripts.yml create mode 100644 ansible/roles/oasys-bip/tasks/oracle-limits-update.yml create mode 100644 ansible/roles/oasys-bip/tasks/packages.yml create mode 100644 ansible/roles/oasys-bip/tasks/patch-weblogic.yml create mode 100644 ansible/roles/oasys-bip/tasks/service.yml create mode 100644 ansible/roles/oasys-bip/tasks/setup-log-rotate.yml create mode 100644 ansible/roles/oasys-bip/tasks/swap.yml create mode 100644 ansible/roles/oasys-bip/tasks/users.yml create mode 100644 ansible/roles/oasys-bip/templates/10.3/etc/logrotate.d/nomis-web create mode 100644 ansible/roles/oasys-bip/templates/10.3/etc/systemd/system/nodemanager.service create mode 100644 ansible/roles/oasys-bip/templates/10.3/etc/systemd/system/wls_adminserver.service create mode 100644 ansible/roles/oasys-bip/templates/10.3/etc/systemd/system/wls_managedserver.service create mode 100644 ansible/roles/oasys-bip/templates/10.3/etc/systemd/system/wls_nodemanager.service create mode 100644 ansible/roles/oasys-bip/templates/10.3/home/oracle/.bash_profile create mode 100644 ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/README.md create mode 100644 ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/create_managed_app.py create mode 100644 ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/get_param.py create mode 100644 ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/ms_state.py create mode 100755 ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/ms_state.sh create mode 100644 ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/set_ms_log_rotation.py create mode 100644 ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/set_param.py create mode 100644 ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/stopNodeManager.sh create mode 100755 ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/wait_for_entry_in_log.sh create mode 100644 ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/weblogic.properties create mode 100644 ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/weblogicControl.py create mode 100644 ansible/roles/oasys-bip/templates/10.3/u01/app/oracle/Middleware/user_projects/domains/NomisDomain/servers/AdminServer/security/boot.properties create mode 100644 ansible/roles/oasys-bip/templates/10.3/u01/software/weblogic/AdminServer.properties create mode 100644 ansible/roles/oasys-bip/templates/10.3/u01/software/weblogic/WLS_XTAG_OUTBOUND_01.properties create mode 100644 ansible/roles/oasys-bip/templates/10.3/u01/software/weblogic/domain.properties create mode 100755 ansible/roles/oasys-bip/templates/10.3/u01/software/weblogic/silent.xml create mode 100644 ansible/roles/oasys-bip/templates/bip_install.rsp.j2 create mode 100644 ansible/roles/oasys-bip/templates/bip_password.tmp.j2 create mode 100644 ansible/roles/oasys-bip/templates/oraInst.loc.j2 diff --git a/ansible/roles/oasys-bip/defaults/main.yml b/ansible/roles/oasys-bip/defaults/main.yml new file mode 100644 index 000000000..5fcc03a30 --- /dev/null +++ b/ansible/roles/oasys-bip/defaults/main.yml @@ -0,0 +1,17 @@ +--- +ssm_parameters_prefix: "weblogic" +weblogic_domain_hostname: "{{ ansible_facts.hostname }}" +weblogic_servername: "{{ ansible_facts.hostname }}" +weblogic_cluster: "{{ ansible_facts.hostname }}" +weblogic_db_port: 1521 +ndh_ems_server: t1pml0005 +xtag_app_path: /u01/tag/xtag +middleware_home: /u01/app/oracle/Middleware +wl_home: /u01/app/oracle/Middleware/wlserver_10.3 +domain_home: /u01/app/oracle/Middleware/user_projects/domains +domain_name: NomisDomain +managed_server: WLS_XTAG_OUTBOUND_01 + +weblogic_servers: + - { name: WLS_XTAG_OUTBOUND_01 } + - { name: AdminServer } diff --git a/ansible/roles/oasys-bip/meta/main.yml b/ansible/roles/oasys-bip/meta/main.yml new file mode 100644 index 000000000..eda808260 --- /dev/null +++ b/ansible/roles/oasys-bip/meta/main.yml @@ -0,0 +1,6 @@ +--- +dependencies: + - role: get-ec2-facts + - role: ansible-requirements + - role: disable-ipv6 + - role: disable-firewall diff --git a/ansible/roles/oasys-bip/tasks/certificate-fix.yml b/ansible/roles/oasys-bip/tasks/certificate-fix.yml new file mode 100644 index 000000000..044d4e386 --- /dev/null +++ b/ansible/roles/oasys-bip/tasks/certificate-fix.yml @@ -0,0 +1,160 @@ +--- +- name: Create cert fix directory + ansible.builtin.file: + path: /home/oracle/.certificate-fix + state: directory + owner: oracle + group: oinstall + mode: "0755" + +- name: Check weblogic cert + ansible.builtin.stat: + path: /home/oracle/.certificate-fix/demokey.pem + register: weblogic_cert + +- name: Create weblogic keystore cert if not present + become_user: oracle + args: + chdir: /home/oracle/.certificate-fix + ansible.builtin.shell: | + set -eo pipefail + . ~/.bash_profile + . $WL_HOME/server/bin/setWLSEnv.sh + main() { + echo "# Generating democert" + java utils.CertGen -keyfilepass DemoIdentityPassPhrase -certfile democert -keyfile demokey -strength 1024 + } + main 2>&1 | logger -p local3.info -t ansible-weblogic + when: not weblogic_cert.stat.exists + +- name: List weblogic keystore certs + become_user: oracle + args: + chdir: /home/oracle/.certificate-fix + check_mode: false + changed_when: false + ansible.builtin.shell: | + set -eo pipefail + . ~/.bash_profile > /dev/null + . $WL_HOME/server/bin/setWLSEnv.sh > /dev/null + keytool -list -v -keystore DemoIdentity.jks -storepass DemoIdentityKeyStorePassPhrase || true + register: weblogic_keystore_list + +- name: Import weblogic keystore cert if not present + become_user: oracle + args: + chdir: /home/oracle/.certificate-fix + ansible.builtin.shell: | + set -eo pipefail + . ~/.bash_profile + . $WL_HOME/server/bin/setWLSEnv.sh + main() { + echo "# Importing cert into KeyStore" + java utils.ImportPrivateKey -keystore DemoIdentity.jks -storepass DemoIdentityKeyStorePassPhrase -keyfile demokey.pem -keyfilepass DemoIdentityPassPhrase -certfile democert.pem -alias demoidentity + keytool -importcert -trustcacerts -alias wlscertgenca -keystore DemoTrust.jks -storepass DemoTrustKeyStorePassPhrase -file /u01/app/oracle/Middleware/wlserver_10.3/server/lib/CertGenCA.der -noprompt + } + main 2>&1 | logger -p local3.info -t ansible-weblogic + +- name: Disable SecureListener in nodemanager.properties + ansible.builtin.replace: + path: "{{ wl_home }}/common/nodemanager/nodemanager.properties" + regexp: "SecureListener=true" + replace: "SecureListener=false" + +- name: Stop Admin server + become_user: oracle + ansible.builtin.shell: | + set -eo pipefail + . ~/.bash_profile + . $WL_HOME/server/bin/setWLSEnv.sh + "{{ domain_home }}/{{ domain_name }}/bin/stopWebLogic.sh" + +- name: Stop nodemanager processes + become_user: oracle + ansible.builtin.shell: | + ps -fu oracle | grep "weblogic.NodeManager"| grep -v grep | gawk '{print $2}' | xargs kill -9 + +- name: Start nodemanager + become_user: oracle + ansible.builtin.shell: | + set -eo pipefail + . ~/.bash_profile + . $WL_HOME/server/bin/setWLSEnv.sh + nohup {{ wl_home }}/server/bin/startNodeManager.sh & + +- name: Start adminserver + become_user: oracle + ansible.builtin.shell: | + set -eo pipefail + . ~/.bash_profile + . $WL_HOME/server/bin/setWLSEnv.sh + nohup {{ domain_home }}/{{ domain_name }}/bin/startWebLogic.sh & + async: 3600 + poll: 60 + +# Node manager and weblogic server for this to work +- name: Query current NMType + become_user: oracle + ansible.builtin.shell: | + set -eo pipefail + . ~/.bash_profile > /dev/null + . $WL_HOME/server/bin/setWLSEnv.sh > /dev/null + . {{ domain_home }}/{{ domain_name }}/bin/setDomainEnv.sh > /dev/null + wlst.sh ~/admin/scripts/get_param.py -d /Machines/{{ weblogic_domain_hostname }}/NodeManager/{{ weblogic_domain_hostname }} -n NMType + check_mode: false + changed_when: false + register: weblogic_nmtype_raw + +- name: Get current NMType + set_fact: + weblogic_nmtype: "{{ weblogic_nmtype_raw.stdout | regex_search(regexp,'\\1') }}" + vars: + regexp: 'Value=\"([^"]+)' + failed_when: weblogic_nmtype|length == 0 + +- debug: + msg: "Current NMType: {{ weblogic_nmtype }}" + +- name: Set NMType + become_user: oracle + ansible.builtin.shell: | + set -eo pipefail + . ~/.bash_profile > /dev/null + . $WL_HOME/server/bin/setWLSEnv.sh > /dev/null + . {{ domain_home }}/{{ domain_name }}/bin/setDomainEnv.sh > /dev/null + wlst.sh ~/admin/scripts/set_param.py -d /Machines/{{ weblogic_domain_hostname }}/NodeManager/{{ weblogic_domain_hostname }} -n NMType -v Plain + wlst.sh ~/admin/scripts/set_param.py -d /Machines/{{ weblogic_domain_hostname }}/NodeManager/{{ weblogic_domain_hostname }} -n ListenAddress -v {{ weblogic_domain_hostname }} + wlst.sh ~/admin/scripts/set_param.py -d /SecurityConfiguration/NomisDomain -n NodeManagerUsername -v {{ weblogic_admin_username }} + wlst.sh ~/admin/scripts/set_param.py -d /SecurityConfiguration/NomisDomain -n NodeManagerPassword -v {{ weblogic_admin_password }} + when: weblogic_nmtype != 'Plain' + +- name: Stop Admin server + become_user: oracle + ansible.builtin.shell: | + set -eo pipefail + . ~/.bash_profile + . $WL_HOME/server/bin/setWLSEnv.sh + {{ domain_home }}/{{ domain_name }}/bin/stopWebLogic.sh + +- name: Stop nodemanager processes + become_user: oracle + ansible.builtin.shell: | + ps -fu oracle | grep "weblogic.NodeManager"| grep -v grep | gawk '{print $2}' | xargs kill -9 + +- name: Start nodemanager + become_user: oracle + ansible.builtin.shell: | + set -eo pipefail + . ~/.bash_profile + . $WL_HOME/server/bin/setWLSEnv.sh + nohup {{ wl_home }}/server/bin/startNodeManager.sh & + +- name: Start adminserver + become_user: oracle + ansible.builtin.shell: | + set -eo pipefail + . ~/.bash_profile + . $WL_HOME/server/bin/setWLSEnv.sh + nohup {{ domain_home }}/{{ domain_name }}/bin/startWebLogic.sh & + async: 3600 + poll: 60 diff --git a/ansible/roles/oasys-bip/tasks/create-managed-app.yml b/ansible/roles/oasys-bip/tasks/create-managed-app.yml new file mode 100644 index 000000000..08250e46f --- /dev/null +++ b/ansible/roles/oasys-bip/tasks/create-managed-app.yml @@ -0,0 +1,126 @@ +--- +- name: Fail if managed_server variable not defined + fail: + msg: "Error, please ensure weblogic_server is defined" + when: managed_server is not defined + +- name: Check if managed app already configured + ansible.builtin.stat: + path: /etc/systemd/system/wls_managedserver.service + register: weblogic_created_managed_app_check + +- name: Configure managed app + block: + - debug: + msg: "Creating managed app {{ managed_server }}" + + - name: Copy managed app configuration files + ansible.builtin.template: + src: "10.3{{ item }}" + dest: "{{ item }}" + owner: oracle + group: oinstall + loop: + - /u01/software/weblogic/{{ managed_server }}.properties + + - name: Create application directories + ansible.builtin.file: + path: "{{ item }}" + state: directory + owner: oracle + group: oinstall + mode: "0755" + loop: + - "{{ xtag_app_path }}/log" + - "{{ xtag_app_path }}/release" + + - name: Get xtag application release file from S3 + amazon.aws.aws_s3: + bucket: "{{ image_builder_s3_bucket_name }}" + object: "weblogic-software{{ item }}" + dest: "{{ item }}" + mode: get + overwrite: latest + loop: + - "{{ xtag_app_path }}/release/install_xtagoutbound.zip" + + - name: Extract xtag application file + ansible.builtin.unarchive: + owner: oracle + group: oinstall + src: "{{ xtag_app_path }}/release/install_xtagoutbound.zip" + dest: "{{ xtag_app_path }}" + remote_src: true + + - name: Copy xtag lib files in {{ domain_name }} + ansible.builtin.copy: + owner: oracle + group: oinstall + src: "{{ xtag_app_path }}/lib/" + dest: "{{ domain_home }}/{{ domain_name }}/lib/" + remote_src: true + + - name: Create managed app + become_user: oracle + ansible.builtin.shell: | + set -eo pipefail + . ~/.bash_profile + . $WL_HOME/server/bin/setWLSEnv.sh + main() { + echo "# create managed app {{ managed_server }}" + java weblogic.WLST ~/admin/scripts/create_managed_app.py -p /u01/software/weblogic/{{ managed_server }}.properties + } + main 2>&1 | logger -p local3.info -t ansible-weblogic + async: 7200 + poll: 60 + + - name: Create managed app security directory + ansible.builtin.file: + path: "{{ item }}" + state: directory + owner: oracle + group: oinstall + mode: "0755" + loop: + - "{{ domain_home }}/{{ domain_name }}/servers/{{ managed_server }}/security" + + - name: Copy managed app boot properties + ansible.builtin.template: + src: "10.3{{ domain_home }}/{{ domain_name }}/servers/AdminServer/security/boot.properties" + dest: "{{ item }}" + owner: oracle + group: oinstall + force: false + loop: + - "{{ domain_home }}/{{ domain_name }}/servers/{{ managed_server }}/security/boot.properties" + + - name: Copy nodemanager stop script + ansible.builtin.template: + src: "10.3/home/oracle/admin/scripts/stopNodeManager.sh" + dest: "/home/oracle/admin/scripts/stopNodeManager.sh" + owner: oracle + group: oinstall + mode: 0744 + + - name: Stop managed server + become_user: oracle + ansible.builtin.shell: | + set -eo pipefail + . ~/.bash_profile + . $WL_HOME/server/bin/setWLSEnv.sh + nohup {{ domain_home }}/{{ domain_name }}/bin/stopManagedWebLogic.sh {{ managed_server }} + + - name: Stop adminserver + become_user: oracle + ansible.builtin.shell: | + set -eo pipefail + . ~/.bash_profile + . $WL_HOME/server/bin/setWLSEnv.sh + nohup {{ domain_home }}/{{ domain_name }}/bin/stopWebLogic.sh & + + - name: Stop nodemanager + become_user: oracle + ansible.builtin.shell: /home/oracle/admin/scripts/stopNodeManager.sh + + # block + when: not weblogic_created_managed_app_check.stat.exists diff --git a/ansible/roles/oasys-bip/tasks/create-xtag-domain.yml b/ansible/roles/oasys-bip/tasks/create-xtag-domain.yml new file mode 100644 index 000000000..21c073608 --- /dev/null +++ b/ansible/roles/oasys-bip/tasks/create-xtag-domain.yml @@ -0,0 +1,63 @@ +--- +- name: Create nomis xtag domain + block: + - name: Copy scripts and properties files + ansible.builtin.template: + src: "10.3{{ item }}" + dest: "{{ item }}" + owner: oracle + group: oinstall + loop: + - /u01/software/weblogic/WLS_XTAG_OUTBOUND_01.properties + - /u01/software/weblogic/domain.properties + - /u01/software/weblogic/AdminServer.properties + + - name: Start nodemanager + become_user: oracle + ansible.builtin.shell: | + set -eo pipefail + . ~/.bash_profile + . $WL_HOME/server/bin/setWLSEnv.sh + nohup /u01/app/oracle/Middleware/wlserver_10.3/server/bin/startNodeManager.sh & + + - name: Create weblogic Nomis xtag domain + become_user: oracle + ansible.builtin.shell: | + set -eo pipefail + . ~/.bash_profile + . $WL_HOME/server/bin/setWLSEnv.sh + java weblogic.WLST ~/admin/scripts/create_managed_app.py -p /u01/software/weblogic/domain.properties + + - name: Create security directories + ansible.builtin.file: + path: "{{ item }}" + state: directory + owner: oracle + group: oinstall + mode: "0755" + loop: + - /u01/app/oracle/Middleware/user_projects/domains/NomisDomain/servers/AdminServer/security + + # the boot.properties file is automatically updated by the weblogic server + - name: Copy Admin server boot properties file + ansible.builtin.template: + src: "10.3/u01/app/oracle/Middleware/user_projects/domains/NomisDomain/servers/AdminServer/security/boot.properties" + dest: "{{ item }}" + owner: oracle + group: oinstall + force: false + loop: + - /u01/app/oracle/Middleware/user_projects/domains/NomisDomain/servers/AdminServer/security/boot.properties + + # # - name: Start admin server + # ansible.builtin.service: + # name: weblogic-server + # enabled: yes + + - name: Start Admin server + become_user: oracle + ansible.builtin.shell: | + set -eo pipefail + . ~/.bash_profile + . $WL_HOME/server/bin/setWLSEnv.sh + nohup /u01/app/oracle/Middleware/user_projects/domains/NomisDomain/bin/startWebLogic.sh & diff --git a/ansible/roles/oasys-bip/tasks/extract-s3-archive.yml b/ansible/roles/oasys-bip/tasks/extract-s3-archive.yml new file mode 100644 index 000000000..f9bdf761e --- /dev/null +++ b/ansible/roles/oasys-bip/tasks/extract-s3-archive.yml @@ -0,0 +1,45 @@ +--- +- name: Fail if weblogic_s3_archives variable not defined + fail: + msg: "Error, please ensure weblogic_s3_archives is defined" + when: weblogic_s3_archives is not defined + +- name: Create archive directories + ansible.builtin.file: + path: "{{ item }}" + state: directory + owner: oracle + group: oinstall + mode: "0755" + loop: + - /u01/archives + +- name: Create target directories + ansible.builtin.file: + path: "{{ item.split('/')[:-1] | join('/') }}" + state: directory + owner: oracle + group: oinstall + mode: "0755" + loop: "{{ weblogic_s3_archives }}" + +- name: Download archives from S3 bucket into /u01/archives + amazon.aws.aws_s3: + bucket: "{{ image_builder_s3_bucket_name }}" + object: "/weblogic-software{{ item }}" + dest: "/u01/archives/{{ item.split('/')[1:] | join('_') }}" + mode: get + overwrite: latest + loop: "{{ weblogic_s3_archives }}" + +- name: Extract archives into target directory + ansible.builtin.unarchive: + owner: oracle + group: oinstall + src: "/u01/archives/{{ item.split('/')[1:] | join('_') }}" + dest: "{{ item.split('/')[:-1] | join('/') }}" + remote_src: true + keep_newer: true + loop: "{{ weblogic_s3_archives }}" + when: not ansible_check_mode + register: weblogic_s3_archive_extract diff --git a/ansible/roles/oasys-bip/tasks/get-facts.yml b/ansible/roles/oasys-bip/tasks/get-facts.yml new file mode 100644 index 000000000..16825111f --- /dev/null +++ b/ansible/roles/oasys-bip/tasks/get-facts.yml @@ -0,0 +1,52 @@ +--- +- name: Set SSM parameters path fact from ec2 ssm-parameters-prefix and Name tag + set_fact: + ssm_parameters_path: '/{{ ssm_parameters_prefix }}/{{ ec2.tags["Name"] }}' + when: ssm_parameters_path is not defined + +- name: Set SSM parameters weblogic path facts + set_fact: + ssm_parameters_path_weblogic_admin_username: "{{ ssm_parameters_path }}/admin_username" + ssm_parameters_path_weblogic_admin_password: "{{ ssm_parameters_path }}/admin_password" + ssm_parameters_path_weblogic_db_username: "{{ ssm_parameters_path }}/db_username" + ssm_parameters_path_weblogic_db_password: "{{ ssm_parameters_path }}/db_password" + +- name: Get SSM parameters + set_fact: + weblogic_admin_username: "{{ lookup('aws_ssm', ssm_parameters_path_weblogic_admin_username, region=ansible_ec2_placement_region) }}" + weblogic_admin_password: "{{ lookup('aws_ssm', ssm_parameters_path_weblogic_admin_password, region=ansible_ec2_placement_region) }}" + weblogic_db_username: "{{ lookup('aws_ssm', ssm_parameters_path_weblogic_db_username, region=ansible_ec2_placement_region) }}" + weblogic_db_password: "{{ lookup('aws_ssm', ssm_parameters_path_weblogic_db_password, region=ansible_ec2_placement_region) }}" + when: weblogic_admin_username is not defined + +- name: Set db hostname from ec2 oracle-db-hostname tag + set_fact: + weblogic_db_hostname_a: "{{ ec2.tags['oracle-db-hostname-a'] }}" + weblogic_db_hostname_b: "{{ ec2.tags['oracle-db-hostname-b'] }}" + +- name: Set db name from ec2 oracle-db-name tag + set_fact: + weblogic_db_name: "{{ ec2.tags['oracle-db-name'] }}" + when: weblogic_db_name is not defined + +- debug: + msg: "Configuring Oracle DB {{ weblogic_db_name }} on {{ weblogic_db_hostname_a }},{{ weblogic_db_hostname_b }} with username {{ weblogic_db_username }}" + +- debug: + msg: "Configuring Admin console {{ weblogic_domain_hostname }} with username {{ weblogic_admin_username }}" + +- name: Check all SSM parameters and tags are set + set_fact: + weblogic_all_variables_set: true + when: + - weblogic_admin_username|length > 0 + - weblogic_admin_password|length > 0 + - weblogic_db_username|length > 0 + - weblogic_db_password|length > 0 + - weblogic_db_hostname_a|length > 0 + - weblogic_db_hostname_b|length > 0 + +- name: Fail if missing SSM parameters or tags + fail: + msg: Ensure all required SSM parameters and tags are set + when: not weblogic_all_variables_set|default(false) diff --git a/ansible/roles/oasys-bip/tasks/install-jdk.yml b/ansible/roles/oasys-bip/tasks/install-jdk.yml new file mode 100644 index 000000000..79317018d --- /dev/null +++ b/ansible/roles/oasys-bip/tasks/install-jdk.yml @@ -0,0 +1,33 @@ +--- +- name: Check installed packages + ansible.builtin.package_facts: + +- block: + - name: Create jdk install directory + ansible.builtin.file: + path: "{{ item }}" + state: directory + owner: oracle + group: oinstall + mode: "0755" + loop: + - /u01/software/jdk + + - name: Get jdk rpm binary from S3 bucket + amazon.aws.aws_s3: + bucket: "{{ image_builder_s3_bucket_name }}" + object: "weblogic-software{{ item }}" + dest: "{{ item }}" + mode: get + overwrite: latest + loop: + - /u01/software/jdk/jdk-7u80-linux-x64.rpm + when: image_builder_s3_bucket_name is defined + + - name: Install jdk rpm binary + yum: + name: /u01/software/jdk/jdk-7u80-linux-x64.rpm + state: present + + # block + when: ansible_facts.packages['jdk'] is not defined diff --git a/ansible/roles/oasys-bip/tasks/install-server.yml b/ansible/roles/oasys-bip/tasks/install-server.yml new file mode 100644 index 000000000..89370d9aa --- /dev/null +++ b/ansible/roles/oasys-bip/tasks/install-server.yml @@ -0,0 +1,64 @@ +--- +- name: Create software directories + ansible.builtin.file: + path: "{{ item }}" + state: directory + owner: oracle + group: oinstall + mode: "0755" + loop: + - /u01/software/weblogic + - /u01/software/tmp + +- name: Check if weblogic server already installed + ansible.builtin.stat: + path: /u01/app/oracle/Middleware/wlserver_10.3 + register: weblogic_server_installed_check + +- name: Install weblogic server software + block: + - name: Get weblogic install jar from S3 bucket + amazon.aws.aws_s3: + bucket: "{{ image_builder_s3_bucket_name }}" + object: "weblogic-software{{ item }}" + dest: "{{ item }}" + mode: get + overwrite: latest + loop: + - /u01/software/weblogic/wls1036_generic.jar + + - name: Copy weblogic install config + ansible.builtin.template: + src: "10.3{{ item }}" + dest: "{{ item }}" + owner: oracle + group: oinstall + loop: + - /u01/software/weblogic/silent.xml + + - name: Install weblogic server which takes a couple of minutes + become_user: oracle + ansible.builtin.shell: | + set -eo pipefail + main() { + echo "# installing weblogic /u01/software/weblogic/wls1036_generic.jar" + java -d64 -Xmx1024m -jar /u01/software/weblogic/wls1036_generic.jar -mode=silent -silent_xml=/u01/software/weblogic/silent.xml -Djava.io.tmpdir=/u01/software/tmp + } + main 2>&1 | logger -p local3.info -t ansible-weblogic + + - name: Remove temporary install files + ansible.builtin.file: + path: "{{ item }}" + state: absent + loop: + - /u01/software/weblogic/wls1036_generic.jar + - /u01/software/weblogic/silent.xml + + # block + when: not weblogic_server_installed_check.stat.exists + +- name: Update bsu.sh MEM_ARGS + ansible.builtin.lineinfile: + path: /u01/app/oracle/Middleware/utils/bsu/bsu.sh + regexp: "^MEM_ARGS=" + line: 'MEM_ARGS="-Xms4096m -Xmx4096m" # ansible managed modernisation-platform-configuration-management' diff --git a/ansible/roles/oasys-bip/tasks/main.yml b/ansible/roles/oasys-bip/tasks/main.yml new file mode 100644 index 000000000..7da24f8b7 --- /dev/null +++ b/ansible/roles/oasys-bip/tasks/main.yml @@ -0,0 +1,118 @@ +--- +- name: Nomis XTAG weblogic setup + block: + - import_tasks: get-facts.yml + tags: + - ec2provision + - ec2patch + - weblogic_get_facts + - weblogic_moj_admin_scripts + - weblogic_certificate_fix + - weblogic_create_managed_app + - weblogic_setup_log_rotate + + - import_tasks: packages.yml + tags: + - amibuild + - ec2provision + - weblogic_packages + + - import_tasks: users.yml + tags: + - amibuild + - ec2provision + - weblogic_users + + - import_tasks: swap.yml + tags: + - amibuild + - ec2provision + - weblogic_swap + + - import_tasks: install-jdk.yml + tags: + - amibuild + - ec2provision + - weblogic_install_jdk + + - import_tasks: oracle-limits-update.yml + tags: + - amibuild + - ec2provision + - oracle-limits-changes + + - import_tasks: install-server.yml + tags: + - amibuild + - ec2provision + - weblogic_install_server + + - import_tasks: patch-weblogic.yml + vars: + weblogic_patch_filename: /u01/app/oracle/Middleware/utils/bsu/cache_dir/p32832785_1036_Generic.zip + weblogic_patch_id: 3NVW + tags: + - amibuild + - ec2provision + - weblogic_patch_1 + + - import_tasks: patch-weblogic.yml + vars: + weblogic_patch_filename: /u01/app/oracle/Middleware/utils/bsu/cache_dir/p13964737_10360210720_Generic.zip + weblogic_patch_id: UEYM + tags: + - amibuild + - ec2provision + - weblogic_patch_2 + + - import_tasks: moj-admin-scripts.yml + tags: + - ec2provision + - weblogic_moj_admin_scripts + + - import_tasks: create-xtag-domain.yml + tags: + - amibuild + - ec2provision + - weblogic_create_domain + + - import_tasks: certificate-fix.yml + tags: + - amibuild + - ec2provision + - weblogic_certificate_fix + + - include_tasks: + file: create-managed-app.yml + apply: + tags: + - amibuild + - ec2provision + - weblogic_create_managed_app + tags: + - amibuild + - ec2provision + - weblogic_create_managed_app + + - import_tasks: service.yml + tags: + - amibuild + - ec2provision + - weblogic_service + + - include_tasks: + file: setup-log-rotate.yml + apply: + tags: + - amibuild + - ec2provision + - weblogic_setup_log_rotate + tags: + - amibuild + - ec2provision + - weblogic_setup_log_rotate + loop_control: + loop_var: weblogic_managed_app_list + loop: "{{ weblogic_servers }}" + + when: ansible_distribution in ['RedHat', 'OracleLinux'] and ansible_distribution_major_version == "7" diff --git a/ansible/roles/oasys-bip/tasks/moj-admin-scripts.yml b/ansible/roles/oasys-bip/tasks/moj-admin-scripts.yml new file mode 100644 index 000000000..c78b2c6f1 --- /dev/null +++ b/ansible/roles/oasys-bip/tasks/moj-admin-scripts.yml @@ -0,0 +1,37 @@ +--- +- name: Create moj admin directory + ansible.builtin.file: + path: "{{ item }}" + state: directory + owner: oracle + group: oinstall + mode: "0755" + loop: + - /home/oracle/admin/scripts/ + +- name: Copy moj admin scripts + ansible.builtin.template: + src: "10.3{{ item }}" + dest: "{{ item }}" + owner: oracle + group: oinstall + mode: "0755" + loop: + - /home/oracle/admin/scripts/wait_for_entry_in_log.sh + - /home/oracle/admin/scripts/create_managed_app.py + - /home/oracle/admin/scripts/set_ms_log_rotation.py + - /home/oracle/admin/scripts/get_param.py + - /home/oracle/admin/scripts/set_param.py + - /home/oracle/admin/scripts/ms_state.py + - /home/oracle/admin/scripts/ms_state.sh + +- name: Copy moj admin files + ansible.builtin.template: + src: "10.3{{ item }}" + dest: "{{ item }}" + owner: oracle + group: oinstall + mode: "0644" + loop: + - /home/oracle/admin/scripts/README.md + - /home/oracle/admin/scripts/weblogic.properties diff --git a/ansible/roles/oasys-bip/tasks/oracle-limits-update.yml b/ansible/roles/oasys-bip/tasks/oracle-limits-update.yml new file mode 100644 index 000000000..10a63eaa4 --- /dev/null +++ b/ansible/roles/oasys-bip/tasks/oracle-limits-update.yml @@ -0,0 +1,16 @@ +--- +- name: Add oracle user limits + community.general.pam_limits: + domain: oracle + limit_type: "{{ item.limit_type }}" + limit_item: "{{ item.limit_item }}" + value: "{{ item.value }}" + loop: + - { limit_type: "soft", limit_item: "memlock", value: 134217728 } + - { limit_type: "soft", limit_item: "nofile", value: 1024 } + - { limit_type: "soft", limit_item: "nproc", value: 16384 } + - { limit_type: "soft", limit_item: "stack", value: 32768 } + - { limit_type: "hard", limit_item: "memlock", value: 134217728 } + - { limit_type: "hard", limit_item: "nofile", value: 65536 } + - { limit_type: "hard", limit_item: "nproc", value: 16384 } + - { limit_type: "hard", limit_item: "stack", value: 10240 } diff --git a/ansible/roles/oasys-bip/tasks/packages.yml b/ansible/roles/oasys-bip/tasks/packages.yml new file mode 100644 index 000000000..29fb1c878 --- /dev/null +++ b/ansible/roles/oasys-bip/tasks/packages.yml @@ -0,0 +1,38 @@ +--- +- name: Install the latest version of required packages + ansible.builtin.package: + name: + - bind-utils + - binutils + - compat-libcap1 + - compat-libstdc++-33 + - compat-libstdc++-33.i686 + - dos2unix + - gcc + - gcc-c++ + - glibc + - glibc-devel + - glibc.i686 + - ksh + - libaio-devel + - libgcc + - libstdc++ + - libstdc++-devel + - libstdc++.i686 + - libXmu + - libXp.i686 + - libXt.i686 + - libXtst.i686 + - make + - nfs-utils + - openssh-clients + - pam + - psmisc + - rng-tools + - smartmontools + - sysstat + - util-linux-ng + - xorg-x11-apps + - xorg-x11-utils + - xorg-x11-xauth + state: latest diff --git a/ansible/roles/oasys-bip/tasks/patch-weblogic.yml b/ansible/roles/oasys-bip/tasks/patch-weblogic.yml new file mode 100644 index 000000000..25721d54a --- /dev/null +++ b/ansible/roles/oasys-bip/tasks/patch-weblogic.yml @@ -0,0 +1,50 @@ +--- +- name: Fail if required weblogic patch variables not defined + fail: + msg: "Error, please ensure weblogic_patch_filename and weblogic_patch_ids are defined" + when: weblogic_patch_filename is not defined or weblogic_patch_id is not defined + +- name: Get current weblogic patch + become_user: oracle + ansible.builtin.shell: | + . ~/.bash_profile > /dev/null + . $WL_HOME/server/bin/setWLSEnv.sh > /dev/null + cd $WL_HOME/../utils/bsu/ + ./bsu.sh -view -status=applied -prod_dir=$WL_HOME | grep "^Patch ID:" | cut -d: -f2 | sed 's/^ *//g' | cut -d\ -f1 | tr "\n" " " + check_mode: false + changed_when: false + register: weblogic_existing_patch + +- name: Set existing weblogic patch code fact + set_fact: + weblogic_existing_patch_code: "{{ weblogic_existing_patch.stdout }}" + +- name: Install weblogic patch + when: not weblogic_existing_patch_code is search(weblogic_patch_id) + block: + - name: Remove previous patch files + ansible.builtin.file: + path: "{{ weblogic_patch_filename.split('/')[:-1] | join('/') }}" + state: absent + + - import_tasks: extract-s3-archive.yml + vars: + weblogic_s3_archives: + - "{{ weblogic_patch_filename }}" + + # takes forever so run in async mode to prevent connection timeouts + - name: Run weblogic patch script which takes approx 20 mins + become_user: oracle + ansible.builtin.shell: | + set -eo pipefail + . ~/.bash_profile + . $WL_HOME/server/bin/setWLSEnv.sh + main() { + patch_dir={{ weblogic_patch_filename.split('/')[:-1] | join('/') }} + echo "Install patch: ./bsu.sh -install -patch_download_dir=$patch_dir -patchlist={{ weblogic_patch_id }} -prod_dir=$WL_HOME -verbose" + cd $WL_HOME/../utils/bsu/ + ./bsu.sh -install -patch_download_dir=$patch_dir -patchlist={{ weblogic_patch_id }} -prod_dir=$WL_HOME -verbose + } + main 2>&1 | logger -p local3.info -t ansible-weblogic + async: 83600 + poll: 60 diff --git a/ansible/roles/oasys-bip/tasks/service.yml b/ansible/roles/oasys-bip/tasks/service.yml new file mode 100644 index 000000000..6d715004b --- /dev/null +++ b/ansible/roles/oasys-bip/tasks/service.yml @@ -0,0 +1,30 @@ +--- +- name: Copy systemd unit file for weblogic + ansible.builtin.template: + src: "10.3/{{ item }}" + dest: "{{ item }}" + loop: + - /etc/systemd/system/wls_nodemanager.service + - /etc/systemd/system/wls_adminserver.service + - /etc/systemd/system/wls_managedserver.service + +- name: Enable weblogic services + ansible.builtin.systemd: + name: "{{ item }}" + daemon_reload: yes + enabled: yes + loop: + - wls_nodemanager + - wls_adminserver + - wls_managedserver + +- name: Start weblogic services + ansible.builtin.systemd: + name: "{{ item }}" + state: "started" + loop: + - wls_nodemanager + - wls_adminserver + - wls_managedserver + async: 3600 + poll: 60 diff --git a/ansible/roles/oasys-bip/tasks/setup-log-rotate.yml b/ansible/roles/oasys-bip/tasks/setup-log-rotate.yml new file mode 100644 index 000000000..980f7002f --- /dev/null +++ b/ansible/roles/oasys-bip/tasks/setup-log-rotate.yml @@ -0,0 +1,43 @@ +--- +- name: Set weblogic managed app facts + 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 + async: 3600 + poll: 60 + +- name: Copy log setup managed app configuration files + ansible.builtin.template: + src: "10.3/{{ item }}" + dest: "{{ item }}" + owner: oracle + group: oinstall + loop: + - /u01/software/weblogic/{{ weblogic_managed_app }}.properties + +- name: Configure log setup + become_user: oracle + ansible.builtin.shell: | + set -eo pipefail + . ~/.bash_profile + . $WL_HOME/server/bin/setWLSEnv.sh + main() { + echo "# configure log setup app {{ weblogic_managed_app }}" + java weblogic.WLST ~/admin/scripts/set_ms_log_rotation.py -p /u01/software/weblogic/{{ weblogic_managed_app }}.properties + } + main 2>&1 | logger -p local3.info -t ansible-weblogic + +- name: Remove temporary install files + ansible.builtin.file: + path: "{{ item }}" + state: absent + loop: + - /u01/software/weblogic/{{ weblogic_managed_app }}.properties diff --git a/ansible/roles/oasys-bip/tasks/swap.yml b/ansible/roles/oasys-bip/tasks/swap.yml new file mode 100644 index 000000000..b07a967e0 --- /dev/null +++ b/ansible/roles/oasys-bip/tasks/swap.yml @@ -0,0 +1,26 @@ +--- +- name: Check swapfile + ansible.builtin.stat: + path: /swapfile + register: swapfile + +- name: Create swapfile + ansible.builtin.shell: | + set -eo pipefail + main() { + echo "# creating swapfile" + fallocate -l 1G /swapfile + dd if=/dev/zero of=/swapfile bs=1024 count=1048576 + chmod 600 /swapfile + mkswap /swapfile + swapon /swapfile + } + main 2>&1 | logger -p local3.info -t ansible-weblogic + when: not swapfile.stat.exists + +- name: Mount swapfile + ansible.posix.mount: + src: /swapfile + path: swap + fstype: swap + state: present diff --git a/ansible/roles/oasys-bip/tasks/users.yml b/ansible/roles/oasys-bip/tasks/users.yml new file mode 100644 index 000000000..781eedccc --- /dev/null +++ b/ansible/roles/oasys-bip/tasks/users.yml @@ -0,0 +1,14 @@ +--- +- name: Check oracle user already exists + ansible.builtin.getent: + database: passwd + key: oracle + +- name: Copy oracle bash profile + ansible.builtin.template: + src: "10.3{{ item }}" + dest: "{{ item }}" + owner: oracle + group: oinstall + loop: + - /home/oracle/.bash_profile diff --git a/ansible/roles/oasys-bip/templates/10.3/etc/logrotate.d/nomis-web b/ansible/roles/oasys-bip/templates/10.3/etc/logrotate.d/nomis-web new file mode 100644 index 000000000..9f1c9cf72 --- /dev/null +++ b/ansible/roles/oasys-bip/templates/10.3/etc/logrotate.d/nomis-web @@ -0,0 +1,10 @@ +/u01/tag/HotPage/logs/HotPage.log +/u01/tag/autologoff/logs/web.log +{ + missingok + copytruncate + maxsize 3G + rotate 4 + weekly + compress +} \ No newline at end of file diff --git a/ansible/roles/oasys-bip/templates/10.3/etc/systemd/system/nodemanager.service b/ansible/roles/oasys-bip/templates/10.3/etc/systemd/system/nodemanager.service new file mode 100644 index 000000000..f80894817 --- /dev/null +++ b/ansible/roles/oasys-bip/templates/10.3/etc/systemd/system/nodemanager.service @@ -0,0 +1,16 @@ +[Unit] +Description=Node Manager controls the WebLogic Server runtime lifecycle +After=network.target + +[Service] +User=weblogic +Group=javainstall +Type=simple +ExecStart=/home/oracle/admin/scripts/control_NodeManager.sh start >/dev/null 2>/dev/null & +ExecStop=/home/oracle/admin/scripts/control_NodeManager.sh stop >/dev/null 2>/dev/null & +PIDFile=/home/oracle/admin/scripts/nodemanager.process.id +Restart=on-failure +RestartSec=1 + +[Install] +WantedBy=default.target diff --git a/ansible/roles/oasys-bip/templates/10.3/etc/systemd/system/wls_adminserver.service b/ansible/roles/oasys-bip/templates/10.3/etc/systemd/system/wls_adminserver.service new file mode 100644 index 000000000..2e27b9392 --- /dev/null +++ b/ansible/roles/oasys-bip/templates/10.3/etc/systemd/system/wls_adminserver.service @@ -0,0 +1,13 @@ +[Unit] +Description=WebLogic Adminserver Service + +[Service] +Type=simple +WorkingDirectory={{ domain_home }} +ExecStart={{ domain_home }}/{{ domain_name }}/bin/startWebLogic.sh +ExecStop={{ domain_home }}/{{ domain_name }}/bin/stopWebLogic.sh +User=oracle +Group=oinstall + +[Install] +WantedBy=multi-user.target diff --git a/ansible/roles/oasys-bip/templates/10.3/etc/systemd/system/wls_managedserver.service b/ansible/roles/oasys-bip/templates/10.3/etc/systemd/system/wls_managedserver.service new file mode 100644 index 000000000..1799603b4 --- /dev/null +++ b/ansible/roles/oasys-bip/templates/10.3/etc/systemd/system/wls_managedserver.service @@ -0,0 +1,13 @@ +[Unit] +Description=WebLogic managed server Service + +[Service] +Type=simple +WorkingDirectory={{ domain_home }} +ExecStart={{ domain_home }}/{{ domain_name }}/bin/startManagedWebLogic.sh {{ managed_server }} +ExecStop={{ domain_home }}/{{ domain_name }}/bin/stopManagedWebLogic.sh {{ managed_server }} +User=oracle +Group=oinstall + +[Install] +WantedBy=multi-user.target diff --git a/ansible/roles/oasys-bip/templates/10.3/etc/systemd/system/wls_nodemanager.service b/ansible/roles/oasys-bip/templates/10.3/etc/systemd/system/wls_nodemanager.service new file mode 100644 index 000000000..23a4c9bb4 --- /dev/null +++ b/ansible/roles/oasys-bip/templates/10.3/etc/systemd/system/wls_nodemanager.service @@ -0,0 +1,13 @@ +[Unit] +Description=WebLogic NodeManager Service + +[Service] +Type=simple +WorkingDirectory={{ domain_home }} +ExecStart={{ wl_home }}/server/bin/startNodeManager.sh +ExecStop=/home/oracle/admin/scripts/stopNodeManager.sh +User=oracle +Group=oinstall + +[Install] +WantedBy=multi-user.target diff --git a/ansible/roles/oasys-bip/templates/10.3/home/oracle/.bash_profile b/ansible/roles/oasys-bip/templates/10.3/home/oracle/.bash_profile new file mode 100644 index 000000000..13c8710fc --- /dev/null +++ b/ansible/roles/oasys-bip/templates/10.3/home/oracle/.bash_profile @@ -0,0 +1,24 @@ +if [ -f ~/.bashrc ]; then + . ~/.bashrc +fi + +# User specific environment and startup programs + +PATH=$PATH:$HOME/.local/bin:$HOME/bin + +export PATH +umask 022 +export EDITOR=vi +export DOMAIN=`basename /u01/app/oracle/Middleware/user_projects/domains/*` +export JAVA_OPTS="-Xms128m -Xmx1024m -XX:MaxPermSize=256m" +export JAVA_HOME=/usr/bin/java +export JAVA_HOME + +export ORACLE_BASE=/u01/app/oracle +export ORACLE_HOME=/u01/app/oracle/Middleware/wlserver_10.3 +export WL_HOME=/u01/app/oracle/Middleware/wlserver_10.3 +export NODEMGR=${WL_HOME}/server/bin +export WEBLOGIC=/u01/app/oracle/Middleware/user_projects/domains/${DOMAIN}/bin +export XTAG_HOME=/u01/tag/xtag +export PATH=/u01/app/oracle/Middleware/wlserver_10.3/common/bin:$PATH +#. $WL_HOME/server/bin/setWLSEnv.sh \ No newline at end of file diff --git a/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/README.md b/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/README.md new file mode 100644 index 000000000..9bbf9e1ad --- /dev/null +++ b/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/README.md @@ -0,0 +1,42 @@ +The python scripts in this directory are designed to be run with wlst. +Credentials should be picked up automatically from boot.properties + +Setting environment + +``` +. $WL_HOME/server/bin/setWLSEnv.sh +. /u01/app/oracle/Middleware/user_projects/domains/NomisDomain/bin/setDomainEnv.sh +``` + +Checking managed server status +``` +wlst.sh ~/admin/scripts/ms_state.py +``` + +Use init.d scripts for starting and stopping each individual component. +This ensures any component output goes to /var/log/messages. + +``` +service weblogic-node-manager start +service weblogic-server start +service WLS_FORMS start +service WLS_REPORTS start +service WLS_HOTPAGE start +service WLS_TAGSAR start +service WLS_AUTOLOGOFF start +service opmn start +``` + +Or use master script to restart everything + +``` +service weblogic-all status +service weblogic-all restart +``` + +And to bring in and out of load balancer + +``` +service weblogic-healthcheck start # to bring in +service weblogic-healthcheck stop # to take out +``` diff --git a/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/create_managed_app.py b/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/create_managed_app.py new file mode 100644 index 000000000..d65a3df9b --- /dev/null +++ b/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/create_managed_app.py @@ -0,0 +1,324 @@ +#!/usr/bin/python +from java.io import FileInputStream +import time +import getopt +import sys +import re +import pdb + +# Get location of the properties file. +properties = '' +try: + opts, args = getopt.getopt(sys.argv[1:], "p:h::", ["properties="]) +except getopt.GetoptError: + print 'create_managed_server.py -p ' + sys.exit(2) +for opt, arg in opts: + if opt == '-h': + print 'create_managed_server.py -p ' + sys.exit() + elif opt in ("-p", "--properties"): + properties = arg +print 'properties=', properties + +# Load the properties from the properties file. + +propInputStream = FileInputStream(properties) +configProps = Properties() +configProps.load(propInputStream) +# domainName = '' + +# Get Variables From Properties Files +# Admin Console +adminUsername = configProps.get("admin.username") +adminPassword = configProps.get("admin.password") +adminURL = configProps.get("admin.url") +adminPort = configProps.get("admin.port") +adminAddress = configProps.get("admin.address") + +# Domain +domainName = configProps.get("domain.name") +wlsPath = configProps.get("path.wls") +domainConfigPath = configProps.get("path.domain.config") +appConfigPath = configProps.get("path.app.config") +machine = configProps.get("machine") + +# Cluster +clusterName = configProps.get("cluster.name") + +# Managed Server +msName = configProps.get("ms.name") +msAddress = configProps.get("ms.address") +msPort = configProps.get("ms.port") +msCluster = configProps.get("ms.cluster") +msStartArg = configProps.get("ms.startarg") + +# Data Source +dsName = configProps.get("ds.name") +dsJNDIName = configProps.get("ds.jndi.name") +dsURL = configProps.get("ds.url") +dsDriver = configProps.get("ds.driver") +dsUsername = configProps.get("ds.username") +dsPassword = configProps.get("ds.password") +dsTargetType = configProps.get("ds.target.type") +dsTargetName = configProps.get("ds.target.name") + +# Deployment +appName = configProps.get("app.name") +path = configProps.get("app.path") +target = configProps.get("app.target") + +# Update formsapp plan deployment +fappName = configProps.get("app.fname") +planpath = configProps.get("app.planpath") + +# JMS Module +jmsModuleName = configProps.get("jms.module.name") +jmsdescriptorFileName = configProps.get("jms.descriptorFile.name") +jmsTarget = configProps.get("jms.target") +jmsFServerName = configProps.get("jms.fserver.name") +jmsFServerContext = configProps.get("jms.fserver.context") +jmsFServerJNDIProperty = configProps.get("jms.fserver.jndiproperty") +jmsFServerDestName = configProps.get("jms.fserver.destination.name") +jmsFServerDestLocJNDIName = configProps.get( + "jms.fserver.destination.local.jndi.name") +jmsFServerDestRemJNDIName = configProps.get( + "jms.fserver.destination.remote.jndi.name") +jmsFServerFactoryName = configProps.get("jms.fserver.factory.name") +jmsFServerFactoryLocJNDIName = configProps.get( + "jms.fserver.factory.local.jndi.name") +jmsFServerFactoryRemJNDIName = configProps.get( + "jms.fserver.factory.remote.jndi.name") +jmsremoteConnectionURL = configProps.get("jms.fserver.remoteconnectionurl") +# Function that waits for a managed server to start before proceeding Wait for Managed Server to start + + +def wait_for_ms_start(): + stopped = True + while stopped: + try: + domainRuntime() + cd('/ServerLifeCycleRuntimes/' + msName) + serverState = cmo.getState() + if serverState == "RUNNING": + print msName + ' is ' + serverState + stopped = False + elif serverState == "STARTING": + print msName + ' is ' + serverState + Thread.sleep(10000) + continue + elif serverState == "FORCE_SHUTTING_DOWN": + print msName + ' is ' + serverState + Thread.sleep(10000) + continue + elif serverState == "SHUTDOWN": + print msName + ' is ' + serverState + print 'Starting ' + msName + cmo.start() + continue + except: + print 'Server :'+msName + ' seems to be down ' + Thread.sleep(10000) + continue + + +print adminPassword +# Connect to the AdminServer. +if domainName: + readTemplate(wlsPath + '/common/templates/domains/wls.jar') + cd('/') + mn = create(machine, 'Machine') + mn.setName(machine) + cd('/Security/base_domain/User/' + adminUsername) + cmo.setPassword(adminPassword) + cd('/Server/AdminServer') + cmo.setName('AdminServer') + cmo.setListenPort(int(adminPort)) + cmo.setListenAddress(adminAddress) + create('AdminServer', 'SSL') + cd('SSL/AdminServer') + set('Enabled', 'false') + setOption('ServerStartMode', 'prod') + writeDomain(domainConfigPath + '/' + domainName) + closeTemplate() + exit() +else: + connect(adminUsername, adminPassword, adminURL) + +# Create Cluster +if clusterName: + edit() + startEdit() + cd('/') + cmo.createCluster(clusterName) + cd('/Clusters/' + clusterName) + cmo.setClusterMessagingMode('unicast') + save() + activate() + +# Create Managed Server +if msName: + edit() + startEdit() + cd('/') + cmo.createServer(msName) + cd('/Servers/' + msName) + cmo.setListenAddress(msAddress) + cmo.setListenPort(int(msPort)) + cd('/Servers/' + msName + '/Log/' + msName) + cmo.setRedirectStderrToServerLogEnabled(true) + cmo.setRedirectStdoutToServerLogEnabled(true) + cmo.setMemoryBufferSeverity('Debug') + cd('/Servers/' + msName) + cmo.setCluster(getMBean('/Clusters/' + msCluster)) + cmo.setMachine(getMBean('/Machines/' + msAddress)) + cd('/Servers/' + msName + '/ServerStart/' + msName) + cmo.setArguments(msStartArg) + save() + activate() + startEdit() + save() + activate() + # Start Managed Server + start(msName, 'Server') + wait_for_ms_start() + +# Create Data Source(s) +if dsName: + # Create List of Data Source(s) + dsUsernames = dsUsername.split(",") + dsPasswords = dsPassword.split(",") + dsName = dsName.split(",") + dsJNDIName = dsJNDIName.split(",") + datasources = zip(dsName, dsJNDIName, dsUsernames, dsPasswords) + for dsName, dsJNDIName, dsUsername, dsPassword in datasources: + edit() + startEdit() + cd('/') + cmo.createJDBCSystemResource(dsName) + cd('/JDBCSystemResources/' + dsName + '/JDBCResource/' + dsName) + cmo.setName(dsName) + cd('/JDBCSystemResources/' + dsName + '/JDBCResource/' + + dsName + '/JDBCDataSourceParams/' + dsName) + set('JNDINames', jarray.array([String(dsJNDIName)], String)) + cd('/JDBCSystemResources/' + dsName + '/JDBCResource/' + + dsName + '/JDBCDriverParams/' + dsName) + cmo.setUrl(dsURL) + cmo.setDriverName(dsDriver) + set('Password', dsPassword) + cd('/JDBCSystemResources/' + dsName + '/JDBCResource/' + + dsName + '/JDBCConnectionPoolParams/' + dsName) + cmo.setTestTableName('SQL SELECT 1 FROM DUAL\r\n\r\n') + cd('/JDBCSystemResources/' + dsName + '/JDBCResource/' + dsName + + '/JDBCDriverParams/' + dsName + '/Properties/' + dsName) + cmo.createProperty('user') + cd('/JDBCSystemResources/' + dsName + '/JDBCResource/' + dsName + + '/JDBCDriverParams/' + dsName + '/Properties/' + dsName + '/Properties/user') + cmo.setValue(dsUsername) + cd('/SystemResources/' + dsName) + set('Targets', jarray.array( + [ObjectName('com.bea:Name='+dsTargetName+',Type=Cluster')], ObjectName)) + cd('/JDBCSystemResources/' + dsName + '/JDBCResource/' + + dsName + '/JDBCConnectionPoolParams/' + dsName) + set('MaxCapacity', '300') + save() + activate() + # Restart Managed Server + cd('/') + domainRuntime() + cd('/ServerLifeCycleRuntimes/'+msName) + cmo.forceShutdown() + wait_for_ms_start() + +# Create JMS Module +if jmsModuleName: + # Create List of JMS modules + jmsModuleName = jmsModuleName.split(";") + jmsdescriptorFileName = jmsdescriptorFileName.split(";") + jmsFServerName = jmsFServerName.split(";") + jmsFServerContext = jmsFServerContext.split(";") + jmsFServerDestName = jmsFServerDestName.split(";") + jmsFServerDestLocJNDIName = jmsFServerDestLocJNDIName.split(";") + jmsFServerDestRemJNDIName = jmsFServerDestRemJNDIName.split(";") + jmsFServerFactoryName = jmsFServerFactoryName.split(";") + jmsFServerFactoryLocJNDIName = jmsFServerFactoryLocJNDIName.split(";") + jmsFServerFactoryRemJNDIName = jmsFServerFactoryRemJNDIName.split(";") + jmsremoteConnectionURL = jmsremoteConnectionURL.split(";") + jmsFServerJNDIProperty = jmsFServerJNDIProperty.split(";") + jmsmodule = zip(jmsModuleName, jmsdescriptorFileName, jmsFServerName, jmsFServerContext, jmsFServerJNDIProperty, jmsFServerDestName, jmsFServerDestLocJNDIName, + jmsFServerDestRemJNDIName, jmsFServerFactoryName, jmsFServerFactoryLocJNDIName, jmsFServerFactoryLocJNDIName, jmsFServerFactoryRemJNDIName, jmsremoteConnectionURL) + for jmsModuleName, jmsdescriptorFileName, jmsFServerName, jmsFServerContext, jmsFServerJNDIProperty, jmsFServerDestName, jmsFServerDestLocJNDIName, jmsFServerDestRemJNDIName, jmsFServerFactoryName, jmsFServerFactoryLocJNDIName, jmsFServerFactoryLocJNDIName, jmsFServerFactoryRemJNDIName, jmsremoteConnectionURL in jmsmodule: + print "creating" + jmsModuleName + edit() + startEdit() + # Create JMS Module + cd('/') + cmo.createJMSSystemResource(jmsModuleName, jmsdescriptorFileName) + cd('/SystemResources/'+jmsModuleName) + set('Targets', jarray.array( + [ObjectName('com.bea:Name='+jmsTarget+',Type=Cluster')], ObjectName)) + save() + # Create Foreign Server + print jmsFServerJNDIProperty + cd('/JMSSystemResources/'+jmsModuleName+'/JMSResource/'+jmsModuleName) + cmo.createForeignServer(jmsFServerName) + cd('/JMSSystemResources/'+jmsModuleName+'/JMSResource/' + + jmsModuleName+'/ForeignServers/'+jmsFServerName) + cmo.setDefaultTargetingEnabled(true) + cmo.setInitialContextFactory(jmsFServerContext) + cmo.setConnectionURL(jmsremoteConnectionURL) + cmo.createJNDIProperty('datasource') + cd('/JMSSystemResources/'+jmsModuleName+'/JMSResource/'+jmsModuleName + + '/ForeignServers/'+jmsFServerName+'/JNDIProperties/'+'datasource') + cmo.setValue(jmsFServerJNDIProperty) + # Create Foreign Destination + jmsFServerDestName = jmsFServerDestName.split(",") + jmsFServerDestLocJNDIName = jmsFServerDestLocJNDIName.split(",") + jmsFServerDestRemJNDIName = jmsFServerDestRemJNDIName.split(",") + jmsFSDest = zip(jmsFServerDestName, + jmsFServerDestLocJNDIName, jmsFServerDestRemJNDIName) + for jmsFServerDestName, jmsFServerDestLocJNDIName, jmsFServerDestRemJNDIName in jmsFSDest: + cd('/JMSSystemResources/'+jmsModuleName+'/JMSResource/' + + jmsModuleName+'/ForeignServers/'+jmsFServerName) + FD = cmo.createForeignDestination(jmsFServerDestName) + cd('ForeignDestinations') + FD.setLocalJNDIName(jmsFServerDestLocJNDIName) + FD.setRemoteJNDIName(jmsFServerDestRemJNDIName) + # Create Foreign Connection Factory + cd('/JMSSystemResources/'+jmsModuleName+'/JMSResource/' + + jmsModuleName+'/ForeignServers/'+jmsFServerName) + cmo.createForeignConnectionFactory(jmsFServerFactoryName) + cd('/JMSSystemResources/'+jmsModuleName+'/JMSResource/'+jmsModuleName + + '/ForeignServers/'+jmsFServerName+'/ForeignConnectionFactories/'+jmsFServerFactoryName) + cmo.setLocalJNDIName(jmsFServerFactoryLocJNDIName) + cmo.setRemoteJNDIName(jmsFServerFactoryRemJNDIName) + # Set timeout seconds for Java Transaction API (JTA) + cd('/JTA/NomisDomain/') + cmo.setTimeoutSeconds(1000) + save() + activate() + +# Create App Deployment +if appName: + edit() + startEdit() + progress = deploy(appName, path, target) + progress.printStatus() + save() + activate() + +# Update application plan +if fappName: + edit() + startEdit() + progress = updateApplication(fappName, planpath) + progress.printStatus() + save() + activate() + +# Start Application +if appName: + startApplication(appName) + +disconnect() +exit() diff --git a/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/get_param.py b/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/get_param.py new file mode 100644 index 000000000..9b9a49700 --- /dev/null +++ b/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/get_param.py @@ -0,0 +1,50 @@ +#!/usr/bin/python +import getopt +import sys +import socket +from java.io import FileInputStream + + +def usage(): + print('get_param.py -d -n ') + + +def conn(): + try: + connect(url=adminURL, adminServerName=adminServerName) + except ConnectionException, e: + print 'Unable to find admin server' + exit() + + +propInputStream = FileInputStream( + "/home/oracle/admin/scripts/weblogic.properties") +configProps = Properties() +configProps.load(propInputStream) +adminURL = configProps.get("domain.adminurl") +adminServerName = configProps.get("domain.adminServerName") +directory = '' +name = '' + +try: + opts, args = getopt.getopt(sys.argv[1:], "d:n:", ["directory=", "name="]) +except getopt.GetoptError: + usage() + sys.exit(2) +for opt, arg in opts: + if opt in ("-d", "--directory"): + directory = arg + elif opt in ("-n", "--name"): + name = arg + +if not name or not directory: + print('missing param, parameter directory and name must be specified') + print('') + usage() + sys.exit(2) + +conn() +cd(directory) +value = get(name) + +print('Value="' + value + '"') diff --git a/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/ms_state.py b/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/ms_state.py new file mode 100644 index 000000000..c313152dc --- /dev/null +++ b/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/ms_state.py @@ -0,0 +1,30 @@ +#!/usr/bin/python +import getopt +import sys +import socket +from java.io import FileInputStream + + +def conn(): + try: + connect(url=adminURL, adminServerName=adminServerName) + except ConnectionException, e: + print 'Unable to find admin server' + exit() + + +propInputStream = FileInputStream( + "/home/oracle/admin/scripts/weblogic.properties") +configProps = Properties() +configProps.load(propInputStream) +adminURL = configProps.get("domain.adminurl") +adminServerName = configProps.get("domain.adminServerName") + +conn() +servers = cmo.getServers() +print "-------------------------------------------------------" +print "\t"+cmo.getName()+" domain status" +print "-------------------------------------------------------" +for server in servers: + state(server.getName(), server.getType()) +print "-------------------------------------------------------" diff --git a/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/ms_state.sh b/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/ms_state.sh new file mode 100755 index 000000000..42a9197fa --- /dev/null +++ b/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/ms_state.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +set -eo pipefail + +main() { + . /u01/app/oracle/Middleware/wlserver_10.3/server/bin/setWLSEnv.sh + . /u01/app/oracle/Middleware/user_projects/domains/NomisDomain/bin/setDomainEnv.sh + timeout 10 /u01/app/oracle/Middleware/wlserver_10.3/common/bin/wlst.sh ~/admin/scripts/ms_state.py +} + +main | grep -vE '^$|^CLASSPATH|^PATH|^Initializing|^Welcome to|^Type help|^Warning: An insecure protocol|^server. To|^Admin port|^Your environment has been set.' diff --git a/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/set_ms_log_rotation.py b/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/set_ms_log_rotation.py new file mode 100644 index 000000000..49a3df0a7 --- /dev/null +++ b/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/set_ms_log_rotation.py @@ -0,0 +1,57 @@ +#!/usr/bin/python + +from java.io import FileInputStream +import time +import getopt +import sys +import re + +# Get location of the properties file. +properties = '' +try: + opts, args = getopt.getopt(sys.argv[1:], "p:h::", ["properies="]) +except getopt.GetoptError: + print 'set_ms_log_rotation.py -p ' + sys.exit(2) +for opt, arg in opts: + if opt == '-h': + print 'set_ms_log_rotation.py -p ' + sys.exit() + elif opt in ("-p", "--properties"): + properties = arg +print 'properties=', properties + +# Load the properties from the properties file. + +propInputStream = FileInputStream(properties) +configProps = Properties() +configProps.load(propInputStream) + +# Set all variables from values in properties file. +adminUsername = configProps.get("admin.username") +adminPassword = configProps.get("admin.password") +adminURL = configProps.get("admin.url") +msName = configProps.get("ms.name") + +# Connect to the AdminServer. +connect(adminUsername, adminPassword, adminURL) + +edit() +startEdit() + +# Manage logging. +cd('/Servers/' + msName + '/Log/' + msName) +cmo.setRotationType('bySize') +cmo.setFileMinSize(50000) +cmo.setNumberOfFilesLimited(true) +cmo.setFileCount(10) +cmo.setRedirectStderrToServerLogEnabled(false) +cmo.setRedirectStdoutToServerLogEnabled(false) +cmo.setMemoryBufferSeverity('Debug') +cmo.setLogFileSeverity('Trace') + +save() +activate() + +disconnect() +exit() diff --git a/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/set_param.py b/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/set_param.py new file mode 100644 index 000000000..89080cbae --- /dev/null +++ b/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/set_param.py @@ -0,0 +1,57 @@ +#!/usr/bin/python +import getopt +import sys +import socket +from java.io import FileInputStream + + +def usage(): + print 'set_param.py -d -n -v ' + + +def conn(): + try: + connect(url=adminURL, adminServerName=adminServerName) + except ConnectionException, e: + print 'Unable to find admin server' + exit() + + +propInputStream = FileInputStream( + "/home/oracle/admin/scripts/weblogic.properties") +configProps = Properties() +configProps.load(propInputStream) +adminURL = configProps.get("domain.adminurl") +adminServerName = configProps.get("domain.adminServerName") +directory = '' +name = '' +value = '' + +try: + opts, args = getopt.getopt(sys.argv[1:], "d:n:v:", [ + "directory=", "name=", "value="]) +except getopt.GetoptError: + usage() + sys.exit(2) +for opt, arg in opts: + if opt in ("-d", "--directory"): + directory = arg + elif opt in ("-n", "--name"): + name = arg + elif opt in ("-v", "--value"): + value = arg + +if not name or not value or not directory: + print('missing param, parameter directory, name and value must all be specified') + print('') + usage() + sys.exit(2) + +conn() +edit() +startEdit() +cd('/') +cd(directory) +set(name, value) +save() +activate() diff --git a/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/stopNodeManager.sh b/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/stopNodeManager.sh new file mode 100644 index 000000000..7cc8fb76a --- /dev/null +++ b/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/stopNodeManager.sh @@ -0,0 +1,8 @@ +#!/bin/bash +set -x +# Get details of nodemanager processes + +process_pids1=$(pgrep -u oracle -f "startNodeManager.sh$" 2> /dev/null) +process_pids2=$(pgrep -u oracle -f "weblogic.NodeManager" 2> /dev/null) + +kill -9 $process_pids1 $process_pids2 2> /dev/null diff --git a/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/wait_for_entry_in_log.sh b/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/wait_for_entry_in_log.sh new file mode 100755 index 000000000..008a989c3 --- /dev/null +++ b/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/wait_for_entry_in_log.sh @@ -0,0 +1,22 @@ +#!/bin/bash +logfile=$1 +match_pattern=$2 +filter_pattern=$3 +if [[ -z $match_pattern ]]; then + echo "Usage $0 []" >&2 + exit 1 +fi +if [[ ! -e "$logfile" ]]; then + echo "$logfile not found" >&2 + exit 1 +fi +# wait until a matching line found in the log file +# only way I could get this to work was to spawn tail in a subshell +if [[ -z $filter_pattern ]]; then + ( tail -f -n0 "$logfile" & ) | grep -qE "${match_pattern}" +else + ( tail -f -n0 "$logfile" & ) | grep -qE "${filter_pattern}(.*)${match_pattern}" +fi +# kill the tail subshell. It's not so easy to find the pid +pid=$(ps -o pid= -o cmd --forest -g $(ps -o sid= -p $$) | grep -F "tail -f -n0 $logfile" | grep -v grep | cut -d\ -f1) +[[ -n $pid ]] && kill $pid 2> /dev/null diff --git a/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/weblogic.properties b/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/weblogic.properties new file mode 100644 index 000000000..0beca34a8 --- /dev/null +++ b/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/weblogic.properties @@ -0,0 +1,2 @@ +domain.adminServerName=AdminServer +domain.adminurl={{ weblogic_domain_hostname }}:7001 diff --git a/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/weblogicControl.py b/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/weblogicControl.py new file mode 100644 index 000000000..42b77f48b --- /dev/null +++ b/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/weblogicControl.py @@ -0,0 +1,130 @@ +# --------------------------------------------------------- +# Check the status of all WL instances including the admin +# --------------------------------------------------------- +import sys +from java.io import FileInputStream + +propInputStream = FileInputStream( + "/home/oracle/admin/scripts/weblogic.properties") +configProps = Properties() +configProps.load(propInputStream) +domainName = configProps.get("domain.name") +domainHome = configProps.get("domain.home") +wlConfigFile = configProps.get("domain.configfile") +wlKeyFile = configProps.get("domain.keyfile") +nmConfigFile = configProps.get("nm.configfile") +nmKeyFile = configProps.get("nm.keyfile") +nmHome = configProps.get("nm.home") +nmPort = configProps.get("nm.port") +nmMachines = configProps.get("nm.host") +adminUrl = configProps.get("domain.adminurl") +adminServerName = configProps.get("domain.adminServerName") + + +def conn(): + try: + connect(userConfigFile=wlConfigFile, + userKeyFile=wlKeyFile, url=adminUrl) + except ConnectionException, e: + print 'Unable to find admin server' + exit() + + +def ServerState(server): + if server != 'wls': + nmConnect(userConfigFile=nmConfigFile, userKeyFile=nmKeyFile, port=nmPort, + host=nmMachines, domainName=domainName, domainDir=domainHome, nmType='Plain') + nmServerStatus(server) + exit() + else: + conn() + serverNames = cmo.getServers() + domainRuntime() + print 'Fetching state of every WebLogic instance' + print '' + for name in serverNames: + cd("/ServerLifeCycleRuntimes/" + name.getName()) + serverState = cmo.getState() + print '%-20s' % (name.getName()) + serverState + disconnect() + exit() + + +def nmConn(machine): + try: + nmConnect(userConfigFile=nmConfigFile, userKeyFile=nmKeyFile, port=nmPort, + host=nmMachines, domainName=domainName, domainDir=domainHome, nmType='Plain') + status = "SUCCESS" + except ConnectionException, e: + status = "FAILED" + print 'Nodemanager Connection: ' + status + + +def nmStartNM(machine): + try: + nmConnect(userConfigFile=nmConfigFile, userKeyFile=nmKeyFile, port=nmPort, + host=nmMachines, domainName=domainName, domainDir=domainHome, nmType='Plain') + print 'Nodemanager already running' + + except: + print 'start nodemaneger except' + startNodeManager(verbose='false', NodeManagerHome=nmHome, + ListenPort=nmPort, ListenAddress=nmMachines) + + +def nmStop(): + try: + nmConnect(userConfigFile=nmConfigFile, userKeyFile=nmKeyFile, port=nmPort, + host=nmMachines, domainName=domainName, domainDir=domainHome, nmType='Plain') + stopNodeManager() + print 'Stopped nodemanager' + except: + print 'Reached exception for nmstop' + + +def nmStartAS(): + try: + nmStart(adminServerName) + except: + print 'Issues starting admin server' + + +if __name__ == "main": + action = sys.argv[1] + module = sys.argv[2] + if action == 'status': + if module == 'nm': + nmConn(nmMachines) + exit() + elif module == 'wls': + ServerState(module) + elif module == 'as': + ServerState(adminServerName) + elif action == 'stop': + if module == 'as': + conn() + shutdown(adminServerName, 'Server', 'true', 0, block='true') + disconnect() + exit() + elif module == 'ms': + msname = sys.argv[3] + nmConn(nmMachines) + nmKill(msname) + exit() + elif module == 'nm': + nmStop() + exit() + elif action == 'start': + if module == 'ms': + msname = sys.argv[3] + nmConn(nmMachines) + nmStart(msname) + exit() + elif module == 'nm': + print nmMachines + nmStartNM(nmMachines) + exit() + elif module == 'as': + nmConn(nmMachines) + nmStartAS() + exit() diff --git a/ansible/roles/oasys-bip/templates/10.3/u01/app/oracle/Middleware/user_projects/domains/NomisDomain/servers/AdminServer/security/boot.properties b/ansible/roles/oasys-bip/templates/10.3/u01/app/oracle/Middleware/user_projects/domains/NomisDomain/servers/AdminServer/security/boot.properties new file mode 100644 index 000000000..9d172dfc2 --- /dev/null +++ b/ansible/roles/oasys-bip/templates/10.3/u01/app/oracle/Middleware/user_projects/domains/NomisDomain/servers/AdminServer/security/boot.properties @@ -0,0 +1,3 @@ +# these credentials are encrypted once the weblogic server is started +username={{ weblogic_admin_username }} +password={{ weblogic_admin_password }} diff --git a/ansible/roles/oasys-bip/templates/10.3/u01/software/weblogic/AdminServer.properties b/ansible/roles/oasys-bip/templates/10.3/u01/software/weblogic/AdminServer.properties new file mode 100644 index 000000000..9976e6d1f --- /dev/null +++ b/ansible/roles/oasys-bip/templates/10.3/u01/software/weblogic/AdminServer.properties @@ -0,0 +1,7 @@ +# AdminServer connection details. +admin.username={{ weblogic_admin_username }} +admin.password={{ weblogic_admin_password }} +admin.url={{ weblogic_domain_hostname }}:7001 + +# Managed Server +ms.name=AdminServer \ No newline at end of file diff --git a/ansible/roles/oasys-bip/templates/10.3/u01/software/weblogic/WLS_XTAG_OUTBOUND_01.properties b/ansible/roles/oasys-bip/templates/10.3/u01/software/weblogic/WLS_XTAG_OUTBOUND_01.properties new file mode 100644 index 000000000..1cd4a7e88 --- /dev/null +++ b/ansible/roles/oasys-bip/templates/10.3/u01/software/weblogic/WLS_XTAG_OUTBOUND_01.properties @@ -0,0 +1,46 @@ +# AdminServer Connection + +admin.username={{ weblogic_admin_username }} +admin.password={{ weblogic_admin_password }} +admin.url={{ weblogic_domain_hostname }}:7001 + +# Cluster +cluster.name=cluster_xtag_outbound + +# Managed Server +ms.name=WLS_XTAG_OUTBOUND_01 +ms.address={{ weblogic_domain_hostname }} +ms.port=9001 +ms.cluster=cluster_xtag_outbound +ms.startarg=-Xms1024m -Xmx1024m -XX:MaxPermSize=512m + +# Database Config (Used for Data Sources) +ds.username={{ weblogic_db_username }} +ds.password={{ weblogic_db_password }} +ds.url=jdbc:oracle:thin:@(DESCRIPTION = (ADDRESS = (HOST = {{ weblogic_db_hostname_a }}) (protocol = tcp) (port = 1521))(ADDRESS = (HOST = {{ weblogic_db_hostname_b }}) (protocol = tcp) (port = 1521))(FAILOVER = YES)(CONNECT_DATA = (SERVICE_NAME = NOMIS_TAF)(FAILOVER_MODE = (TYPE = SELECT)(METHOD = BASIC)))) +ds.driver=oracle.jdbc.xa.client.OracleXADataSource + +# Data Sources (To configure additional DS resources, separate variables with comma e.g. ds.name=ds_1,ds_2) +ds.name=xTAGDS +ds.jndi.name=jdbc/xTAGDS +ds.target.name=cluster_xtag_outbound + +# Deployment +app.name=xtagoutbound +app.path=/u01/tag/xtag/deploy/xtagoutbound.ear +app.target=cluster_xtag_outbound + +# JMS Module +jms.module.name=xTAG_AQModule;xTAG_TIBCOModule +jms.descriptorFile.name=jms/xTAG_AQModule-jms.xml;jms/xTAG_TIBCOModule-jms.xml +jms.target=cluster_xtag_outbound +jms.fserver.name=xTAG_AQForeignServer;xTAG_TIBCOForeignServer +jms.fserver.context=oracle.jms.AQjmsInitialContextFactory;com.tibco.tibjms.naming.TibjmsInitialContextFactory +jms.fserver.jndiproperty=jdbc/xTAGDS; +jms.fserver.remoteconnectionurl=;tibjmsnaming://{{ ndh_ems_server }}:7222 +jms.fserver.destination.name=XTAG_OUT,XTAG_STALE,XTAG_UPD_OFFENDERS;NDH.NomisEvent,NDH.Reply,NDH.Request +jms.fserver.destination.local.jndi.name=jms/aq/XTAG_OUT,jms/aq/XTAG_STALE,jms/aq/NOMIS.OffUpdates;jms/tibco/NDH.NomisEvent,jms/tibco/NDH.Reply,jms/tibco/NDH.Request +jms.fserver.destination.remote.jndi.name=Queues/XTAG_OUT,Queues/XTAG_STALE,Queues/XTAG_UPD_OFFENDERS;NDH.NomisOutbound.Events,NDH.OffenderDetails.Reply,NDH.OffenderDetails.Request +jms.fserver.factory.name=xTAG_AQConnectionFactory;xTAG_TIBCOConnectionFactory +jms.fserver.factory.local.jndi.name=jms/aq/xTAG_AQConnectionFactory;jms/tibco/xTAG_TIBCOConnectionFactory +jms.fserver.factory.remote.jndi.name=XAQueueConnectionFactory;FTQueueConnectionFactory diff --git a/ansible/roles/oasys-bip/templates/10.3/u01/software/weblogic/domain.properties b/ansible/roles/oasys-bip/templates/10.3/u01/software/weblogic/domain.properties new file mode 100644 index 000000000..45d64e651 --- /dev/null +++ b/ansible/roles/oasys-bip/templates/10.3/u01/software/weblogic/domain.properties @@ -0,0 +1,15 @@ +# Paths +path.middleware={{ middleware_home }} +path.wls={{ wl_home }} +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.address={{ weblogic_domain_hostname }} + +# Domain details +domain.name={{ domain_name }} +machine={{ weblogic_domain_hostname }} diff --git a/ansible/roles/oasys-bip/templates/10.3/u01/software/weblogic/silent.xml b/ansible/roles/oasys-bip/templates/10.3/u01/software/weblogic/silent.xml new file mode 100755 index 000000000..b9fba3e8b --- /dev/null +++ b/ansible/roles/oasys-bip/templates/10.3/u01/software/weblogic/silent.xml @@ -0,0 +1,10 @@ + + + + + + + + + diff --git a/ansible/roles/oasys-bip/templates/bip_install.rsp.j2 b/ansible/roles/oasys-bip/templates/bip_install.rsp.j2 new file mode 100644 index 000000000..88956fb43 --- /dev/null +++ b/ansible/roles/oasys-bip/templates/bip_install.rsp.j2 @@ -0,0 +1,159 @@ +[ENGINE] + +#DO NOT CHANGE THIS. +Response File Version=1.0.0.0.0 + +[GENERIC] + +#Set this to true if you wish to specify a directory where latest updates are downloaded. This option would use the software updates from the specified directory +SPECIFY_DOWNLOAD_LOCATION=false + +#Set this to true to skip the Software updates +SKIP_SOFTWARE_UPDATES=true + +#If the Software updates are already downloaded and available on your local system, then specify the path to the directory where these patches are available and set SPECIFY_DOWNLOAD_LOCATION to true +SOFTWARE_UPDATES_DOWNLOAD_LOCATION= + +#Install Software and Configure Components for Express Install. Installs and Configures components with default settings. Installs the light-weight WebLogic Server and creates a new domain. +INSTALL_FOR_DEVELOPMENT_TYPE=false + +#Install and Configure Software Components and Applications. Installs binaries in an ORACLE_HOME and configures working instances in an INSTANCE_HOME. +INSTALL_AND_CONFIGURE_TYPE=true + +#Install Software Components and Applications. Installs binaries in an ORACLE_HOME, but do not configure working instances of installed components. +INSTALL_AND_CONFIGURE_LATER_TYPE=false + +#Internal flag to enable cloud install +ISCLOUD=false + +#Set this to true if you want to create a new BI System, all other required variables need to be provided. If this is set to true then variables "SCALEOUT_BISYSTEM" and "EXTEND_BISYSTEM" must be set to false, since the variables are mutually exclusive. +CREATE_BISYSTEM=true + +#Set this to true if you want to scale out an existing BI System, all other required variables need to be provided. If this is set to true then variables "CREATE_BISYSTEM","EXTEND_BISYSTEM" and "UPDATE_BIDOMAIN" must be set to false, since the variables are mutually exclusive. In order to scale out an existing BI system, the domain in the system must be running +SCALEOUT_BISYSTEM=false + +#Set this to true if you want to configure BI System in an existing exmpty domain in the localhost, all other required variables need to be provided. If this is set to true then variables "CREATE_BISYSTEM","SCALEOUT_BISYSTEM" and "UPDATE_BIDOMAIN" must be set to false, since the variables are mutually exclusive. +EXTEND_BISYSTEM=false + +#Set this to true if you want to update an existing BI System running on the localhost, all other required variables need to be provided. If this is set to true then variables "CREATE_BISYSTEM","EXTEND_BISYSTEM" and "SCALEOUT_BISYSTEM" must be set to false, since the variables are mutually exclusive. +UPDATE_BIDOMAIN=false + +#Write the name of the domain you want to create. Domain name may only contain alphanumeric characters, or the underscore (_) or hyphen (-) characters. +DOMAIN_NAME=bifoundation_domain + +#Write the name of the cell you want to create. Cell name may only contain alphanumeric characters, or the underscore (_) or hyphen (-) characters. +CELL_NAME=unknown + +#Write the name of the host to which you want to connect. It should have an already existing domain configured. +DOMAIN_HOSTNAME=T1ODL0007 + +#Give the port number at which the host should be connected. +DOMAIN_PORT=1521 + +#Give an administrator user name for the domain if you are creating a new one otherwise give the administrator user name for the domain configured at the host. +ADMIN_USER_NAME=weblogic + +#Give an administrator password for the domain if you are creating a new one otherwise give the administrator password for the domain configured at the host. +ADMIN_PASSWORD=webl0g1c + +#Write the administrator password again to confirm. +ADMIN_CONFIRM_PASSWORD=webl0g1c + +#Is Single Server Install. +WLS_SINGLE_SERVER_INSTALL=false + +#Write the complete path to a valid Middleware Home. +MW_HOME=/u01/app/oracle/Middleware + +#Give the complete path to a valid WebLogic Server Home. +WEBLOGIC_HOME=/u01/app/oracle/Middleware/wlserver_10.3 + +#Give the name of the Oracle Home directory. The Oracle Home directory name may only contain alphanumeric , hyphen (-) , dot (.) and underscore (_) characters, and it must begin with an alphanumeric character. +ORACLE_HOME=/u01/app/oracle/Middleware/Oracle_BI1 + +#Give the complete path for an Oracle Instance directory to be created. This is the location where the software configuration files and runtime processes will reside. +INSTANCE_HOME=/u01/app/oracle/Middleware/instances/instance1 + +#Give a name for Oracle Instance corresponding to the Instance Home. The Oracle Instance name may only contain alphanumeric and underscore (_) characters, it must begin with an alphabetic (a-z or A-Z) character, and must be from 4 to 30 characters in length. +INSTANCE_NAME=bipinfra + +#Give the complete path for a domain home to be created. +DOMAIN_HOME_PATH=/u01/app/oracle/Middleware/user_projects/domains/bifoundation_domain + +#Format: hostname:port:servicename. For Application Cluster Database: host1:port1^host2:port2@servicename +DATABASE_CONNECTION_STRING_BI=T1ODL0007:1521:bipinfra + +#Enter the BIPLATFORM schema username. +DATABASE_SCHEMA_USER_NAME_BI=OAS_BIPLATFORM + +#Enter the BIPLATFORM schema password. +DATABASE_SCHEMA_PASSWORD_BI=Manager1 + +#Select the database type in which the BIPLATFORM schema exists. Supported database types are Oracle Database, Microsoft SQL Server, IBM DB2. +DATABASE_TYPE_BI=Oracle Database + +#Format: hostname:port:servicename. For Application Cluster Database: host1:port1^host2:port2@servicename +DATABASE_CONNECTION_STRING_MDS=T1ODL0007:1521:bipinfra + +#Enter the MDS schema username. +DATABASE_SCHEMA_USER_NAME_MDS=OAS_MDS + +#Enter the MDS schema password. +DATABASE_SCHEMA_PASSWORD_MDS=Manager1 + +#Select the database type in which the MDS schema exists. Supported database types are Oracle Database, Microsoft SQL Server, IBM DB2. +DATABASE_TYPE_MDS=Oracle Database + +# +AUTOMATIC_PORT_DETECT=true + +# +STATICPORT INI FILE LOCATION= + +#Provide the My Oracle Support Username. If you wish to ignore Oracle Configuration Manager configuration provide empty string for user name. +MYORACLESUPPORT_USERNAME= + +#Provide the My Oracle Support Password +MYORACLESUPPORT_PASSWORD= + +#Set this to true if you wish to decline the security updates. Setting this to true and providing empty string for My Oracle Support username will ignore the Oracle Configuration Manager configuration +DECLINE_SECURITY_UPDATES=true + +#Set this to true if My Oracle Support Password is specified +SECURITY_UPDATES_VIA_MYORACLESUPPORT=false + +#Provide the Proxy Host +PROXY_HOST= + +#Provide the Proxy Port +PROXY_PORT= + +#Provide the Proxy Username +PROXY_USER= + +#Provide the Proxy Password +PROXY_PWD= + +#Type String (URL format) Indicates the OCM Repeater URL which should be of the format [scheme[Http/Https]]://[repeater host]:[repeater port] +COLLECTOR_SUPPORTHUB_URL= + + +[SYSTEM] + + +[APPLICATIONS] + +#Set to true to configure Oracle Business Intelligence Enterprise Edition. Otherwise set to false. +CONFIGURE_BI=false + +#Set to true to configure Oracle Business Intelligence Publishing and Reporting. Otherwise set to false. +CONFIGURE_BIP=true + +#Set to true to configure Oracle Real-Time Decisions. Otherwise set to false. +CONFIGURE_RTD=false + +#Set to true to select all Oracle Essbase Components. Otherwise set to false. +CONFIGURE_ESSBASE_SUITE=false + + +[RELATIONSHIPS] \ No newline at end of file diff --git a/ansible/roles/oasys-bip/templates/bip_password.tmp.j2 b/ansible/roles/oasys-bip/templates/bip_password.tmp.j2 new file mode 100644 index 000000000..e970c7c6a --- /dev/null +++ b/ansible/roles/oasys-bip/templates/bip_password.tmp.j2 @@ -0,0 +1,3 @@ +{{ syspassword }} +{{ biplatformpassword }} +{{ mdspassword }} \ No newline at end of file diff --git a/ansible/roles/oasys-bip/templates/oraInst.loc.j2 b/ansible/roles/oasys-bip/templates/oraInst.loc.j2 new file mode 100644 index 000000000..0705bb545 --- /dev/null +++ b/ansible/roles/oasys-bip/templates/oraInst.loc.j2 @@ -0,0 +1,2 @@ +inventory_loc=/u01/app/oraInventory +inst_group=oinstall \ No newline at end of file From f98909452b462a6a0d071d41fbe7c359a7979747 Mon Sep 17 00:00:00 2001 From: sandhya Gandalwar Date: Mon, 14 Aug 2023 17:24:56 +0100 Subject: [PATCH 02/19] OASYS BIP install -first step - weblogic install and patch --- ansible/roles/oasys-bip/meta/main.yml | 6 +-- .../oasys-bip/tasks/extract-s3-archive.yml | 2 +- ansible/roles/oasys-bip/tasks/install-jdk.yml | 2 +- .../roles/oasys-bip/tasks/install-server.yml | 3 +- ansible/roles/oasys-bip/tasks/main.yml | 50 ------------------- ansible/roles/oasys-bip/tasks/packages.yml | 4 +- .../oasys-bip/tasks/setup-log-rotate.yml | 43 ---------------- 7 files changed, 9 insertions(+), 101 deletions(-) delete mode 100644 ansible/roles/oasys-bip/tasks/setup-log-rotate.yml diff --git a/ansible/roles/oasys-bip/meta/main.yml b/ansible/roles/oasys-bip/meta/main.yml index eda808260..abf94477c 100644 --- a/ansible/roles/oasys-bip/meta/main.yml +++ b/ansible/roles/oasys-bip/meta/main.yml @@ -1,6 +1,6 @@ --- dependencies: - role: get-ec2-facts - - role: ansible-requirements - - role: disable-ipv6 - - role: disable-firewall + # - role: ansible-requirements + # - role: disable-ipv6 + # - role: disable-firewall diff --git a/ansible/roles/oasys-bip/tasks/extract-s3-archive.yml b/ansible/roles/oasys-bip/tasks/extract-s3-archive.yml index f9bdf761e..ea6e1d3f1 100644 --- a/ansible/roles/oasys-bip/tasks/extract-s3-archive.yml +++ b/ansible/roles/oasys-bip/tasks/extract-s3-archive.yml @@ -26,7 +26,7 @@ - name: Download archives from S3 bucket into /u01/archives amazon.aws.aws_s3: bucket: "{{ image_builder_s3_bucket_name }}" - object: "/weblogic-software{{ item }}" + object: "oasys-bip{{ item }}" dest: "/u01/archives/{{ item.split('/')[1:] | join('_') }}" mode: get overwrite: latest diff --git a/ansible/roles/oasys-bip/tasks/install-jdk.yml b/ansible/roles/oasys-bip/tasks/install-jdk.yml index 79317018d..5e6639b6b 100644 --- a/ansible/roles/oasys-bip/tasks/install-jdk.yml +++ b/ansible/roles/oasys-bip/tasks/install-jdk.yml @@ -16,7 +16,7 @@ - name: Get jdk rpm binary from S3 bucket amazon.aws.aws_s3: bucket: "{{ image_builder_s3_bucket_name }}" - object: "weblogic-software{{ item }}" + object: "oasys-bip{{ item }}" dest: "{{ item }}" mode: get overwrite: latest diff --git a/ansible/roles/oasys-bip/tasks/install-server.yml b/ansible/roles/oasys-bip/tasks/install-server.yml index 89370d9aa..f6e62d525 100644 --- a/ansible/roles/oasys-bip/tasks/install-server.yml +++ b/ansible/roles/oasys-bip/tasks/install-server.yml @@ -9,6 +9,7 @@ loop: - /u01/software/weblogic - /u01/software/tmp + - /u01/app - name: Check if weblogic server already installed ansible.builtin.stat: @@ -20,7 +21,7 @@ - name: Get weblogic install jar from S3 bucket amazon.aws.aws_s3: bucket: "{{ image_builder_s3_bucket_name }}" - object: "weblogic-software{{ item }}" + object: "oasys-bip{{ item }}" dest: "{{ item }}" mode: get overwrite: latest diff --git a/ansible/roles/oasys-bip/tasks/main.yml b/ansible/roles/oasys-bip/tasks/main.yml index 7da24f8b7..4fea7ab0d 100644 --- a/ansible/roles/oasys-bip/tasks/main.yml +++ b/ansible/roles/oasys-bip/tasks/main.yml @@ -65,54 +65,4 @@ - ec2provision - weblogic_patch_2 - - import_tasks: moj-admin-scripts.yml - tags: - - ec2provision - - weblogic_moj_admin_scripts - - - import_tasks: create-xtag-domain.yml - tags: - - amibuild - - ec2provision - - weblogic_create_domain - - - import_tasks: certificate-fix.yml - tags: - - amibuild - - ec2provision - - weblogic_certificate_fix - - - include_tasks: - file: create-managed-app.yml - apply: - tags: - - amibuild - - ec2provision - - weblogic_create_managed_app - tags: - - amibuild - - ec2provision - - weblogic_create_managed_app - - - import_tasks: service.yml - tags: - - amibuild - - ec2provision - - weblogic_service - - - include_tasks: - file: setup-log-rotate.yml - apply: - tags: - - amibuild - - ec2provision - - weblogic_setup_log_rotate - tags: - - amibuild - - ec2provision - - weblogic_setup_log_rotate - loop_control: - loop_var: weblogic_managed_app_list - loop: "{{ weblogic_servers }}" - when: ansible_distribution in ['RedHat', 'OracleLinux'] and ansible_distribution_major_version == "7" diff --git a/ansible/roles/oasys-bip/tasks/packages.yml b/ansible/roles/oasys-bip/tasks/packages.yml index 29fb1c878..694e4f12c 100644 --- a/ansible/roles/oasys-bip/tasks/packages.yml +++ b/ansible/roles/oasys-bip/tasks/packages.yml @@ -5,8 +5,8 @@ - bind-utils - binutils - compat-libcap1 - - compat-libstdc++-33 - - compat-libstdc++-33.i686 + # - compat-libstdc++-33 + # - compat-libstdc++-33.i686 - dos2unix - gcc - gcc-c++ diff --git a/ansible/roles/oasys-bip/tasks/setup-log-rotate.yml b/ansible/roles/oasys-bip/tasks/setup-log-rotate.yml deleted file mode 100644 index 980f7002f..000000000 --- a/ansible/roles/oasys-bip/tasks/setup-log-rotate.yml +++ /dev/null @@ -1,43 +0,0 @@ ---- -- name: Set weblogic managed app facts - 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 - async: 3600 - poll: 60 - -- name: Copy log setup managed app configuration files - ansible.builtin.template: - src: "10.3/{{ item }}" - dest: "{{ item }}" - owner: oracle - group: oinstall - loop: - - /u01/software/weblogic/{{ weblogic_managed_app }}.properties - -- name: Configure log setup - become_user: oracle - ansible.builtin.shell: | - set -eo pipefail - . ~/.bash_profile - . $WL_HOME/server/bin/setWLSEnv.sh - main() { - echo "# configure log setup app {{ weblogic_managed_app }}" - java weblogic.WLST ~/admin/scripts/set_ms_log_rotation.py -p /u01/software/weblogic/{{ weblogic_managed_app }}.properties - } - main 2>&1 | logger -p local3.info -t ansible-weblogic - -- name: Remove temporary install files - ansible.builtin.file: - path: "{{ item }}" - state: absent - loop: - - /u01/software/weblogic/{{ weblogic_managed_app }}.properties From e625ffc8693c4200a3308a1624284b8bd9d9be09 Mon Sep 17 00:00:00 2001 From: sandhya Gandalwar Date: Wed, 16 Aug 2023 11:26:28 +0100 Subject: [PATCH 03/19] Updated RCU creation --- .../roles/oasys-bip/tasks/bip_db_setup.yml | 37 +++++++++++ ansible/roles/oasys-bip/tasks/rcu.yml | 65 +++++++++++++++++++ .../oasys-bip/templates/create_bip_db.sh.j2 | 30 +++++++++ 3 files changed, 132 insertions(+) create mode 100644 ansible/roles/oasys-bip/tasks/bip_db_setup.yml create mode 100644 ansible/roles/oasys-bip/tasks/rcu.yml create mode 100644 ansible/roles/oasys-bip/templates/create_bip_db.sh.j2 diff --git a/ansible/roles/oasys-bip/tasks/bip_db_setup.yml b/ansible/roles/oasys-bip/tasks/bip_db_setup.yml new file mode 100644 index 000000000..44d9af58c --- /dev/null +++ b/ansible/roles/oasys-bip/tasks/bip_db_setup.yml @@ -0,0 +1,37 @@ +--- +- name: Copy recovery catalog creation scripts + template: + src: "{{ item }}.j2" + dest: "{{ stage }}/{{ item }}" + owner: oracle + group: oinstall + mode: "0700" + loop: + - create_recovery_catalog_db.sh + - create_recovery_catalog_user.sh + +- name: Create recovery catalog database + become_user: oracle + ansible.builtin.shell: | + set -eo pipefail + main() { + echo "# create_recovery_catalog_db.sh " + {{ stage }}/create_recovery_catalog_db.sh {{ rcvcat_db_name.rcvcat_db_name }} {{ db_sys_password }} {{ db_system_password }} + } + main 2>&1 | logger -p local3.info -t ansible-oracle-db + async: 86400 + poll: 60 + when: not ansible_check_mode + +- name: Create recovery catalog database user and rman catalog + become_user: oracle + ansible.builtin.shell: | + set -eo pipefail + main() { + echo "# create_recovery_catalog_user.sh" + {{ stage }}/create_recovery_catalog_user.sh {{ rcvcat_db_name.rcvcat_db_name }} {{ db_rcatowner_password }} {{ stage }} + } + main 2>&1 | logger -p local3.info -t ansible-oracle-db + async: 86400 + poll: 60 + when: not ansible_check_mode diff --git a/ansible/roles/oasys-bip/tasks/rcu.yml b/ansible/roles/oasys-bip/tasks/rcu.yml new file mode 100644 index 000000000..f6e62d525 --- /dev/null +++ b/ansible/roles/oasys-bip/tasks/rcu.yml @@ -0,0 +1,65 @@ +--- +- name: Create software directories + ansible.builtin.file: + path: "{{ item }}" + state: directory + owner: oracle + group: oinstall + mode: "0755" + loop: + - /u01/software/weblogic + - /u01/software/tmp + - /u01/app + +- name: Check if weblogic server already installed + ansible.builtin.stat: + path: /u01/app/oracle/Middleware/wlserver_10.3 + register: weblogic_server_installed_check + +- name: Install weblogic server software + block: + - name: Get weblogic install jar from S3 bucket + amazon.aws.aws_s3: + bucket: "{{ image_builder_s3_bucket_name }}" + object: "oasys-bip{{ item }}" + dest: "{{ item }}" + mode: get + overwrite: latest + loop: + - /u01/software/weblogic/wls1036_generic.jar + + - name: Copy weblogic install config + ansible.builtin.template: + src: "10.3{{ item }}" + dest: "{{ item }}" + owner: oracle + group: oinstall + loop: + - /u01/software/weblogic/silent.xml + + - name: Install weblogic server which takes a couple of minutes + become_user: oracle + ansible.builtin.shell: | + set -eo pipefail + main() { + echo "# installing weblogic /u01/software/weblogic/wls1036_generic.jar" + java -d64 -Xmx1024m -jar /u01/software/weblogic/wls1036_generic.jar -mode=silent -silent_xml=/u01/software/weblogic/silent.xml -Djava.io.tmpdir=/u01/software/tmp + } + main 2>&1 | logger -p local3.info -t ansible-weblogic + + - name: Remove temporary install files + ansible.builtin.file: + path: "{{ item }}" + state: absent + loop: + - /u01/software/weblogic/wls1036_generic.jar + - /u01/software/weblogic/silent.xml + + # block + when: not weblogic_server_installed_check.stat.exists + +- name: Update bsu.sh MEM_ARGS + ansible.builtin.lineinfile: + path: /u01/app/oracle/Middleware/utils/bsu/bsu.sh + regexp: "^MEM_ARGS=" + line: 'MEM_ARGS="-Xms4096m -Xmx4096m" # ansible managed modernisation-platform-configuration-management' diff --git a/ansible/roles/oasys-bip/templates/create_bip_db.sh.j2 b/ansible/roles/oasys-bip/templates/create_bip_db.sh.j2 new file mode 100644 index 000000000..444cc1328 --- /dev/null +++ b/ansible/roles/oasys-bip/templates/create_bip_db.sh.j2 @@ -0,0 +1,30 @@ +#!/bin/bash +export ORAENV_ASK=false +export ORACLE_HOME=/u01/app/oracle/product/19c/db_1 +export PATH=$ORACLE_HOME/bin:$PATH +export ORACLE_SID=$1 +export SYS_PASSWORD=$2 +export SYSTEM_PASSWORD=$3 + +dbca -silent -createDatabase \ + -templateName General_Purpose.dbc \ + -gdbname ${ORACLE_SID} -sid ${ORACLE_SID} -responseFile NO_VALUE \ + -characterSet AL32UTF8 \ + -sysPassword ${SYS_PASSWORD} \ + -systemPassword ${SYSTEM_PASSWORD} \ + -createAsContainerDatabase false \ + -databaseType MULTIPURPOSE \ + -totalMemory 2048 \ + -storageType ASM \ + -diskGroupName +DATA \ + -recoveryAreaDestination +FLASH \ + -redoLogFileSize 600 \ + -emConfiguration NONE \ + -automaticMemoryManagement false \ + -sampleSchema FALSE \ + -enableArchive TRUE \ + -ignorePreReqs + +. oraenv <<< $ORACLE_SID +srvctl add service -d $ORACLE_SID -s RCV_TAF +srvctl start service -d $ORACLE_SID -s RCV_TAF From 3a840c7c1c2d61d0cd82f162f12b3034eadc4c18 Mon Sep 17 00:00:00 2001 From: sandhya Gandalwar Date: Fri, 1 Sep 2023 10:25:04 +0100 Subject: [PATCH 04/19] Testing in progress --- .../environment_name_oasys_test.yml | 19 + ansible/roles/oasys-bip/defaults/main.yml | 18 +- .../roles/oasys-bip/tasks/bip_db_setup.yml | 37 -- .../roles/oasys-bip/tasks/certificate-fix.yml | 146 ++++---- .../oasys-bip/tasks/create_bip_database.yml | 29 ++ .../roles/oasys-bip/tasks/get-db-facts.yml | 45 +++ ansible/roles/oasys-bip/tasks/get-facts.yml | 9 + .../roles/oasys-bip/tasks/install-server.yml | 40 ++- ansible/roles/oasys-bip/tasks/main.yml | 25 +- .../roles/oasys-bip/tasks/patch-weblogic.yml | 4 +- ansible/roles/oasys-bip/tasks/rcu.yml | 92 +++-- ansible/roles/oasys-bip/tasks/users.yml | 12 +- .../oracle/.bash_profile => .bash_profile.j2} | 0 .../templates/10.3/etc/logrotate.d/nomis-web | 10 - .../etc/systemd/system/nodemanager.service | 16 - .../systemd/system/wls_adminserver.service | 13 - .../systemd/system/wls_managedserver.service | 13 - .../systemd/system/wls_nodemanager.service | 13 - .../10.3/home/oracle/admin/scripts/README.md | 42 --- .../admin/scripts/create_managed_app.py | 324 ------------------ .../home/oracle/admin/scripts/get_param.py | 50 --- .../home/oracle/admin/scripts/ms_state.py | 30 -- .../home/oracle/admin/scripts/ms_state.sh | 11 - .../admin/scripts/set_ms_log_rotation.py | 57 --- .../home/oracle/admin/scripts/set_param.py | 57 --- .../oracle/admin/scripts/stopNodeManager.sh | 8 - .../admin/scripts/wait_for_entry_in_log.sh | 22 -- .../oracle/admin/scripts/weblogic.properties | 2 - .../oracle/admin/scripts/weblogicControl.py | 130 ------- .../software/weblogic/AdminServer.properties | 7 - .../weblogic/WLS_XTAG_OUTBOUND_01.properties | 46 --- .../u01/software/weblogic/domain.properties | 15 - .../oasys-bip/templates/bip_password.tmp.j2 | 6 +- .../boot.properties => boot.properties.j2} | 0 .../roles/oasys-bip/templates/oraInst.loc.j2 | 2 +- .../weblogic/silent.xml => silent.xml.j2} | 0 36 files changed, 285 insertions(+), 1065 deletions(-) delete mode 100644 ansible/roles/oasys-bip/tasks/bip_db_setup.yml create mode 100644 ansible/roles/oasys-bip/tasks/create_bip_database.yml create mode 100644 ansible/roles/oasys-bip/tasks/get-db-facts.yml rename ansible/roles/oasys-bip/templates/{10.3/home/oracle/.bash_profile => .bash_profile.j2} (100%) delete mode 100644 ansible/roles/oasys-bip/templates/10.3/etc/logrotate.d/nomis-web delete mode 100644 ansible/roles/oasys-bip/templates/10.3/etc/systemd/system/nodemanager.service delete mode 100644 ansible/roles/oasys-bip/templates/10.3/etc/systemd/system/wls_adminserver.service delete mode 100644 ansible/roles/oasys-bip/templates/10.3/etc/systemd/system/wls_managedserver.service delete mode 100644 ansible/roles/oasys-bip/templates/10.3/etc/systemd/system/wls_nodemanager.service delete mode 100644 ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/README.md delete mode 100644 ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/create_managed_app.py delete mode 100644 ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/get_param.py delete mode 100644 ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/ms_state.py delete mode 100755 ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/ms_state.sh delete mode 100644 ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/set_ms_log_rotation.py delete mode 100644 ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/set_param.py delete mode 100644 ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/stopNodeManager.sh delete mode 100755 ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/wait_for_entry_in_log.sh delete mode 100644 ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/weblogic.properties delete mode 100644 ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/weblogicControl.py delete mode 100644 ansible/roles/oasys-bip/templates/10.3/u01/software/weblogic/AdminServer.properties delete mode 100644 ansible/roles/oasys-bip/templates/10.3/u01/software/weblogic/WLS_XTAG_OUTBOUND_01.properties delete mode 100644 ansible/roles/oasys-bip/templates/10.3/u01/software/weblogic/domain.properties rename ansible/roles/oasys-bip/templates/{10.3/u01/app/oracle/Middleware/user_projects/domains/NomisDomain/servers/AdminServer/security/boot.properties => boot.properties.j2} (100%) rename ansible/roles/oasys-bip/templates/{10.3/u01/software/weblogic/silent.xml => silent.xml.j2} (100%) diff --git a/ansible/group_vars/environment_name_oasys_test.yml b/ansible/group_vars/environment_name_oasys_test.yml index d948143fe..1c372c678 100644 --- a/ansible/group_vars/environment_name_oasys_test.yml +++ b/ansible/group_vars/environment_name_oasys_test.yml @@ -204,3 +204,22 @@ db_configs: RCVCAT: rcvcat_db_name: TRCVCAT + + T2BIPINF: + parameters: + - { name: "_allow_insert_with_update_check", value: TRUE, db_restart_required: 0, scope: both } + - { name: session_cached_cursors, value: 300, db_restart_required: 0, scope: spfile } + - { name: processes, value: 500, db_restart_required: 1, scope: spfile } + - { name: pga_aggregate_target, value: 800M, db_restart_required: 0, scope: both } + - { name: db_recovery_file_dest_size, value: 40G, db_restart_required: 0, scope: both } + - { name: shared_pool_size, value: 300M, db_restart_required: 0, scope: both } + - { name: open_cursors, value: 800, db_restart_required: 0, scope: both } + - { name: db_files, value: 600, db_restart_required: 0, scope: both } + - { + name: log_archive_dest_1, + value: '"''location=use_db_recovery_file_dest valid_for=(all_logfiles,all_roles) db_unique_name=emrep''"', + db_restart_required: 0, + scope: both, + } + service: + - { name: BIPINF_TAF, role: PRIMARY } diff --git a/ansible/roles/oasys-bip/defaults/main.yml b/ansible/roles/oasys-bip/defaults/main.yml index 5fcc03a30..f9127e0ec 100644 --- a/ansible/roles/oasys-bip/defaults/main.yml +++ b/ansible/roles/oasys-bip/defaults/main.yml @@ -2,16 +2,12 @@ ssm_parameters_prefix: "weblogic" weblogic_domain_hostname: "{{ ansible_facts.hostname }}" weblogic_servername: "{{ ansible_facts.hostname }}" -weblogic_cluster: "{{ ansible_facts.hostname }}" -weblogic_db_port: 1521 -ndh_ems_server: t1pml0005 -xtag_app_path: /u01/tag/xtag middleware_home: /u01/app/oracle/Middleware wl_home: /u01/app/oracle/Middleware/wlserver_10.3 -domain_home: /u01/app/oracle/Middleware/user_projects/domains -domain_name: NomisDomain -managed_server: WLS_XTAG_OUTBOUND_01 - -weblogic_servers: - - { name: WLS_XTAG_OUTBOUND_01 } - - { name: AdminServer } +stage: /u01/stage +bip_db_server: 10.26.12.211 #should be part of ec2 instance tag +bip_db_name: T2BIPINF #should be part of ec2 instance tag +oracle_install_user: oracle +oracle_install_group: oinstall +domain_name: bifoundation_domain +domain_home: /u01/app/oracle/Middleware/user_projects/domains \ No newline at end of file diff --git a/ansible/roles/oasys-bip/tasks/bip_db_setup.yml b/ansible/roles/oasys-bip/tasks/bip_db_setup.yml deleted file mode 100644 index 44d9af58c..000000000 --- a/ansible/roles/oasys-bip/tasks/bip_db_setup.yml +++ /dev/null @@ -1,37 +0,0 @@ ---- -- name: Copy recovery catalog creation scripts - template: - src: "{{ item }}.j2" - dest: "{{ stage }}/{{ item }}" - owner: oracle - group: oinstall - mode: "0700" - loop: - - create_recovery_catalog_db.sh - - create_recovery_catalog_user.sh - -- name: Create recovery catalog database - become_user: oracle - ansible.builtin.shell: | - set -eo pipefail - main() { - echo "# create_recovery_catalog_db.sh " - {{ stage }}/create_recovery_catalog_db.sh {{ rcvcat_db_name.rcvcat_db_name }} {{ db_sys_password }} {{ db_system_password }} - } - main 2>&1 | logger -p local3.info -t ansible-oracle-db - async: 86400 - poll: 60 - when: not ansible_check_mode - -- name: Create recovery catalog database user and rman catalog - become_user: oracle - ansible.builtin.shell: | - set -eo pipefail - main() { - echo "# create_recovery_catalog_user.sh" - {{ stage }}/create_recovery_catalog_user.sh {{ rcvcat_db_name.rcvcat_db_name }} {{ db_rcatowner_password }} {{ stage }} - } - main 2>&1 | logger -p local3.info -t ansible-oracle-db - async: 86400 - poll: 60 - when: not ansible_check_mode diff --git a/ansible/roles/oasys-bip/tasks/certificate-fix.yml b/ansible/roles/oasys-bip/tasks/certificate-fix.yml index 044d4e386..711aca525 100644 --- a/ansible/roles/oasys-bip/tasks/certificate-fix.yml +++ b/ansible/roles/oasys-bip/tasks/certificate-fix.yml @@ -1,73 +1,81 @@ --- -- name: Create cert fix directory - ansible.builtin.file: - path: /home/oracle/.certificate-fix - state: directory - owner: oracle - group: oinstall - mode: "0755" - -- name: Check weblogic cert - ansible.builtin.stat: - path: /home/oracle/.certificate-fix/demokey.pem - register: weblogic_cert - -- name: Create weblogic keystore cert if not present - become_user: oracle - args: - chdir: /home/oracle/.certificate-fix - ansible.builtin.shell: | - set -eo pipefail - . ~/.bash_profile - . $WL_HOME/server/bin/setWLSEnv.sh - main() { - echo "# Generating democert" - java utils.CertGen -keyfilepass DemoIdentityPassPhrase -certfile democert -keyfile demokey -strength 1024 - } - main 2>&1 | logger -p local3.info -t ansible-weblogic - when: not weblogic_cert.stat.exists - -- name: List weblogic keystore certs - become_user: oracle - args: - chdir: /home/oracle/.certificate-fix - check_mode: false - changed_when: false - ansible.builtin.shell: | - set -eo pipefail - . ~/.bash_profile > /dev/null - . $WL_HOME/server/bin/setWLSEnv.sh > /dev/null - keytool -list -v -keystore DemoIdentity.jks -storepass DemoIdentityKeyStorePassPhrase || true - register: weblogic_keystore_list - -- name: Import weblogic keystore cert if not present - become_user: oracle - args: - chdir: /home/oracle/.certificate-fix - ansible.builtin.shell: | - set -eo pipefail - . ~/.bash_profile - . $WL_HOME/server/bin/setWLSEnv.sh - main() { - echo "# Importing cert into KeyStore" - java utils.ImportPrivateKey -keystore DemoIdentity.jks -storepass DemoIdentityKeyStorePassPhrase -keyfile demokey.pem -keyfilepass DemoIdentityPassPhrase -certfile democert.pem -alias demoidentity - keytool -importcert -trustcacerts -alias wlscertgenca -keystore DemoTrust.jks -storepass DemoTrustKeyStorePassPhrase -file /u01/app/oracle/Middleware/wlserver_10.3/server/lib/CertGenCA.der -noprompt - } - main 2>&1 | logger -p local3.info -t ansible-weblogic - -- name: Disable SecureListener in nodemanager.properties - ansible.builtin.replace: - path: "{{ wl_home }}/common/nodemanager/nodemanager.properties" - regexp: "SecureListener=true" - replace: "SecureListener=false" - -- name: Stop Admin server - become_user: oracle - ansible.builtin.shell: | - set -eo pipefail - . ~/.bash_profile - . $WL_HOME/server/bin/setWLSEnv.sh - "{{ domain_home }}/{{ domain_name }}/bin/stopWebLogic.sh" +# - name: Start nodemanager +# become_user: oracle +# ansible.builtin.shell: | +# set -eo pipefail +# . ~/.bash_profile +# . $WL_HOME/server/bin/setWLSEnv.sh +# nohup {{ wl_home }}/server/bin/startNodeManager.sh & + +# - name: Create cert fix directory +# ansible.builtin.file: +# path: /home/oracle/.certificate-fix +# state: directory +# owner: oracle +# group: oinstall +# mode: "0755" + +# - name: Check weblogic cert +# ansible.builtin.stat: +# path: /home/oracle/.certificate-fix/demokey.pem +# register: weblogic_cert + +# - name: Create weblogic keystore cert if not present +# become_user: oracle +# args: +# chdir: /home/oracle/.certificate-fix +# ansible.builtin.shell: | +# set -eo pipefail +# . ~/.bash_profile +# . $WL_HOME/server/bin/setWLSEnv.sh +# main() { +# echo "# Generating democert" +# java utils.CertGen -keyfilepass DemoIdentityPassPhrase -certfile democert -keyfile demokey -strength 1024 +# } +# main 2>&1 | logger -p local3.info -t ansible-weblogic +# when: not weblogic_cert.stat.exists + +# - name: List weblogic keystore certs +# become_user: oracle +# args: +# chdir: /home/oracle/.certificate-fix +# check_mode: false +# changed_when: false +# ansible.builtin.shell: | +# set -eo pipefail +# . ~/.bash_profile > /dev/null +# . $WL_HOME/server/bin/setWLSEnv.sh > /dev/null +# keytool -list -v -keystore DemoIdentity.jks -storepass DemoIdentityKeyStorePassPhrase || true +# register: weblogic_keystore_list + +# - name: Import weblogic keystore cert if not present +# become_user: oracle +# args: +# chdir: /home/oracle/.certificate-fix +# ansible.builtin.shell: | +# set -eo pipefail +# . ~/.bash_profile +# . $WL_HOME/server/bin/setWLSEnv.sh +# main() { +# echo "# Importing cert into KeyStore" +# java utils.ImportPrivateKey -keystore DemoIdentity.jks -storepass DemoIdentityKeyStorePassPhrase -keyfile demokey.pem -keyfilepass DemoIdentityPassPhrase -certfile democert.pem -alias demoidentity +# keytool -importcert -trustcacerts -alias wlscertgenca -keystore DemoTrust.jks -storepass DemoTrustKeyStorePassPhrase -file /u01/app/oracle/Middleware/wlserver_10.3/server/lib/CertGenCA.der -noprompt +# } +# main 2>&1 | logger -p local3.info -t ansible-weblogic + +# - name: Disable SecureListener in nodemanager.properties +# ansible.builtin.replace: +# path: "{{ wl_home }}/common/nodemanager/nodemanager.properties" +# regexp: "SecureListener=true" +# replace: "SecureListener=false" + +# - name: Stop Admin server +# become_user: oracle +# ansible.builtin.shell: | +# set -eo pipefail +# . ~/.bash_profile +# . $WL_HOME/server/bin/setWLSEnv.sh +# "{{ domain_home }}/{{ domain_name }}/bin/stopWebLogic.sh" - name: Stop nodemanager processes become_user: oracle diff --git a/ansible/roles/oasys-bip/tasks/create_bip_database.yml b/ansible/roles/oasys-bip/tasks/create_bip_database.yml new file mode 100644 index 000000000..47c061710 --- /dev/null +++ b/ansible/roles/oasys-bip/tasks/create_bip_database.yml @@ -0,0 +1,29 @@ +--- +- name: Create stage directory + ansible.builtin.file: + path: "{{ stage }}" + state: directory + owner: oracle + group: oinstall + mode: "0755" + +- name: Copy BIP database creation scripts + template: + src: "create_bip_db.sh.j2" + dest: "{{ stage }}/create_bip_db.sh" + owner: oracle + group: oinstall + mode: "0700" + +- name: Create BIP database + become_user: oracle + ansible.builtin.shell: | + set -eo pipefail + main() { + echo "# create_recovery_catalog_db.sh " + {{ stage }}/create_bip_db.sh {{ db_name }} {{ db_sys_password }} {{ db_system_password }} + } + main 2>&1 | logger -p local3.info -t ansible-oracle-db + async: 86400 + poll: 60 + when: not ansible_check_mode diff --git a/ansible/roles/oasys-bip/tasks/get-db-facts.yml b/ansible/roles/oasys-bip/tasks/get-db-facts.yml new file mode 100644 index 000000000..02440b9c5 --- /dev/null +++ b/ansible/roles/oasys-bip/tasks/get-db-facts.yml @@ -0,0 +1,45 @@ +--- +- name: Get server name + set_fact: + server_name: '{{ ec2.tags["server-name"] }}' + +- name: Extract environment from server name + set_fact: + environment_name: '{{ server_name[:2] | upper }}' + +- name: Set database name + set_fact: + db_name: '{{ environment_name }}BIPINF' + +- name: Fail if missing parameters + fail: + msg: "Ensure {{ db_name }} variable is defined in db_configs fact" + when: db_configs[db_name] is not defined + +- name: Set SSM parameters path fact from ec2 ssm-parameters-prefix and Name tag + set_fact: + ssm_parameters_path: '/{{ ec2.tags["ssm-parameters-prefix"] }}{{ ec2.tags["Name"] }}' + +- name: Set SSM parameters database path facts + set_fact: + ssm_parameters_path_db_sys_password: "{{ ssm_parameters_path }}/{{ db_name}}/syspassword" + ssm_parameters_path_db_system_password: "{{ ssm_parameters_path }}/{{ db_name }}/systempassword" + +- name: Get SSM parameters + set_fact: + db_sys_password: "{{ lookup('aws_ssm', ssm_parameters_path_db_sys_password, region=ansible_ec2_placement_region) }}" + db_system_password: "{{ lookup('aws_ssm', ssm_parameters_path_db_system_password, region=ansible_ec2_placement_region) }}" + +- name: Check parameters + set_fact: + db_all_variables_set: true + when: + - db_sys_password|length > 0 + - db_system_password| length > 0 + +- name: Fail if missing parameters + fail: + msg: Ensure all required parameters are set + when: not db_all_variables_set|default(false) + + diff --git a/ansible/roles/oasys-bip/tasks/get-facts.yml b/ansible/roles/oasys-bip/tasks/get-facts.yml index 16825111f..ef9bc1fe6 100644 --- a/ansible/roles/oasys-bip/tasks/get-facts.yml +++ b/ansible/roles/oasys-bip/tasks/get-facts.yml @@ -10,6 +10,9 @@ ssm_parameters_path_weblogic_admin_password: "{{ ssm_parameters_path }}/admin_password" ssm_parameters_path_weblogic_db_username: "{{ ssm_parameters_path }}/db_username" ssm_parameters_path_weblogic_db_password: "{{ ssm_parameters_path }}/db_password" + ssm_parameters_path_bipdb_sys_password: "{{ ssm_parameters_path }}/syspassword" + ssm_parameters_path_bipdb_biplatform_password: "{{ ssm_parameters_path }}/biplatformpassword" + ssm_parameters_path_bipdb_mds_password: "{{ ssm_parameters_path }}/mdspassword" - name: Get SSM parameters set_fact: @@ -17,6 +20,9 @@ weblogic_admin_password: "{{ lookup('aws_ssm', ssm_parameters_path_weblogic_admin_password, region=ansible_ec2_placement_region) }}" weblogic_db_username: "{{ lookup('aws_ssm', ssm_parameters_path_weblogic_db_username, region=ansible_ec2_placement_region) }}" weblogic_db_password: "{{ lookup('aws_ssm', ssm_parameters_path_weblogic_db_password, region=ansible_ec2_placement_region) }}" + bipdb_sys_password: "{{ lookup('aws_ssm', ssm_parameters_path_bipdb_sys_password, region=ansible_ec2_placement_region) }}" + bipdb_biplatform_password: "{{ lookup('aws_ssm', ssm_parameters_path_bipdb_biplatform_password, region=ansible_ec2_placement_region) }}" + bipdb_mds_password: "{{ lookup('aws_ssm', ssm_parameters_path_bipdb_mds_password, region=ansible_ec2_placement_region) }}" when: weblogic_admin_username is not defined - name: Set db hostname from ec2 oracle-db-hostname tag @@ -45,6 +51,9 @@ - weblogic_db_password|length > 0 - weblogic_db_hostname_a|length > 0 - weblogic_db_hostname_b|length > 0 + - bipdb_sys_password| length> 0 + - bipdb_biplatform_password| length> 0 + - bipdb_mds_password| length> 0 - name: Fail if missing SSM parameters or tags fail: diff --git a/ansible/roles/oasys-bip/tasks/install-server.yml b/ansible/roles/oasys-bip/tasks/install-server.yml index f6e62d525..128280d28 100644 --- a/ansible/roles/oasys-bip/tasks/install-server.yml +++ b/ansible/roles/oasys-bip/tasks/install-server.yml @@ -3,13 +3,14 @@ ansible.builtin.file: path: "{{ item }}" state: directory - owner: oracle - group: oinstall + owner: "{{ oracle_install_user }}" + group: "{{ oracle_install_group }}" mode: "0755" loop: - /u01/software/weblogic - /u01/software/tmp - /u01/app + - "{{ stage }}" - name: Check if weblogic server already installed ansible.builtin.stat: @@ -21,29 +22,36 @@ - name: Get weblogic install jar from S3 bucket amazon.aws.aws_s3: bucket: "{{ image_builder_s3_bucket_name }}" - object: "oasys-bip{{ item }}" - dest: "{{ item }}" + object: "oasys-bip/u01/software/weblogic/wls1036_generic.jar" + dest: "{{ stage }}/wls1036_generic.jar" mode: get overwrite: latest - loop: - - /u01/software/weblogic/wls1036_generic.jar - name: Copy weblogic install config ansible.builtin.template: - src: "10.3{{ item }}" - dest: "{{ item }}" - owner: oracle - group: oinstall + src: "{{ item }}.j2" + dest: "{{ stage }}/{{ item }}" + owner: "{{ oracle_install_user }}" + group: "{{ oracle_install_group }}" + loop: + - silent.xml + + - name: Copy oraInst.loc file + ansible.builtin.template: + src: "{{ item }}.j2" + dest: "/etc/{{ item }}" + owner: "{{ oracle_install_user }}" + group: "{{ oracle_install_group }}" loop: - - /u01/software/weblogic/silent.xml + - oraInst.loc - name: Install weblogic server which takes a couple of minutes - become_user: oracle + become_user: "{{ oracle_install_user }}" ansible.builtin.shell: | set -eo pipefail main() { - echo "# installing weblogic /u01/software/weblogic/wls1036_generic.jar" - java -d64 -Xmx1024m -jar /u01/software/weblogic/wls1036_generic.jar -mode=silent -silent_xml=/u01/software/weblogic/silent.xml -Djava.io.tmpdir=/u01/software/tmp + echo "# installing weblogic {{ stage }}/wls1036_generic.jar" + java -d64 -Xmx1024m -jar {{ stage }}/wls1036_generic.jar -mode=silent -silent_xml={{ stage }}/silent.xml -Djava.io.tmpdir=/u01/software/tmp -invPtrLoc /etc/oraInst.loc } main 2>&1 | logger -p local3.info -t ansible-weblogic @@ -52,8 +60,8 @@ path: "{{ item }}" state: absent loop: - - /u01/software/weblogic/wls1036_generic.jar - - /u01/software/weblogic/silent.xml + - "{{ stage }}/wls1036_generic.jar" + - "{{ stage }}/silent.xml" # block when: not weblogic_server_installed_check.stat.exists diff --git a/ansible/roles/oasys-bip/tasks/main.yml b/ansible/roles/oasys-bip/tasks/main.yml index 4fea7ab0d..6a6a07f95 100644 --- a/ansible/roles/oasys-bip/tasks/main.yml +++ b/ansible/roles/oasys-bip/tasks/main.yml @@ -1,5 +1,5 @@ --- -- name: Nomis XTAG weblogic setup +- name: Oasys BI publisher Installation block: - import_tasks: get-facts.yml tags: @@ -65,4 +65,27 @@ - ec2provision - weblogic_patch_2 + - import_tasks: certificate-fix.yml + tags: + - amibuild + - ec2provision + - certificate_fix + + - import_tasks: rcu.yml + tags: + - amibuild + - ec2provision + - rcu + when: ansible_distribution in ['RedHat', 'OracleLinux'] and ansible_distribution_major_version == "7" + +- import_tasks: get-db-facts.yml + tags: + - bip_db_create + - never + +- import_tasks: create_bip_database.yml + tags: + - bip_db_create + - never + diff --git a/ansible/roles/oasys-bip/tasks/patch-weblogic.yml b/ansible/roles/oasys-bip/tasks/patch-weblogic.yml index 25721d54a..131b2402a 100644 --- a/ansible/roles/oasys-bip/tasks/patch-weblogic.yml +++ b/ansible/roles/oasys-bip/tasks/patch-weblogic.yml @@ -5,7 +5,7 @@ when: weblogic_patch_filename is not defined or weblogic_patch_id is not defined - name: Get current weblogic patch - become_user: oracle + become_user: "{{ oracle_install_user }}" ansible.builtin.shell: | . ~/.bash_profile > /dev/null . $WL_HOME/server/bin/setWLSEnv.sh > /dev/null @@ -34,7 +34,7 @@ # takes forever so run in async mode to prevent connection timeouts - name: Run weblogic patch script which takes approx 20 mins - become_user: oracle + become_user: "{{ oracle_install_user }}" ansible.builtin.shell: | set -eo pipefail . ~/.bash_profile diff --git a/ansible/roles/oasys-bip/tasks/rcu.yml b/ansible/roles/oasys-bip/tasks/rcu.yml index f6e62d525..4a64224bb 100644 --- a/ansible/roles/oasys-bip/tasks/rcu.yml +++ b/ansible/roles/oasys-bip/tasks/rcu.yml @@ -1,5 +1,5 @@ --- -- name: Create software directories +- name: Create stage directory ansible.builtin.file: path: "{{ item }}" state: directory @@ -7,59 +7,45 @@ group: oinstall mode: "0755" loop: - - /u01/software/weblogic - - /u01/software/tmp - - /u01/app + - "{{ stage }}" + - "{{ wl_home }}/bi_rcu" -- name: Check if weblogic server already installed - ansible.builtin.stat: - path: /u01/app/oracle/Middleware/wlserver_10.3 - register: weblogic_server_installed_check +- name: Get RCU install software from S3 bucket + amazon.aws.aws_s3: + bucket: "{{ image_builder_s3_bucket_name }}" + object: "oasys-bip/u01/software/rcu/rcuHome.zip" + dest: "{{ stage }}/rcuHome.zip" + mode: get + overwrite: latest -- name: Install weblogic server software - block: - - name: Get weblogic install jar from S3 bucket - amazon.aws.aws_s3: - bucket: "{{ image_builder_s3_bucket_name }}" - object: "oasys-bip{{ item }}" - dest: "{{ item }}" - mode: get - overwrite: latest - loop: - - /u01/software/weblogic/wls1036_generic.jar - - - name: Copy weblogic install config - ansible.builtin.template: - src: "10.3{{ item }}" - dest: "{{ item }}" - owner: oracle - group: oinstall - loop: - - /u01/software/weblogic/silent.xml - - - name: Install weblogic server which takes a couple of minutes - become_user: oracle - ansible.builtin.shell: | - set -eo pipefail - main() { - echo "# installing weblogic /u01/software/weblogic/wls1036_generic.jar" - java -d64 -Xmx1024m -jar /u01/software/weblogic/wls1036_generic.jar -mode=silent -silent_xml=/u01/software/weblogic/silent.xml -Djava.io.tmpdir=/u01/software/tmp - } - main 2>&1 | logger -p local3.info -t ansible-weblogic - - - name: Remove temporary install files - ansible.builtin.file: - path: "{{ item }}" - state: absent - loop: - - /u01/software/weblogic/wls1036_generic.jar - - /u01/software/weblogic/silent.xml +- name: Extract archives into target directory + ansible.builtin.unarchive: + owner: oracle + group: oinstall + src: "{{stage }}/rcuHome.zip" + dest: "{{ wl_home }}/bi_rcu" + remote_src: true + keep_newer: true - # block - when: not weblogic_server_installed_check.stat.exists +- name: Copy weblogic install config + ansible.builtin.template: + src: "bip_password.tmp.j2" + dest: "{{stage }}/obiee_rcu_paramfile.txt" + owner: oracle + group: oinstall -- name: Update bsu.sh MEM_ARGS - ansible.builtin.lineinfile: - path: /u01/app/oracle/Middleware/utils/bsu/bsu.sh - regexp: "^MEM_ARGS=" - line: 'MEM_ARGS="-Xms4096m -Xmx4096m" # ansible managed modernisation-platform-configuration-management' +- name: Create BIP database + become_user: oracle + ansible.builtin.shell: | + set -eo pipefail + main() { + . ~/.bash_profile + $WL_HOME//bi_rcu/bin/rcu -silent -createRepository \ + -connectString {{ bip_db_server }}:1521/{{ bip_db_name }} \ + -dbUser SYS -dbRole SYSDBA -schemaPrefix TEST \ + -component BIPLATFORM -component MDS -f < /u01/stage/obiee_rcu_paramfile.txt + } + main 2>&1 | logger -p local3.info -t ansible-bip-repository + async: 86400 + poll: 60 + when: not ansible_check_mode \ No newline at end of file diff --git a/ansible/roles/oasys-bip/tasks/users.yml b/ansible/roles/oasys-bip/tasks/users.yml index 781eedccc..495ea0a4d 100644 --- a/ansible/roles/oasys-bip/tasks/users.yml +++ b/ansible/roles/oasys-bip/tasks/users.yml @@ -2,13 +2,13 @@ - name: Check oracle user already exists ansible.builtin.getent: database: passwd - key: oracle + key: "{{ oracle_install_user }}" - name: Copy oracle bash profile ansible.builtin.template: - src: "10.3{{ item }}" - dest: "{{ item }}" - owner: oracle - group: oinstall + src: "{{ item }}.j2" + dest: "/home/oracle/.bash_profile" + owner: "{{ oracle_install_user }}" + group: "{{ oracle_install_group }}" loop: - - /home/oracle/.bash_profile + - .bash_profile diff --git a/ansible/roles/oasys-bip/templates/10.3/home/oracle/.bash_profile b/ansible/roles/oasys-bip/templates/.bash_profile.j2 similarity index 100% rename from ansible/roles/oasys-bip/templates/10.3/home/oracle/.bash_profile rename to ansible/roles/oasys-bip/templates/.bash_profile.j2 diff --git a/ansible/roles/oasys-bip/templates/10.3/etc/logrotate.d/nomis-web b/ansible/roles/oasys-bip/templates/10.3/etc/logrotate.d/nomis-web deleted file mode 100644 index 9f1c9cf72..000000000 --- a/ansible/roles/oasys-bip/templates/10.3/etc/logrotate.d/nomis-web +++ /dev/null @@ -1,10 +0,0 @@ -/u01/tag/HotPage/logs/HotPage.log -/u01/tag/autologoff/logs/web.log -{ - missingok - copytruncate - maxsize 3G - rotate 4 - weekly - compress -} \ No newline at end of file diff --git a/ansible/roles/oasys-bip/templates/10.3/etc/systemd/system/nodemanager.service b/ansible/roles/oasys-bip/templates/10.3/etc/systemd/system/nodemanager.service deleted file mode 100644 index f80894817..000000000 --- a/ansible/roles/oasys-bip/templates/10.3/etc/systemd/system/nodemanager.service +++ /dev/null @@ -1,16 +0,0 @@ -[Unit] -Description=Node Manager controls the WebLogic Server runtime lifecycle -After=network.target - -[Service] -User=weblogic -Group=javainstall -Type=simple -ExecStart=/home/oracle/admin/scripts/control_NodeManager.sh start >/dev/null 2>/dev/null & -ExecStop=/home/oracle/admin/scripts/control_NodeManager.sh stop >/dev/null 2>/dev/null & -PIDFile=/home/oracle/admin/scripts/nodemanager.process.id -Restart=on-failure -RestartSec=1 - -[Install] -WantedBy=default.target diff --git a/ansible/roles/oasys-bip/templates/10.3/etc/systemd/system/wls_adminserver.service b/ansible/roles/oasys-bip/templates/10.3/etc/systemd/system/wls_adminserver.service deleted file mode 100644 index 2e27b9392..000000000 --- a/ansible/roles/oasys-bip/templates/10.3/etc/systemd/system/wls_adminserver.service +++ /dev/null @@ -1,13 +0,0 @@ -[Unit] -Description=WebLogic Adminserver Service - -[Service] -Type=simple -WorkingDirectory={{ domain_home }} -ExecStart={{ domain_home }}/{{ domain_name }}/bin/startWebLogic.sh -ExecStop={{ domain_home }}/{{ domain_name }}/bin/stopWebLogic.sh -User=oracle -Group=oinstall - -[Install] -WantedBy=multi-user.target diff --git a/ansible/roles/oasys-bip/templates/10.3/etc/systemd/system/wls_managedserver.service b/ansible/roles/oasys-bip/templates/10.3/etc/systemd/system/wls_managedserver.service deleted file mode 100644 index 1799603b4..000000000 --- a/ansible/roles/oasys-bip/templates/10.3/etc/systemd/system/wls_managedserver.service +++ /dev/null @@ -1,13 +0,0 @@ -[Unit] -Description=WebLogic managed server Service - -[Service] -Type=simple -WorkingDirectory={{ domain_home }} -ExecStart={{ domain_home }}/{{ domain_name }}/bin/startManagedWebLogic.sh {{ managed_server }} -ExecStop={{ domain_home }}/{{ domain_name }}/bin/stopManagedWebLogic.sh {{ managed_server }} -User=oracle -Group=oinstall - -[Install] -WantedBy=multi-user.target diff --git a/ansible/roles/oasys-bip/templates/10.3/etc/systemd/system/wls_nodemanager.service b/ansible/roles/oasys-bip/templates/10.3/etc/systemd/system/wls_nodemanager.service deleted file mode 100644 index 23a4c9bb4..000000000 --- a/ansible/roles/oasys-bip/templates/10.3/etc/systemd/system/wls_nodemanager.service +++ /dev/null @@ -1,13 +0,0 @@ -[Unit] -Description=WebLogic NodeManager Service - -[Service] -Type=simple -WorkingDirectory={{ domain_home }} -ExecStart={{ wl_home }}/server/bin/startNodeManager.sh -ExecStop=/home/oracle/admin/scripts/stopNodeManager.sh -User=oracle -Group=oinstall - -[Install] -WantedBy=multi-user.target diff --git a/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/README.md b/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/README.md deleted file mode 100644 index 9bbf9e1ad..000000000 --- a/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/README.md +++ /dev/null @@ -1,42 +0,0 @@ -The python scripts in this directory are designed to be run with wlst. -Credentials should be picked up automatically from boot.properties - -Setting environment - -``` -. $WL_HOME/server/bin/setWLSEnv.sh -. /u01/app/oracle/Middleware/user_projects/domains/NomisDomain/bin/setDomainEnv.sh -``` - -Checking managed server status -``` -wlst.sh ~/admin/scripts/ms_state.py -``` - -Use init.d scripts for starting and stopping each individual component. -This ensures any component output goes to /var/log/messages. - -``` -service weblogic-node-manager start -service weblogic-server start -service WLS_FORMS start -service WLS_REPORTS start -service WLS_HOTPAGE start -service WLS_TAGSAR start -service WLS_AUTOLOGOFF start -service opmn start -``` - -Or use master script to restart everything - -``` -service weblogic-all status -service weblogic-all restart -``` - -And to bring in and out of load balancer - -``` -service weblogic-healthcheck start # to bring in -service weblogic-healthcheck stop # to take out -``` diff --git a/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/create_managed_app.py b/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/create_managed_app.py deleted file mode 100644 index d65a3df9b..000000000 --- a/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/create_managed_app.py +++ /dev/null @@ -1,324 +0,0 @@ -#!/usr/bin/python -from java.io import FileInputStream -import time -import getopt -import sys -import re -import pdb - -# Get location of the properties file. -properties = '' -try: - opts, args = getopt.getopt(sys.argv[1:], "p:h::", ["properties="]) -except getopt.GetoptError: - print 'create_managed_server.py -p ' - sys.exit(2) -for opt, arg in opts: - if opt == '-h': - print 'create_managed_server.py -p ' - sys.exit() - elif opt in ("-p", "--properties"): - properties = arg -print 'properties=', properties - -# Load the properties from the properties file. - -propInputStream = FileInputStream(properties) -configProps = Properties() -configProps.load(propInputStream) -# domainName = '' - -# Get Variables From Properties Files -# Admin Console -adminUsername = configProps.get("admin.username") -adminPassword = configProps.get("admin.password") -adminURL = configProps.get("admin.url") -adminPort = configProps.get("admin.port") -adminAddress = configProps.get("admin.address") - -# Domain -domainName = configProps.get("domain.name") -wlsPath = configProps.get("path.wls") -domainConfigPath = configProps.get("path.domain.config") -appConfigPath = configProps.get("path.app.config") -machine = configProps.get("machine") - -# Cluster -clusterName = configProps.get("cluster.name") - -# Managed Server -msName = configProps.get("ms.name") -msAddress = configProps.get("ms.address") -msPort = configProps.get("ms.port") -msCluster = configProps.get("ms.cluster") -msStartArg = configProps.get("ms.startarg") - -# Data Source -dsName = configProps.get("ds.name") -dsJNDIName = configProps.get("ds.jndi.name") -dsURL = configProps.get("ds.url") -dsDriver = configProps.get("ds.driver") -dsUsername = configProps.get("ds.username") -dsPassword = configProps.get("ds.password") -dsTargetType = configProps.get("ds.target.type") -dsTargetName = configProps.get("ds.target.name") - -# Deployment -appName = configProps.get("app.name") -path = configProps.get("app.path") -target = configProps.get("app.target") - -# Update formsapp plan deployment -fappName = configProps.get("app.fname") -planpath = configProps.get("app.planpath") - -# JMS Module -jmsModuleName = configProps.get("jms.module.name") -jmsdescriptorFileName = configProps.get("jms.descriptorFile.name") -jmsTarget = configProps.get("jms.target") -jmsFServerName = configProps.get("jms.fserver.name") -jmsFServerContext = configProps.get("jms.fserver.context") -jmsFServerJNDIProperty = configProps.get("jms.fserver.jndiproperty") -jmsFServerDestName = configProps.get("jms.fserver.destination.name") -jmsFServerDestLocJNDIName = configProps.get( - "jms.fserver.destination.local.jndi.name") -jmsFServerDestRemJNDIName = configProps.get( - "jms.fserver.destination.remote.jndi.name") -jmsFServerFactoryName = configProps.get("jms.fserver.factory.name") -jmsFServerFactoryLocJNDIName = configProps.get( - "jms.fserver.factory.local.jndi.name") -jmsFServerFactoryRemJNDIName = configProps.get( - "jms.fserver.factory.remote.jndi.name") -jmsremoteConnectionURL = configProps.get("jms.fserver.remoteconnectionurl") -# Function that waits for a managed server to start before proceeding Wait for Managed Server to start - - -def wait_for_ms_start(): - stopped = True - while stopped: - try: - domainRuntime() - cd('/ServerLifeCycleRuntimes/' + msName) - serverState = cmo.getState() - if serverState == "RUNNING": - print msName + ' is ' + serverState - stopped = False - elif serverState == "STARTING": - print msName + ' is ' + serverState - Thread.sleep(10000) - continue - elif serverState == "FORCE_SHUTTING_DOWN": - print msName + ' is ' + serverState - Thread.sleep(10000) - continue - elif serverState == "SHUTDOWN": - print msName + ' is ' + serverState - print 'Starting ' + msName - cmo.start() - continue - except: - print 'Server :'+msName + ' seems to be down ' - Thread.sleep(10000) - continue - - -print adminPassword -# Connect to the AdminServer. -if domainName: - readTemplate(wlsPath + '/common/templates/domains/wls.jar') - cd('/') - mn = create(machine, 'Machine') - mn.setName(machine) - cd('/Security/base_domain/User/' + adminUsername) - cmo.setPassword(adminPassword) - cd('/Server/AdminServer') - cmo.setName('AdminServer') - cmo.setListenPort(int(adminPort)) - cmo.setListenAddress(adminAddress) - create('AdminServer', 'SSL') - cd('SSL/AdminServer') - set('Enabled', 'false') - setOption('ServerStartMode', 'prod') - writeDomain(domainConfigPath + '/' + domainName) - closeTemplate() - exit() -else: - connect(adminUsername, adminPassword, adminURL) - -# Create Cluster -if clusterName: - edit() - startEdit() - cd('/') - cmo.createCluster(clusterName) - cd('/Clusters/' + clusterName) - cmo.setClusterMessagingMode('unicast') - save() - activate() - -# Create Managed Server -if msName: - edit() - startEdit() - cd('/') - cmo.createServer(msName) - cd('/Servers/' + msName) - cmo.setListenAddress(msAddress) - cmo.setListenPort(int(msPort)) - cd('/Servers/' + msName + '/Log/' + msName) - cmo.setRedirectStderrToServerLogEnabled(true) - cmo.setRedirectStdoutToServerLogEnabled(true) - cmo.setMemoryBufferSeverity('Debug') - cd('/Servers/' + msName) - cmo.setCluster(getMBean('/Clusters/' + msCluster)) - cmo.setMachine(getMBean('/Machines/' + msAddress)) - cd('/Servers/' + msName + '/ServerStart/' + msName) - cmo.setArguments(msStartArg) - save() - activate() - startEdit() - save() - activate() - # Start Managed Server - start(msName, 'Server') - wait_for_ms_start() - -# Create Data Source(s) -if dsName: - # Create List of Data Source(s) - dsUsernames = dsUsername.split(",") - dsPasswords = dsPassword.split(",") - dsName = dsName.split(",") - dsJNDIName = dsJNDIName.split(",") - datasources = zip(dsName, dsJNDIName, dsUsernames, dsPasswords) - for dsName, dsJNDIName, dsUsername, dsPassword in datasources: - edit() - startEdit() - cd('/') - cmo.createJDBCSystemResource(dsName) - cd('/JDBCSystemResources/' + dsName + '/JDBCResource/' + dsName) - cmo.setName(dsName) - cd('/JDBCSystemResources/' + dsName + '/JDBCResource/' + - dsName + '/JDBCDataSourceParams/' + dsName) - set('JNDINames', jarray.array([String(dsJNDIName)], String)) - cd('/JDBCSystemResources/' + dsName + '/JDBCResource/' + - dsName + '/JDBCDriverParams/' + dsName) - cmo.setUrl(dsURL) - cmo.setDriverName(dsDriver) - set('Password', dsPassword) - cd('/JDBCSystemResources/' + dsName + '/JDBCResource/' + - dsName + '/JDBCConnectionPoolParams/' + dsName) - cmo.setTestTableName('SQL SELECT 1 FROM DUAL\r\n\r\n') - cd('/JDBCSystemResources/' + dsName + '/JDBCResource/' + dsName + - '/JDBCDriverParams/' + dsName + '/Properties/' + dsName) - cmo.createProperty('user') - cd('/JDBCSystemResources/' + dsName + '/JDBCResource/' + dsName + - '/JDBCDriverParams/' + dsName + '/Properties/' + dsName + '/Properties/user') - cmo.setValue(dsUsername) - cd('/SystemResources/' + dsName) - set('Targets', jarray.array( - [ObjectName('com.bea:Name='+dsTargetName+',Type=Cluster')], ObjectName)) - cd('/JDBCSystemResources/' + dsName + '/JDBCResource/' + - dsName + '/JDBCConnectionPoolParams/' + dsName) - set('MaxCapacity', '300') - save() - activate() - # Restart Managed Server - cd('/') - domainRuntime() - cd('/ServerLifeCycleRuntimes/'+msName) - cmo.forceShutdown() - wait_for_ms_start() - -# Create JMS Module -if jmsModuleName: - # Create List of JMS modules - jmsModuleName = jmsModuleName.split(";") - jmsdescriptorFileName = jmsdescriptorFileName.split(";") - jmsFServerName = jmsFServerName.split(";") - jmsFServerContext = jmsFServerContext.split(";") - jmsFServerDestName = jmsFServerDestName.split(";") - jmsFServerDestLocJNDIName = jmsFServerDestLocJNDIName.split(";") - jmsFServerDestRemJNDIName = jmsFServerDestRemJNDIName.split(";") - jmsFServerFactoryName = jmsFServerFactoryName.split(";") - jmsFServerFactoryLocJNDIName = jmsFServerFactoryLocJNDIName.split(";") - jmsFServerFactoryRemJNDIName = jmsFServerFactoryRemJNDIName.split(";") - jmsremoteConnectionURL = jmsremoteConnectionURL.split(";") - jmsFServerJNDIProperty = jmsFServerJNDIProperty.split(";") - jmsmodule = zip(jmsModuleName, jmsdescriptorFileName, jmsFServerName, jmsFServerContext, jmsFServerJNDIProperty, jmsFServerDestName, jmsFServerDestLocJNDIName, - jmsFServerDestRemJNDIName, jmsFServerFactoryName, jmsFServerFactoryLocJNDIName, jmsFServerFactoryLocJNDIName, jmsFServerFactoryRemJNDIName, jmsremoteConnectionURL) - for jmsModuleName, jmsdescriptorFileName, jmsFServerName, jmsFServerContext, jmsFServerJNDIProperty, jmsFServerDestName, jmsFServerDestLocJNDIName, jmsFServerDestRemJNDIName, jmsFServerFactoryName, jmsFServerFactoryLocJNDIName, jmsFServerFactoryLocJNDIName, jmsFServerFactoryRemJNDIName, jmsremoteConnectionURL in jmsmodule: - print "creating" + jmsModuleName - edit() - startEdit() - # Create JMS Module - cd('/') - cmo.createJMSSystemResource(jmsModuleName, jmsdescriptorFileName) - cd('/SystemResources/'+jmsModuleName) - set('Targets', jarray.array( - [ObjectName('com.bea:Name='+jmsTarget+',Type=Cluster')], ObjectName)) - save() - # Create Foreign Server - print jmsFServerJNDIProperty - cd('/JMSSystemResources/'+jmsModuleName+'/JMSResource/'+jmsModuleName) - cmo.createForeignServer(jmsFServerName) - cd('/JMSSystemResources/'+jmsModuleName+'/JMSResource/' + - jmsModuleName+'/ForeignServers/'+jmsFServerName) - cmo.setDefaultTargetingEnabled(true) - cmo.setInitialContextFactory(jmsFServerContext) - cmo.setConnectionURL(jmsremoteConnectionURL) - cmo.createJNDIProperty('datasource') - cd('/JMSSystemResources/'+jmsModuleName+'/JMSResource/'+jmsModuleName + - '/ForeignServers/'+jmsFServerName+'/JNDIProperties/'+'datasource') - cmo.setValue(jmsFServerJNDIProperty) - # Create Foreign Destination - jmsFServerDestName = jmsFServerDestName.split(",") - jmsFServerDestLocJNDIName = jmsFServerDestLocJNDIName.split(",") - jmsFServerDestRemJNDIName = jmsFServerDestRemJNDIName.split(",") - jmsFSDest = zip(jmsFServerDestName, - jmsFServerDestLocJNDIName, jmsFServerDestRemJNDIName) - for jmsFServerDestName, jmsFServerDestLocJNDIName, jmsFServerDestRemJNDIName in jmsFSDest: - cd('/JMSSystemResources/'+jmsModuleName+'/JMSResource/' + - jmsModuleName+'/ForeignServers/'+jmsFServerName) - FD = cmo.createForeignDestination(jmsFServerDestName) - cd('ForeignDestinations') - FD.setLocalJNDIName(jmsFServerDestLocJNDIName) - FD.setRemoteJNDIName(jmsFServerDestRemJNDIName) - # Create Foreign Connection Factory - cd('/JMSSystemResources/'+jmsModuleName+'/JMSResource/' + - jmsModuleName+'/ForeignServers/'+jmsFServerName) - cmo.createForeignConnectionFactory(jmsFServerFactoryName) - cd('/JMSSystemResources/'+jmsModuleName+'/JMSResource/'+jmsModuleName + - '/ForeignServers/'+jmsFServerName+'/ForeignConnectionFactories/'+jmsFServerFactoryName) - cmo.setLocalJNDIName(jmsFServerFactoryLocJNDIName) - cmo.setRemoteJNDIName(jmsFServerFactoryRemJNDIName) - # Set timeout seconds for Java Transaction API (JTA) - cd('/JTA/NomisDomain/') - cmo.setTimeoutSeconds(1000) - save() - activate() - -# Create App Deployment -if appName: - edit() - startEdit() - progress = deploy(appName, path, target) - progress.printStatus() - save() - activate() - -# Update application plan -if fappName: - edit() - startEdit() - progress = updateApplication(fappName, planpath) - progress.printStatus() - save() - activate() - -# Start Application -if appName: - startApplication(appName) - -disconnect() -exit() diff --git a/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/get_param.py b/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/get_param.py deleted file mode 100644 index 9b9a49700..000000000 --- a/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/get_param.py +++ /dev/null @@ -1,50 +0,0 @@ -#!/usr/bin/python -import getopt -import sys -import socket -from java.io import FileInputStream - - -def usage(): - print('get_param.py -d -n ') - - -def conn(): - try: - connect(url=adminURL, adminServerName=adminServerName) - except ConnectionException, e: - print 'Unable to find admin server' - exit() - - -propInputStream = FileInputStream( - "/home/oracle/admin/scripts/weblogic.properties") -configProps = Properties() -configProps.load(propInputStream) -adminURL = configProps.get("domain.adminurl") -adminServerName = configProps.get("domain.adminServerName") -directory = '' -name = '' - -try: - opts, args = getopt.getopt(sys.argv[1:], "d:n:", ["directory=", "name="]) -except getopt.GetoptError: - usage() - sys.exit(2) -for opt, arg in opts: - if opt in ("-d", "--directory"): - directory = arg - elif opt in ("-n", "--name"): - name = arg - -if not name or not directory: - print('missing param, parameter directory and name must be specified') - print('') - usage() - sys.exit(2) - -conn() -cd(directory) -value = get(name) - -print('Value="' + value + '"') diff --git a/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/ms_state.py b/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/ms_state.py deleted file mode 100644 index c313152dc..000000000 --- a/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/ms_state.py +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/python -import getopt -import sys -import socket -from java.io import FileInputStream - - -def conn(): - try: - connect(url=adminURL, adminServerName=adminServerName) - except ConnectionException, e: - print 'Unable to find admin server' - exit() - - -propInputStream = FileInputStream( - "/home/oracle/admin/scripts/weblogic.properties") -configProps = Properties() -configProps.load(propInputStream) -adminURL = configProps.get("domain.adminurl") -adminServerName = configProps.get("domain.adminServerName") - -conn() -servers = cmo.getServers() -print "-------------------------------------------------------" -print "\t"+cmo.getName()+" domain status" -print "-------------------------------------------------------" -for server in servers: - state(server.getName(), server.getType()) -print "-------------------------------------------------------" diff --git a/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/ms_state.sh b/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/ms_state.sh deleted file mode 100755 index 42a9197fa..000000000 --- a/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/ms_state.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -set -eo pipefail - -main() { - . /u01/app/oracle/Middleware/wlserver_10.3/server/bin/setWLSEnv.sh - . /u01/app/oracle/Middleware/user_projects/domains/NomisDomain/bin/setDomainEnv.sh - timeout 10 /u01/app/oracle/Middleware/wlserver_10.3/common/bin/wlst.sh ~/admin/scripts/ms_state.py -} - -main | grep -vE '^$|^CLASSPATH|^PATH|^Initializing|^Welcome to|^Type help|^Warning: An insecure protocol|^server. To|^Admin port|^Your environment has been set.' diff --git a/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/set_ms_log_rotation.py b/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/set_ms_log_rotation.py deleted file mode 100644 index 49a3df0a7..000000000 --- a/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/set_ms_log_rotation.py +++ /dev/null @@ -1,57 +0,0 @@ -#!/usr/bin/python - -from java.io import FileInputStream -import time -import getopt -import sys -import re - -# Get location of the properties file. -properties = '' -try: - opts, args = getopt.getopt(sys.argv[1:], "p:h::", ["properies="]) -except getopt.GetoptError: - print 'set_ms_log_rotation.py -p ' - sys.exit(2) -for opt, arg in opts: - if opt == '-h': - print 'set_ms_log_rotation.py -p ' - sys.exit() - elif opt in ("-p", "--properties"): - properties = arg -print 'properties=', properties - -# Load the properties from the properties file. - -propInputStream = FileInputStream(properties) -configProps = Properties() -configProps.load(propInputStream) - -# Set all variables from values in properties file. -adminUsername = configProps.get("admin.username") -adminPassword = configProps.get("admin.password") -adminURL = configProps.get("admin.url") -msName = configProps.get("ms.name") - -# Connect to the AdminServer. -connect(adminUsername, adminPassword, adminURL) - -edit() -startEdit() - -# Manage logging. -cd('/Servers/' + msName + '/Log/' + msName) -cmo.setRotationType('bySize') -cmo.setFileMinSize(50000) -cmo.setNumberOfFilesLimited(true) -cmo.setFileCount(10) -cmo.setRedirectStderrToServerLogEnabled(false) -cmo.setRedirectStdoutToServerLogEnabled(false) -cmo.setMemoryBufferSeverity('Debug') -cmo.setLogFileSeverity('Trace') - -save() -activate() - -disconnect() -exit() diff --git a/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/set_param.py b/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/set_param.py deleted file mode 100644 index 89080cbae..000000000 --- a/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/set_param.py +++ /dev/null @@ -1,57 +0,0 @@ -#!/usr/bin/python -import getopt -import sys -import socket -from java.io import FileInputStream - - -def usage(): - print 'set_param.py -d -n -v ' - - -def conn(): - try: - connect(url=adminURL, adminServerName=adminServerName) - except ConnectionException, e: - print 'Unable to find admin server' - exit() - - -propInputStream = FileInputStream( - "/home/oracle/admin/scripts/weblogic.properties") -configProps = Properties() -configProps.load(propInputStream) -adminURL = configProps.get("domain.adminurl") -adminServerName = configProps.get("domain.adminServerName") -directory = '' -name = '' -value = '' - -try: - opts, args = getopt.getopt(sys.argv[1:], "d:n:v:", [ - "directory=", "name=", "value="]) -except getopt.GetoptError: - usage() - sys.exit(2) -for opt, arg in opts: - if opt in ("-d", "--directory"): - directory = arg - elif opt in ("-n", "--name"): - name = arg - elif opt in ("-v", "--value"): - value = arg - -if not name or not value or not directory: - print('missing param, parameter directory, name and value must all be specified') - print('') - usage() - sys.exit(2) - -conn() -edit() -startEdit() -cd('/') -cd(directory) -set(name, value) -save() -activate() diff --git a/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/stopNodeManager.sh b/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/stopNodeManager.sh deleted file mode 100644 index 7cc8fb76a..000000000 --- a/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/stopNodeManager.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash -set -x -# Get details of nodemanager processes - -process_pids1=$(pgrep -u oracle -f "startNodeManager.sh$" 2> /dev/null) -process_pids2=$(pgrep -u oracle -f "weblogic.NodeManager" 2> /dev/null) - -kill -9 $process_pids1 $process_pids2 2> /dev/null diff --git a/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/wait_for_entry_in_log.sh b/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/wait_for_entry_in_log.sh deleted file mode 100755 index 008a989c3..000000000 --- a/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/wait_for_entry_in_log.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash -logfile=$1 -match_pattern=$2 -filter_pattern=$3 -if [[ -z $match_pattern ]]; then - echo "Usage $0 []" >&2 - exit 1 -fi -if [[ ! -e "$logfile" ]]; then - echo "$logfile not found" >&2 - exit 1 -fi -# wait until a matching line found in the log file -# only way I could get this to work was to spawn tail in a subshell -if [[ -z $filter_pattern ]]; then - ( tail -f -n0 "$logfile" & ) | grep -qE "${match_pattern}" -else - ( tail -f -n0 "$logfile" & ) | grep -qE "${filter_pattern}(.*)${match_pattern}" -fi -# kill the tail subshell. It's not so easy to find the pid -pid=$(ps -o pid= -o cmd --forest -g $(ps -o sid= -p $$) | grep -F "tail -f -n0 $logfile" | grep -v grep | cut -d\ -f1) -[[ -n $pid ]] && kill $pid 2> /dev/null diff --git a/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/weblogic.properties b/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/weblogic.properties deleted file mode 100644 index 0beca34a8..000000000 --- a/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/weblogic.properties +++ /dev/null @@ -1,2 +0,0 @@ -domain.adminServerName=AdminServer -domain.adminurl={{ weblogic_domain_hostname }}:7001 diff --git a/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/weblogicControl.py b/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/weblogicControl.py deleted file mode 100644 index 42b77f48b..000000000 --- a/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/weblogicControl.py +++ /dev/null @@ -1,130 +0,0 @@ -# --------------------------------------------------------- -# Check the status of all WL instances including the admin -# --------------------------------------------------------- -import sys -from java.io import FileInputStream - -propInputStream = FileInputStream( - "/home/oracle/admin/scripts/weblogic.properties") -configProps = Properties() -configProps.load(propInputStream) -domainName = configProps.get("domain.name") -domainHome = configProps.get("domain.home") -wlConfigFile = configProps.get("domain.configfile") -wlKeyFile = configProps.get("domain.keyfile") -nmConfigFile = configProps.get("nm.configfile") -nmKeyFile = configProps.get("nm.keyfile") -nmHome = configProps.get("nm.home") -nmPort = configProps.get("nm.port") -nmMachines = configProps.get("nm.host") -adminUrl = configProps.get("domain.adminurl") -adminServerName = configProps.get("domain.adminServerName") - - -def conn(): - try: - connect(userConfigFile=wlConfigFile, - userKeyFile=wlKeyFile, url=adminUrl) - except ConnectionException, e: - print 'Unable to find admin server' - exit() - - -def ServerState(server): - if server != 'wls': - nmConnect(userConfigFile=nmConfigFile, userKeyFile=nmKeyFile, port=nmPort, - host=nmMachines, domainName=domainName, domainDir=domainHome, nmType='Plain') - nmServerStatus(server) - exit() - else: - conn() - serverNames = cmo.getServers() - domainRuntime() - print 'Fetching state of every WebLogic instance' - print '' - for name in serverNames: - cd("/ServerLifeCycleRuntimes/" + name.getName()) - serverState = cmo.getState() - print '%-20s' % (name.getName()) + serverState - disconnect() - exit() - - -def nmConn(machine): - try: - nmConnect(userConfigFile=nmConfigFile, userKeyFile=nmKeyFile, port=nmPort, - host=nmMachines, domainName=domainName, domainDir=domainHome, nmType='Plain') - status = "SUCCESS" - except ConnectionException, e: - status = "FAILED" - print 'Nodemanager Connection: ' + status - - -def nmStartNM(machine): - try: - nmConnect(userConfigFile=nmConfigFile, userKeyFile=nmKeyFile, port=nmPort, - host=nmMachines, domainName=domainName, domainDir=domainHome, nmType='Plain') - print 'Nodemanager already running' - - except: - print 'start nodemaneger except' - startNodeManager(verbose='false', NodeManagerHome=nmHome, - ListenPort=nmPort, ListenAddress=nmMachines) - - -def nmStop(): - try: - nmConnect(userConfigFile=nmConfigFile, userKeyFile=nmKeyFile, port=nmPort, - host=nmMachines, domainName=domainName, domainDir=domainHome, nmType='Plain') - stopNodeManager() - print 'Stopped nodemanager' - except: - print 'Reached exception for nmstop' - - -def nmStartAS(): - try: - nmStart(adminServerName) - except: - print 'Issues starting admin server' - - -if __name__ == "main": - action = sys.argv[1] - module = sys.argv[2] - if action == 'status': - if module == 'nm': - nmConn(nmMachines) - exit() - elif module == 'wls': - ServerState(module) - elif module == 'as': - ServerState(adminServerName) - elif action == 'stop': - if module == 'as': - conn() - shutdown(adminServerName, 'Server', 'true', 0, block='true') - disconnect() - exit() - elif module == 'ms': - msname = sys.argv[3] - nmConn(nmMachines) - nmKill(msname) - exit() - elif module == 'nm': - nmStop() - exit() - elif action == 'start': - if module == 'ms': - msname = sys.argv[3] - nmConn(nmMachines) - nmStart(msname) - exit() - elif module == 'nm': - print nmMachines - nmStartNM(nmMachines) - exit() - elif module == 'as': - nmConn(nmMachines) - nmStartAS() - exit() diff --git a/ansible/roles/oasys-bip/templates/10.3/u01/software/weblogic/AdminServer.properties b/ansible/roles/oasys-bip/templates/10.3/u01/software/weblogic/AdminServer.properties deleted file mode 100644 index 9976e6d1f..000000000 --- a/ansible/roles/oasys-bip/templates/10.3/u01/software/weblogic/AdminServer.properties +++ /dev/null @@ -1,7 +0,0 @@ -# AdminServer connection details. -admin.username={{ weblogic_admin_username }} -admin.password={{ weblogic_admin_password }} -admin.url={{ weblogic_domain_hostname }}:7001 - -# Managed Server -ms.name=AdminServer \ No newline at end of file diff --git a/ansible/roles/oasys-bip/templates/10.3/u01/software/weblogic/WLS_XTAG_OUTBOUND_01.properties b/ansible/roles/oasys-bip/templates/10.3/u01/software/weblogic/WLS_XTAG_OUTBOUND_01.properties deleted file mode 100644 index 1cd4a7e88..000000000 --- a/ansible/roles/oasys-bip/templates/10.3/u01/software/weblogic/WLS_XTAG_OUTBOUND_01.properties +++ /dev/null @@ -1,46 +0,0 @@ -# AdminServer Connection - -admin.username={{ weblogic_admin_username }} -admin.password={{ weblogic_admin_password }} -admin.url={{ weblogic_domain_hostname }}:7001 - -# Cluster -cluster.name=cluster_xtag_outbound - -# Managed Server -ms.name=WLS_XTAG_OUTBOUND_01 -ms.address={{ weblogic_domain_hostname }} -ms.port=9001 -ms.cluster=cluster_xtag_outbound -ms.startarg=-Xms1024m -Xmx1024m -XX:MaxPermSize=512m - -# Database Config (Used for Data Sources) -ds.username={{ weblogic_db_username }} -ds.password={{ weblogic_db_password }} -ds.url=jdbc:oracle:thin:@(DESCRIPTION = (ADDRESS = (HOST = {{ weblogic_db_hostname_a }}) (protocol = tcp) (port = 1521))(ADDRESS = (HOST = {{ weblogic_db_hostname_b }}) (protocol = tcp) (port = 1521))(FAILOVER = YES)(CONNECT_DATA = (SERVICE_NAME = NOMIS_TAF)(FAILOVER_MODE = (TYPE = SELECT)(METHOD = BASIC)))) -ds.driver=oracle.jdbc.xa.client.OracleXADataSource - -# Data Sources (To configure additional DS resources, separate variables with comma e.g. ds.name=ds_1,ds_2) -ds.name=xTAGDS -ds.jndi.name=jdbc/xTAGDS -ds.target.name=cluster_xtag_outbound - -# Deployment -app.name=xtagoutbound -app.path=/u01/tag/xtag/deploy/xtagoutbound.ear -app.target=cluster_xtag_outbound - -# JMS Module -jms.module.name=xTAG_AQModule;xTAG_TIBCOModule -jms.descriptorFile.name=jms/xTAG_AQModule-jms.xml;jms/xTAG_TIBCOModule-jms.xml -jms.target=cluster_xtag_outbound -jms.fserver.name=xTAG_AQForeignServer;xTAG_TIBCOForeignServer -jms.fserver.context=oracle.jms.AQjmsInitialContextFactory;com.tibco.tibjms.naming.TibjmsInitialContextFactory -jms.fserver.jndiproperty=jdbc/xTAGDS; -jms.fserver.remoteconnectionurl=;tibjmsnaming://{{ ndh_ems_server }}:7222 -jms.fserver.destination.name=XTAG_OUT,XTAG_STALE,XTAG_UPD_OFFENDERS;NDH.NomisEvent,NDH.Reply,NDH.Request -jms.fserver.destination.local.jndi.name=jms/aq/XTAG_OUT,jms/aq/XTAG_STALE,jms/aq/NOMIS.OffUpdates;jms/tibco/NDH.NomisEvent,jms/tibco/NDH.Reply,jms/tibco/NDH.Request -jms.fserver.destination.remote.jndi.name=Queues/XTAG_OUT,Queues/XTAG_STALE,Queues/XTAG_UPD_OFFENDERS;NDH.NomisOutbound.Events,NDH.OffenderDetails.Reply,NDH.OffenderDetails.Request -jms.fserver.factory.name=xTAG_AQConnectionFactory;xTAG_TIBCOConnectionFactory -jms.fserver.factory.local.jndi.name=jms/aq/xTAG_AQConnectionFactory;jms/tibco/xTAG_TIBCOConnectionFactory -jms.fserver.factory.remote.jndi.name=XAQueueConnectionFactory;FTQueueConnectionFactory diff --git a/ansible/roles/oasys-bip/templates/10.3/u01/software/weblogic/domain.properties b/ansible/roles/oasys-bip/templates/10.3/u01/software/weblogic/domain.properties deleted file mode 100644 index 45d64e651..000000000 --- a/ansible/roles/oasys-bip/templates/10.3/u01/software/weblogic/domain.properties +++ /dev/null @@ -1,15 +0,0 @@ -# Paths -path.middleware={{ middleware_home }} -path.wls={{ wl_home }} -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.address={{ weblogic_domain_hostname }} - -# Domain details -domain.name={{ domain_name }} -machine={{ weblogic_domain_hostname }} diff --git a/ansible/roles/oasys-bip/templates/bip_password.tmp.j2 b/ansible/roles/oasys-bip/templates/bip_password.tmp.j2 index e970c7c6a..4b43e3d1b 100644 --- a/ansible/roles/oasys-bip/templates/bip_password.tmp.j2 +++ b/ansible/roles/oasys-bip/templates/bip_password.tmp.j2 @@ -1,3 +1,3 @@ -{{ syspassword }} -{{ biplatformpassword }} -{{ mdspassword }} \ No newline at end of file +{{ bipdb_sys_password }} +{{ bipdb_biplatform_password }} +{{ bipdb_mds_password }} \ No newline at end of file diff --git a/ansible/roles/oasys-bip/templates/10.3/u01/app/oracle/Middleware/user_projects/domains/NomisDomain/servers/AdminServer/security/boot.properties b/ansible/roles/oasys-bip/templates/boot.properties.j2 similarity index 100% rename from ansible/roles/oasys-bip/templates/10.3/u01/app/oracle/Middleware/user_projects/domains/NomisDomain/servers/AdminServer/security/boot.properties rename to ansible/roles/oasys-bip/templates/boot.properties.j2 diff --git a/ansible/roles/oasys-bip/templates/oraInst.loc.j2 b/ansible/roles/oasys-bip/templates/oraInst.loc.j2 index 0705bb545..637f300d7 100644 --- a/ansible/roles/oasys-bip/templates/oraInst.loc.j2 +++ b/ansible/roles/oasys-bip/templates/oraInst.loc.j2 @@ -1,2 +1,2 @@ inventory_loc=/u01/app/oraInventory -inst_group=oinstall \ No newline at end of file +inst_group={{ oracle_install_group }} \ No newline at end of file diff --git a/ansible/roles/oasys-bip/templates/10.3/u01/software/weblogic/silent.xml b/ansible/roles/oasys-bip/templates/silent.xml.j2 similarity index 100% rename from ansible/roles/oasys-bip/templates/10.3/u01/software/weblogic/silent.xml rename to ansible/roles/oasys-bip/templates/silent.xml.j2 From 51eb497b6ddbf5669e125e2cc3bdbe06ad883be9 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Fri, 1 Sep 2023 09:26:05 +0000 Subject: [PATCH 05/19] Commit changes made by code formatters --- .../environment_name_oasys_test.yml | 28 +++++++++---------- ansible/roles/oasys-bip/defaults/main.yml | 6 ++-- .../roles/oasys-bip/tasks/get-db-facts.yml | 10 +++---- ansible/roles/oasys-bip/tasks/main.yml | 3 +- ansible/roles/oasys-bip/tasks/rcu.yml | 2 +- 5 files changed, 23 insertions(+), 26 deletions(-) diff --git a/ansible/group_vars/environment_name_oasys_test.yml b/ansible/group_vars/environment_name_oasys_test.yml index 1c372c678..5fb2cc767 100644 --- a/ansible/group_vars/environment_name_oasys_test.yml +++ b/ansible/group_vars/environment_name_oasys_test.yml @@ -207,19 +207,19 @@ db_configs: T2BIPINF: parameters: - - { name: "_allow_insert_with_update_check", value: TRUE, db_restart_required: 0, scope: both } - - { name: session_cached_cursors, value: 300, db_restart_required: 0, scope: spfile } - - { name: processes, value: 500, db_restart_required: 1, scope: spfile } - - { name: pga_aggregate_target, value: 800M, db_restart_required: 0, scope: both } - - { name: db_recovery_file_dest_size, value: 40G, db_restart_required: 0, scope: both } - - { name: shared_pool_size, value: 300M, db_restart_required: 0, scope: both } - - { name: open_cursors, value: 800, db_restart_required: 0, scope: both } - - { name: db_files, value: 600, db_restart_required: 0, scope: both } - - { - name: log_archive_dest_1, - value: '"''location=use_db_recovery_file_dest valid_for=(all_logfiles,all_roles) db_unique_name=emrep''"', - db_restart_required: 0, - scope: both, - } + - { name: "_allow_insert_with_update_check", value: TRUE, db_restart_required: 0, scope: both } + - { name: session_cached_cursors, value: 300, db_restart_required: 0, scope: spfile } + - { name: processes, value: 500, db_restart_required: 1, scope: spfile } + - { name: pga_aggregate_target, value: 800M, db_restart_required: 0, scope: both } + - { name: db_recovery_file_dest_size, value: 40G, db_restart_required: 0, scope: both } + - { name: shared_pool_size, value: 300M, db_restart_required: 0, scope: both } + - { name: open_cursors, value: 800, db_restart_required: 0, scope: both } + - { name: db_files, value: 600, db_restart_required: 0, scope: both } + - { + name: log_archive_dest_1, + value: '"''location=use_db_recovery_file_dest valid_for=(all_logfiles,all_roles) db_unique_name=emrep''"', + db_restart_required: 0, + scope: both, + } service: - { name: BIPINF_TAF, role: PRIMARY } diff --git a/ansible/roles/oasys-bip/defaults/main.yml b/ansible/roles/oasys-bip/defaults/main.yml index f9127e0ec..165217ca4 100644 --- a/ansible/roles/oasys-bip/defaults/main.yml +++ b/ansible/roles/oasys-bip/defaults/main.yml @@ -5,9 +5,9 @@ weblogic_servername: "{{ ansible_facts.hostname }}" middleware_home: /u01/app/oracle/Middleware wl_home: /u01/app/oracle/Middleware/wlserver_10.3 stage: /u01/stage -bip_db_server: 10.26.12.211 #should be part of ec2 instance tag -bip_db_name: T2BIPINF #should be part of ec2 instance tag +bip_db_server: 10.26.12.211 #should be part of ec2 instance tag +bip_db_name: T2BIPINF #should be part of ec2 instance tag oracle_install_user: oracle oracle_install_group: oinstall domain_name: bifoundation_domain -domain_home: /u01/app/oracle/Middleware/user_projects/domains \ No newline at end of file +domain_home: /u01/app/oracle/Middleware/user_projects/domains diff --git a/ansible/roles/oasys-bip/tasks/get-db-facts.yml b/ansible/roles/oasys-bip/tasks/get-db-facts.yml index 02440b9c5..15e9834cb 100644 --- a/ansible/roles/oasys-bip/tasks/get-db-facts.yml +++ b/ansible/roles/oasys-bip/tasks/get-db-facts.yml @@ -3,13 +3,13 @@ set_fact: server_name: '{{ ec2.tags["server-name"] }}' -- name: Extract environment from server name +- name: Extract environment from server name set_fact: - environment_name: '{{ server_name[:2] | upper }}' + environment_name: "{{ server_name[:2] | upper }}" -- name: Set database name +- name: Set database name set_fact: - db_name: '{{ environment_name }}BIPINF' + db_name: "{{ environment_name }}BIPINF" - name: Fail if missing parameters fail: @@ -41,5 +41,3 @@ fail: msg: Ensure all required parameters are set when: not db_all_variables_set|default(false) - - diff --git a/ansible/roles/oasys-bip/tasks/main.yml b/ansible/roles/oasys-bip/tasks/main.yml index 6a6a07f95..cdb6faa01 100644 --- a/ansible/roles/oasys-bip/tasks/main.yml +++ b/ansible/roles/oasys-bip/tasks/main.yml @@ -69,7 +69,7 @@ tags: - amibuild - ec2provision - - certificate_fix + - certificate_fix - import_tasks: rcu.yml tags: @@ -88,4 +88,3 @@ tags: - bip_db_create - never - diff --git a/ansible/roles/oasys-bip/tasks/rcu.yml b/ansible/roles/oasys-bip/tasks/rcu.yml index 4a64224bb..f4b152af5 100644 --- a/ansible/roles/oasys-bip/tasks/rcu.yml +++ b/ansible/roles/oasys-bip/tasks/rcu.yml @@ -48,4 +48,4 @@ main 2>&1 | logger -p local3.info -t ansible-bip-repository async: 86400 poll: 60 - when: not ansible_check_mode \ No newline at end of file + when: not ansible_check_mode From 0c976dac15bfc80d83f848b17ad1dbeb2e0c2f56 Mon Sep 17 00:00:00 2001 From: sandhya Gandalwar Date: Thu, 21 Sep 2023 10:00:48 +0100 Subject: [PATCH 06/19] Updated for testing --- .../roles/oasys-bip/tasks/certificate-fix.yml | 268 +++++++++--------- ansible/roles/oasys-bip/tasks/main.yml | 10 +- .../roles/oasys-bip/tasks/patch-weblogic.yml | 2 +- ansible/roles/oasys-bip/tasks/rcu.yml | 2 +- 4 files changed, 141 insertions(+), 141 deletions(-) diff --git a/ansible/roles/oasys-bip/tasks/certificate-fix.yml b/ansible/roles/oasys-bip/tasks/certificate-fix.yml index 711aca525..14e4670ff 100644 --- a/ansible/roles/oasys-bip/tasks/certificate-fix.yml +++ b/ansible/roles/oasys-bip/tasks/certificate-fix.yml @@ -1,168 +1,168 @@ --- -# - name: Start nodemanager +- name: Start nodemanager + become_user: oracle + ansible.builtin.shell: | + set -eo pipefail + . ~/.bash_profile + . $WL_HOME/server/bin/setWLSEnv.sh + nohup {{ wl_home }}/server/bin/startNodeManager.sh & + +- name: Create cert fix directory + ansible.builtin.file: + path: /home/oracle/.certificate-fix + state: directory + owner: oracle + group: oinstall + mode: "0755" + +- name: Check weblogic cert + ansible.builtin.stat: + path: /home/oracle/.certificate-fix/demokey.pem + register: weblogic_cert + +- name: Create weblogic keystore cert if not present + become_user: oracle + args: + chdir: /home/oracle/.certificate-fix + ansible.builtin.shell: | + set -eo pipefail + . ~/.bash_profile + . $WL_HOME/server/bin/setWLSEnv.sh + main() { + echo "# Generating democert" + java utils.CertGen -keyfilepass DemoIdentityPassPhrase -certfile democert -keyfile demokey -strength 1024 + } + main 2>&1 | logger -p local3.info -t ansible-weblogic + when: not weblogic_cert.stat.exists + +- name: List weblogic keystore certs + become_user: oracle + args: + chdir: /home/oracle/.certificate-fix + check_mode: false + changed_when: false + ansible.builtin.shell: | + set -eo pipefail + . ~/.bash_profile > /dev/null + . $WL_HOME/server/bin/setWLSEnv.sh > /dev/null + keytool -list -v -keystore DemoIdentity.jks -storepass DemoIdentityKeyStorePassPhrase || true + register: weblogic_keystore_list + +- name: Import weblogic keystore cert if not present + become_user: oracle + args: + chdir: /home/oracle/.certificate-fix + ansible.builtin.shell: | + set -eo pipefail + . ~/.bash_profile + . $WL_HOME/server/bin/setWLSEnv.sh + main() { + echo "# Importing cert into KeyStore" + java utils.ImportPrivateKey -keystore DemoIdentity.jks -storepass DemoIdentityKeyStorePassPhrase -keyfile demokey.pem -keyfilepass DemoIdentityPassPhrase -certfile democert.pem -alias demoidentity + keytool -importcert -trustcacerts -alias wlscertgenca -keystore DemoTrust.jks -storepass DemoTrustKeyStorePassPhrase -file /u01/app/oracle/Middleware/wlserver_10.3/server/lib/CertGenCA.der -noprompt + } + main 2>&1 | logger -p local3.info -t ansible-weblogic + +- name: Disable SecureListener in nodemanager.properties + ansible.builtin.replace: + path: "{{ wl_home }}/common/nodemanager/nodemanager.properties" + regexp: "SecureListener=true" + replace: "SecureListener=false" + +# - name: Stop Admin server # become_user: oracle # ansible.builtin.shell: | # set -eo pipefail # . ~/.bash_profile # . $WL_HOME/server/bin/setWLSEnv.sh -# nohup {{ wl_home }}/server/bin/startNodeManager.sh & +# "{{ domain_home }}/{{ domain_name }}/bin/stopWebLogic.sh" -# - name: Create cert fix directory -# ansible.builtin.file: -# path: /home/oracle/.certificate-fix -# state: directory -# owner: oracle -# group: oinstall -# mode: "0755" +- name: Stop nodemanager processes + become_user: oracle + ansible.builtin.shell: | + ps -fu oracle | grep "weblogic.NodeManager"| grep -v grep | gawk '{print $2}' | xargs kill -9 -# - name: Check weblogic cert -# ansible.builtin.stat: -# path: /home/oracle/.certificate-fix/demokey.pem -# register: weblogic_cert +# - name: Start nodemanager +# become_user: oracle +# ansible.builtin.shell: | +# set -eo pipefail +# . ~/.bash_profile +# . $WL_HOME/server/bin/setWLSEnv.sh +# nohup {{ wl_home }}/server/bin/startNodeManager.sh & -# - name: Create weblogic keystore cert if not present +# - name: Start adminserver # become_user: oracle -# args: -# chdir: /home/oracle/.certificate-fix # ansible.builtin.shell: | # set -eo pipefail # . ~/.bash_profile # . $WL_HOME/server/bin/setWLSEnv.sh -# main() { -# echo "# Generating democert" -# java utils.CertGen -keyfilepass DemoIdentityPassPhrase -certfile democert -keyfile demokey -strength 1024 -# } -# main 2>&1 | logger -p local3.info -t ansible-weblogic -# when: not weblogic_cert.stat.exists - -# - name: List weblogic keystore certs +# nohup {{ domain_home }}/{{ domain_name }}/bin/startWebLogic.sh & +# async: 3600 +# poll: 60 + +# # Node manager and weblogic server for this to work +# - name: Query current NMType # become_user: oracle -# args: -# chdir: /home/oracle/.certificate-fix +# ansible.builtin.shell: | +# set -eo pipefail +# . ~/.bash_profile > /dev/null +# . $WL_HOME/server/bin/setWLSEnv.sh > /dev/null +# . {{ domain_home }}/{{ domain_name }}/bin/setDomainEnv.sh > /dev/null +# wlst.sh ~/admin/scripts/get_param.py -d /Machines/{{ weblogic_domain_hostname }}/NodeManager/{{ weblogic_domain_hostname }} -n NMType # check_mode: false # changed_when: false +# register: weblogic_nmtype_raw + +# - name: Get current NMType +# set_fact: +# weblogic_nmtype: "{{ weblogic_nmtype_raw.stdout | regex_search(regexp,'\\1') }}" +# vars: +# regexp: 'Value=\"([^"]+)' +# failed_when: weblogic_nmtype|length == 0 + +# - debug: +# msg: "Current NMType: {{ weblogic_nmtype }}" + +# - name: Set NMType +# become_user: oracle # ansible.builtin.shell: | # set -eo pipefail # . ~/.bash_profile > /dev/null # . $WL_HOME/server/bin/setWLSEnv.sh > /dev/null -# keytool -list -v -keystore DemoIdentity.jks -storepass DemoIdentityKeyStorePassPhrase || true -# register: weblogic_keystore_list +# . {{ domain_home }}/{{ domain_name }}/bin/setDomainEnv.sh > /dev/null +# wlst.sh ~/admin/scripts/set_param.py -d /Machines/{{ weblogic_domain_hostname }}/NodeManager/{{ weblogic_domain_hostname }} -n NMType -v Plain +# wlst.sh ~/admin/scripts/set_param.py -d /Machines/{{ weblogic_domain_hostname }}/NodeManager/{{ weblogic_domain_hostname }} -n ListenAddress -v {{ weblogic_domain_hostname }} +# wlst.sh ~/admin/scripts/set_param.py -d /SecurityConfiguration/NomisDomain -n NodeManagerUsername -v {{ weblogic_admin_username }} +# wlst.sh ~/admin/scripts/set_param.py -d /SecurityConfiguration/NomisDomain -n NodeManagerPassword -v {{ weblogic_admin_password }} +# when: weblogic_nmtype != 'Plain' -# - name: Import weblogic keystore cert if not present +# - name: Stop Admin server # become_user: oracle -# args: -# chdir: /home/oracle/.certificate-fix # ansible.builtin.shell: | # set -eo pipefail # . ~/.bash_profile # . $WL_HOME/server/bin/setWLSEnv.sh -# main() { -# echo "# Importing cert into KeyStore" -# java utils.ImportPrivateKey -keystore DemoIdentity.jks -storepass DemoIdentityKeyStorePassPhrase -keyfile demokey.pem -keyfilepass DemoIdentityPassPhrase -certfile democert.pem -alias demoidentity -# keytool -importcert -trustcacerts -alias wlscertgenca -keystore DemoTrust.jks -storepass DemoTrustKeyStorePassPhrase -file /u01/app/oracle/Middleware/wlserver_10.3/server/lib/CertGenCA.der -noprompt -# } -# main 2>&1 | logger -p local3.info -t ansible-weblogic - -# - name: Disable SecureListener in nodemanager.properties -# ansible.builtin.replace: -# path: "{{ wl_home }}/common/nodemanager/nodemanager.properties" -# regexp: "SecureListener=true" -# replace: "SecureListener=false" +# {{ domain_home }}/{{ domain_name }}/bin/stopWebLogic.sh -# - name: Stop Admin server +# - name: Stop nodemanager processes +# become_user: oracle +# ansible.builtin.shell: | +# ps -fu oracle | grep "weblogic.NodeManager"| grep -v grep | gawk '{print $2}' | xargs kill -9 + +# - name: Start nodemanager # become_user: oracle # ansible.builtin.shell: | # set -eo pipefail # . ~/.bash_profile # . $WL_HOME/server/bin/setWLSEnv.sh -# "{{ domain_home }}/{{ domain_name }}/bin/stopWebLogic.sh" - -- name: Stop nodemanager processes - become_user: oracle - ansible.builtin.shell: | - ps -fu oracle | grep "weblogic.NodeManager"| grep -v grep | gawk '{print $2}' | xargs kill -9 - -- name: Start nodemanager - become_user: oracle - ansible.builtin.shell: | - set -eo pipefail - . ~/.bash_profile - . $WL_HOME/server/bin/setWLSEnv.sh - nohup {{ wl_home }}/server/bin/startNodeManager.sh & - -- name: Start adminserver - become_user: oracle - ansible.builtin.shell: | - set -eo pipefail - . ~/.bash_profile - . $WL_HOME/server/bin/setWLSEnv.sh - nohup {{ domain_home }}/{{ domain_name }}/bin/startWebLogic.sh & - async: 3600 - poll: 60 - -# Node manager and weblogic server for this to work -- name: Query current NMType - become_user: oracle - ansible.builtin.shell: | - set -eo pipefail - . ~/.bash_profile > /dev/null - . $WL_HOME/server/bin/setWLSEnv.sh > /dev/null - . {{ domain_home }}/{{ domain_name }}/bin/setDomainEnv.sh > /dev/null - wlst.sh ~/admin/scripts/get_param.py -d /Machines/{{ weblogic_domain_hostname }}/NodeManager/{{ weblogic_domain_hostname }} -n NMType - check_mode: false - changed_when: false - register: weblogic_nmtype_raw - -- name: Get current NMType - set_fact: - weblogic_nmtype: "{{ weblogic_nmtype_raw.stdout | regex_search(regexp,'\\1') }}" - vars: - regexp: 'Value=\"([^"]+)' - failed_when: weblogic_nmtype|length == 0 - -- debug: - msg: "Current NMType: {{ weblogic_nmtype }}" - -- name: Set NMType - become_user: oracle - ansible.builtin.shell: | - set -eo pipefail - . ~/.bash_profile > /dev/null - . $WL_HOME/server/bin/setWLSEnv.sh > /dev/null - . {{ domain_home }}/{{ domain_name }}/bin/setDomainEnv.sh > /dev/null - wlst.sh ~/admin/scripts/set_param.py -d /Machines/{{ weblogic_domain_hostname }}/NodeManager/{{ weblogic_domain_hostname }} -n NMType -v Plain - wlst.sh ~/admin/scripts/set_param.py -d /Machines/{{ weblogic_domain_hostname }}/NodeManager/{{ weblogic_domain_hostname }} -n ListenAddress -v {{ weblogic_domain_hostname }} - wlst.sh ~/admin/scripts/set_param.py -d /SecurityConfiguration/NomisDomain -n NodeManagerUsername -v {{ weblogic_admin_username }} - wlst.sh ~/admin/scripts/set_param.py -d /SecurityConfiguration/NomisDomain -n NodeManagerPassword -v {{ weblogic_admin_password }} - when: weblogic_nmtype != 'Plain' - -- name: Stop Admin server - become_user: oracle - ansible.builtin.shell: | - set -eo pipefail - . ~/.bash_profile - . $WL_HOME/server/bin/setWLSEnv.sh - {{ domain_home }}/{{ domain_name }}/bin/stopWebLogic.sh - -- name: Stop nodemanager processes - become_user: oracle - ansible.builtin.shell: | - ps -fu oracle | grep "weblogic.NodeManager"| grep -v grep | gawk '{print $2}' | xargs kill -9 - -- name: Start nodemanager - become_user: oracle - ansible.builtin.shell: | - set -eo pipefail - . ~/.bash_profile - . $WL_HOME/server/bin/setWLSEnv.sh - nohup {{ wl_home }}/server/bin/startNodeManager.sh & +# nohup {{ wl_home }}/server/bin/startNodeManager.sh & -- name: Start adminserver - become_user: oracle - ansible.builtin.shell: | - set -eo pipefail - . ~/.bash_profile - . $WL_HOME/server/bin/setWLSEnv.sh - nohup {{ domain_home }}/{{ domain_name }}/bin/startWebLogic.sh & - async: 3600 - poll: 60 +# - name: Start adminserver +# become_user: oracle +# ansible.builtin.shell: | +# set -eo pipefail +# . ~/.bash_profile +# . $WL_HOME/server/bin/setWLSEnv.sh +# nohup {{ domain_home }}/{{ domain_name }}/bin/startWebLogic.sh & +# async: 3600 +# poll: 60 diff --git a/ansible/roles/oasys-bip/tasks/main.yml b/ansible/roles/oasys-bip/tasks/main.yml index cdb6faa01..f99d3c4f8 100644 --- a/ansible/roles/oasys-bip/tasks/main.yml +++ b/ansible/roles/oasys-bip/tasks/main.yml @@ -65,11 +65,11 @@ - ec2provision - weblogic_patch_2 - - import_tasks: certificate-fix.yml - tags: - - amibuild - - ec2provision - - certificate_fix + # - import_tasks: certificate-fix.yml + # tags: + # - amibuild + # - ec2provision + # - certificate_fix - import_tasks: rcu.yml tags: diff --git a/ansible/roles/oasys-bip/tasks/patch-weblogic.yml b/ansible/roles/oasys-bip/tasks/patch-weblogic.yml index 131b2402a..b9e8a3a71 100644 --- a/ansible/roles/oasys-bip/tasks/patch-weblogic.yml +++ b/ansible/roles/oasys-bip/tasks/patch-weblogic.yml @@ -33,7 +33,7 @@ - "{{ weblogic_patch_filename }}" # takes forever so run in async mode to prevent connection timeouts - - name: Run weblogic patch script which takes approx 20 mins + - name: Run weblogic patch {{ weblogic_patch_id }} which takes approx 20 mins become_user: "{{ oracle_install_user }}" ansible.builtin.shell: | set -eo pipefail diff --git a/ansible/roles/oasys-bip/tasks/rcu.yml b/ansible/roles/oasys-bip/tasks/rcu.yml index f4b152af5..8f12d6e6f 100644 --- a/ansible/roles/oasys-bip/tasks/rcu.yml +++ b/ansible/roles/oasys-bip/tasks/rcu.yml @@ -34,7 +34,7 @@ owner: oracle group: oinstall -- name: Create BIP database +- name: Create BIP repository become_user: oracle ansible.builtin.shell: | set -eo pipefail From b75377b93711cb7f35ecda2b9b1718bb7fe77199 Mon Sep 17 00:00:00 2001 From: sandhya Gandalwar Date: Mon, 16 Oct 2023 13:17:52 +0100 Subject: [PATCH 07/19] added templates for bip cloning --- .../roles/oasys-bip/tasks/certificate-fix.yml | 168 ------ .../oasys-bip/tasks/clone_bip_software.yml | 33 ++ .../oasys-bip/tasks/create-managed-app.yml | 126 ---- .../oasys-bip/tasks/create-xtag-domain.yml | 63 -- .../oasys-bip/tasks/extract-s3-archive.yml | 45 -- .../roles/oasys-bip/tasks/install-server.yml | 73 --- ansible/roles/oasys-bip/tasks/main.yml | 30 +- .../roles/oasys-bip/tasks/patch-weblogic.yml | 50 -- .../templates/bi_config_moveplan.xml | 557 ++++++++++++++++++ .../roles/oasys-bip/templates/nm_moveplan.xml | 124 ++++ 10 files changed, 717 insertions(+), 552 deletions(-) delete mode 100644 ansible/roles/oasys-bip/tasks/certificate-fix.yml create mode 100644 ansible/roles/oasys-bip/tasks/clone_bip_software.yml delete mode 100644 ansible/roles/oasys-bip/tasks/create-managed-app.yml delete mode 100644 ansible/roles/oasys-bip/tasks/create-xtag-domain.yml delete mode 100644 ansible/roles/oasys-bip/tasks/extract-s3-archive.yml delete mode 100644 ansible/roles/oasys-bip/tasks/install-server.yml delete mode 100644 ansible/roles/oasys-bip/tasks/patch-weblogic.yml create mode 100644 ansible/roles/oasys-bip/templates/bi_config_moveplan.xml create mode 100644 ansible/roles/oasys-bip/templates/nm_moveplan.xml diff --git a/ansible/roles/oasys-bip/tasks/certificate-fix.yml b/ansible/roles/oasys-bip/tasks/certificate-fix.yml deleted file mode 100644 index 14e4670ff..000000000 --- a/ansible/roles/oasys-bip/tasks/certificate-fix.yml +++ /dev/null @@ -1,168 +0,0 @@ ---- -- name: Start nodemanager - become_user: oracle - ansible.builtin.shell: | - set -eo pipefail - . ~/.bash_profile - . $WL_HOME/server/bin/setWLSEnv.sh - nohup {{ wl_home }}/server/bin/startNodeManager.sh & - -- name: Create cert fix directory - ansible.builtin.file: - path: /home/oracle/.certificate-fix - state: directory - owner: oracle - group: oinstall - mode: "0755" - -- name: Check weblogic cert - ansible.builtin.stat: - path: /home/oracle/.certificate-fix/demokey.pem - register: weblogic_cert - -- name: Create weblogic keystore cert if not present - become_user: oracle - args: - chdir: /home/oracle/.certificate-fix - ansible.builtin.shell: | - set -eo pipefail - . ~/.bash_profile - . $WL_HOME/server/bin/setWLSEnv.sh - main() { - echo "# Generating democert" - java utils.CertGen -keyfilepass DemoIdentityPassPhrase -certfile democert -keyfile demokey -strength 1024 - } - main 2>&1 | logger -p local3.info -t ansible-weblogic - when: not weblogic_cert.stat.exists - -- name: List weblogic keystore certs - become_user: oracle - args: - chdir: /home/oracle/.certificate-fix - check_mode: false - changed_when: false - ansible.builtin.shell: | - set -eo pipefail - . ~/.bash_profile > /dev/null - . $WL_HOME/server/bin/setWLSEnv.sh > /dev/null - keytool -list -v -keystore DemoIdentity.jks -storepass DemoIdentityKeyStorePassPhrase || true - register: weblogic_keystore_list - -- name: Import weblogic keystore cert if not present - become_user: oracle - args: - chdir: /home/oracle/.certificate-fix - ansible.builtin.shell: | - set -eo pipefail - . ~/.bash_profile - . $WL_HOME/server/bin/setWLSEnv.sh - main() { - echo "# Importing cert into KeyStore" - java utils.ImportPrivateKey -keystore DemoIdentity.jks -storepass DemoIdentityKeyStorePassPhrase -keyfile demokey.pem -keyfilepass DemoIdentityPassPhrase -certfile democert.pem -alias demoidentity - keytool -importcert -trustcacerts -alias wlscertgenca -keystore DemoTrust.jks -storepass DemoTrustKeyStorePassPhrase -file /u01/app/oracle/Middleware/wlserver_10.3/server/lib/CertGenCA.der -noprompt - } - main 2>&1 | logger -p local3.info -t ansible-weblogic - -- name: Disable SecureListener in nodemanager.properties - ansible.builtin.replace: - path: "{{ wl_home }}/common/nodemanager/nodemanager.properties" - regexp: "SecureListener=true" - replace: "SecureListener=false" - -# - name: Stop Admin server -# become_user: oracle -# ansible.builtin.shell: | -# set -eo pipefail -# . ~/.bash_profile -# . $WL_HOME/server/bin/setWLSEnv.sh -# "{{ domain_home }}/{{ domain_name }}/bin/stopWebLogic.sh" - -- name: Stop nodemanager processes - become_user: oracle - ansible.builtin.shell: | - ps -fu oracle | grep "weblogic.NodeManager"| grep -v grep | gawk '{print $2}' | xargs kill -9 - -# - name: Start nodemanager -# become_user: oracle -# ansible.builtin.shell: | -# set -eo pipefail -# . ~/.bash_profile -# . $WL_HOME/server/bin/setWLSEnv.sh -# nohup {{ wl_home }}/server/bin/startNodeManager.sh & - -# - name: Start adminserver -# become_user: oracle -# ansible.builtin.shell: | -# set -eo pipefail -# . ~/.bash_profile -# . $WL_HOME/server/bin/setWLSEnv.sh -# nohup {{ domain_home }}/{{ domain_name }}/bin/startWebLogic.sh & -# async: 3600 -# poll: 60 - -# # Node manager and weblogic server for this to work -# - name: Query current NMType -# become_user: oracle -# ansible.builtin.shell: | -# set -eo pipefail -# . ~/.bash_profile > /dev/null -# . $WL_HOME/server/bin/setWLSEnv.sh > /dev/null -# . {{ domain_home }}/{{ domain_name }}/bin/setDomainEnv.sh > /dev/null -# wlst.sh ~/admin/scripts/get_param.py -d /Machines/{{ weblogic_domain_hostname }}/NodeManager/{{ weblogic_domain_hostname }} -n NMType -# check_mode: false -# changed_when: false -# register: weblogic_nmtype_raw - -# - name: Get current NMType -# set_fact: -# weblogic_nmtype: "{{ weblogic_nmtype_raw.stdout | regex_search(regexp,'\\1') }}" -# vars: -# regexp: 'Value=\"([^"]+)' -# failed_when: weblogic_nmtype|length == 0 - -# - debug: -# msg: "Current NMType: {{ weblogic_nmtype }}" - -# - name: Set NMType -# become_user: oracle -# ansible.builtin.shell: | -# set -eo pipefail -# . ~/.bash_profile > /dev/null -# . $WL_HOME/server/bin/setWLSEnv.sh > /dev/null -# . {{ domain_home }}/{{ domain_name }}/bin/setDomainEnv.sh > /dev/null -# wlst.sh ~/admin/scripts/set_param.py -d /Machines/{{ weblogic_domain_hostname }}/NodeManager/{{ weblogic_domain_hostname }} -n NMType -v Plain -# wlst.sh ~/admin/scripts/set_param.py -d /Machines/{{ weblogic_domain_hostname }}/NodeManager/{{ weblogic_domain_hostname }} -n ListenAddress -v {{ weblogic_domain_hostname }} -# wlst.sh ~/admin/scripts/set_param.py -d /SecurityConfiguration/NomisDomain -n NodeManagerUsername -v {{ weblogic_admin_username }} -# wlst.sh ~/admin/scripts/set_param.py -d /SecurityConfiguration/NomisDomain -n NodeManagerPassword -v {{ weblogic_admin_password }} -# when: weblogic_nmtype != 'Plain' - -# - name: Stop Admin server -# become_user: oracle -# ansible.builtin.shell: | -# set -eo pipefail -# . ~/.bash_profile -# . $WL_HOME/server/bin/setWLSEnv.sh -# {{ domain_home }}/{{ domain_name }}/bin/stopWebLogic.sh - -# - name: Stop nodemanager processes -# become_user: oracle -# ansible.builtin.shell: | -# ps -fu oracle | grep "weblogic.NodeManager"| grep -v grep | gawk '{print $2}' | xargs kill -9 - -# - name: Start nodemanager -# become_user: oracle -# ansible.builtin.shell: | -# set -eo pipefail -# . ~/.bash_profile -# . $WL_HOME/server/bin/setWLSEnv.sh -# nohup {{ wl_home }}/server/bin/startNodeManager.sh & - -# - name: Start adminserver -# become_user: oracle -# ansible.builtin.shell: | -# set -eo pipefail -# . ~/.bash_profile -# . $WL_HOME/server/bin/setWLSEnv.sh -# nohup {{ domain_home }}/{{ domain_name }}/bin/startWebLogic.sh & -# async: 3600 -# poll: 60 diff --git a/ansible/roles/oasys-bip/tasks/clone_bip_software.yml b/ansible/roles/oasys-bip/tasks/clone_bip_software.yml new file mode 100644 index 000000000..5e6639b6b --- /dev/null +++ b/ansible/roles/oasys-bip/tasks/clone_bip_software.yml @@ -0,0 +1,33 @@ +--- +- name: Check installed packages + ansible.builtin.package_facts: + +- block: + - name: Create jdk install directory + ansible.builtin.file: + path: "{{ item }}" + state: directory + owner: oracle + group: oinstall + mode: "0755" + loop: + - /u01/software/jdk + + - name: Get jdk rpm binary from S3 bucket + amazon.aws.aws_s3: + bucket: "{{ image_builder_s3_bucket_name }}" + object: "oasys-bip{{ item }}" + dest: "{{ item }}" + mode: get + overwrite: latest + loop: + - /u01/software/jdk/jdk-7u80-linux-x64.rpm + when: image_builder_s3_bucket_name is defined + + - name: Install jdk rpm binary + yum: + name: /u01/software/jdk/jdk-7u80-linux-x64.rpm + state: present + + # block + when: ansible_facts.packages['jdk'] is not defined diff --git a/ansible/roles/oasys-bip/tasks/create-managed-app.yml b/ansible/roles/oasys-bip/tasks/create-managed-app.yml deleted file mode 100644 index 08250e46f..000000000 --- a/ansible/roles/oasys-bip/tasks/create-managed-app.yml +++ /dev/null @@ -1,126 +0,0 @@ ---- -- name: Fail if managed_server variable not defined - fail: - msg: "Error, please ensure weblogic_server is defined" - when: managed_server is not defined - -- name: Check if managed app already configured - ansible.builtin.stat: - path: /etc/systemd/system/wls_managedserver.service - register: weblogic_created_managed_app_check - -- name: Configure managed app - block: - - debug: - msg: "Creating managed app {{ managed_server }}" - - - name: Copy managed app configuration files - ansible.builtin.template: - src: "10.3{{ item }}" - dest: "{{ item }}" - owner: oracle - group: oinstall - loop: - - /u01/software/weblogic/{{ managed_server }}.properties - - - name: Create application directories - ansible.builtin.file: - path: "{{ item }}" - state: directory - owner: oracle - group: oinstall - mode: "0755" - loop: - - "{{ xtag_app_path }}/log" - - "{{ xtag_app_path }}/release" - - - name: Get xtag application release file from S3 - amazon.aws.aws_s3: - bucket: "{{ image_builder_s3_bucket_name }}" - object: "weblogic-software{{ item }}" - dest: "{{ item }}" - mode: get - overwrite: latest - loop: - - "{{ xtag_app_path }}/release/install_xtagoutbound.zip" - - - name: Extract xtag application file - ansible.builtin.unarchive: - owner: oracle - group: oinstall - src: "{{ xtag_app_path }}/release/install_xtagoutbound.zip" - dest: "{{ xtag_app_path }}" - remote_src: true - - - name: Copy xtag lib files in {{ domain_name }} - ansible.builtin.copy: - owner: oracle - group: oinstall - src: "{{ xtag_app_path }}/lib/" - dest: "{{ domain_home }}/{{ domain_name }}/lib/" - remote_src: true - - - name: Create managed app - become_user: oracle - ansible.builtin.shell: | - set -eo pipefail - . ~/.bash_profile - . $WL_HOME/server/bin/setWLSEnv.sh - main() { - echo "# create managed app {{ managed_server }}" - java weblogic.WLST ~/admin/scripts/create_managed_app.py -p /u01/software/weblogic/{{ managed_server }}.properties - } - main 2>&1 | logger -p local3.info -t ansible-weblogic - async: 7200 - poll: 60 - - - name: Create managed app security directory - ansible.builtin.file: - path: "{{ item }}" - state: directory - owner: oracle - group: oinstall - mode: "0755" - loop: - - "{{ domain_home }}/{{ domain_name }}/servers/{{ managed_server }}/security" - - - name: Copy managed app boot properties - ansible.builtin.template: - src: "10.3{{ domain_home }}/{{ domain_name }}/servers/AdminServer/security/boot.properties" - dest: "{{ item }}" - owner: oracle - group: oinstall - force: false - loop: - - "{{ domain_home }}/{{ domain_name }}/servers/{{ managed_server }}/security/boot.properties" - - - name: Copy nodemanager stop script - ansible.builtin.template: - src: "10.3/home/oracle/admin/scripts/stopNodeManager.sh" - dest: "/home/oracle/admin/scripts/stopNodeManager.sh" - owner: oracle - group: oinstall - mode: 0744 - - - name: Stop managed server - become_user: oracle - ansible.builtin.shell: | - set -eo pipefail - . ~/.bash_profile - . $WL_HOME/server/bin/setWLSEnv.sh - nohup {{ domain_home }}/{{ domain_name }}/bin/stopManagedWebLogic.sh {{ managed_server }} - - - name: Stop adminserver - become_user: oracle - ansible.builtin.shell: | - set -eo pipefail - . ~/.bash_profile - . $WL_HOME/server/bin/setWLSEnv.sh - nohup {{ domain_home }}/{{ domain_name }}/bin/stopWebLogic.sh & - - - name: Stop nodemanager - become_user: oracle - ansible.builtin.shell: /home/oracle/admin/scripts/stopNodeManager.sh - - # block - when: not weblogic_created_managed_app_check.stat.exists diff --git a/ansible/roles/oasys-bip/tasks/create-xtag-domain.yml b/ansible/roles/oasys-bip/tasks/create-xtag-domain.yml deleted file mode 100644 index 21c073608..000000000 --- a/ansible/roles/oasys-bip/tasks/create-xtag-domain.yml +++ /dev/null @@ -1,63 +0,0 @@ ---- -- name: Create nomis xtag domain - block: - - name: Copy scripts and properties files - ansible.builtin.template: - src: "10.3{{ item }}" - dest: "{{ item }}" - owner: oracle - group: oinstall - loop: - - /u01/software/weblogic/WLS_XTAG_OUTBOUND_01.properties - - /u01/software/weblogic/domain.properties - - /u01/software/weblogic/AdminServer.properties - - - name: Start nodemanager - become_user: oracle - ansible.builtin.shell: | - set -eo pipefail - . ~/.bash_profile - . $WL_HOME/server/bin/setWLSEnv.sh - nohup /u01/app/oracle/Middleware/wlserver_10.3/server/bin/startNodeManager.sh & - - - name: Create weblogic Nomis xtag domain - become_user: oracle - ansible.builtin.shell: | - set -eo pipefail - . ~/.bash_profile - . $WL_HOME/server/bin/setWLSEnv.sh - java weblogic.WLST ~/admin/scripts/create_managed_app.py -p /u01/software/weblogic/domain.properties - - - name: Create security directories - ansible.builtin.file: - path: "{{ item }}" - state: directory - owner: oracle - group: oinstall - mode: "0755" - loop: - - /u01/app/oracle/Middleware/user_projects/domains/NomisDomain/servers/AdminServer/security - - # the boot.properties file is automatically updated by the weblogic server - - name: Copy Admin server boot properties file - ansible.builtin.template: - src: "10.3/u01/app/oracle/Middleware/user_projects/domains/NomisDomain/servers/AdminServer/security/boot.properties" - dest: "{{ item }}" - owner: oracle - group: oinstall - force: false - loop: - - /u01/app/oracle/Middleware/user_projects/domains/NomisDomain/servers/AdminServer/security/boot.properties - - # # - name: Start admin server - # ansible.builtin.service: - # name: weblogic-server - # enabled: yes - - - name: Start Admin server - become_user: oracle - ansible.builtin.shell: | - set -eo pipefail - . ~/.bash_profile - . $WL_HOME/server/bin/setWLSEnv.sh - nohup /u01/app/oracle/Middleware/user_projects/domains/NomisDomain/bin/startWebLogic.sh & diff --git a/ansible/roles/oasys-bip/tasks/extract-s3-archive.yml b/ansible/roles/oasys-bip/tasks/extract-s3-archive.yml deleted file mode 100644 index ea6e1d3f1..000000000 --- a/ansible/roles/oasys-bip/tasks/extract-s3-archive.yml +++ /dev/null @@ -1,45 +0,0 @@ ---- -- name: Fail if weblogic_s3_archives variable not defined - fail: - msg: "Error, please ensure weblogic_s3_archives is defined" - when: weblogic_s3_archives is not defined - -- name: Create archive directories - ansible.builtin.file: - path: "{{ item }}" - state: directory - owner: oracle - group: oinstall - mode: "0755" - loop: - - /u01/archives - -- name: Create target directories - ansible.builtin.file: - path: "{{ item.split('/')[:-1] | join('/') }}" - state: directory - owner: oracle - group: oinstall - mode: "0755" - loop: "{{ weblogic_s3_archives }}" - -- name: Download archives from S3 bucket into /u01/archives - amazon.aws.aws_s3: - bucket: "{{ image_builder_s3_bucket_name }}" - object: "oasys-bip{{ item }}" - dest: "/u01/archives/{{ item.split('/')[1:] | join('_') }}" - mode: get - overwrite: latest - loop: "{{ weblogic_s3_archives }}" - -- name: Extract archives into target directory - ansible.builtin.unarchive: - owner: oracle - group: oinstall - src: "/u01/archives/{{ item.split('/')[1:] | join('_') }}" - dest: "{{ item.split('/')[:-1] | join('/') }}" - remote_src: true - keep_newer: true - loop: "{{ weblogic_s3_archives }}" - when: not ansible_check_mode - register: weblogic_s3_archive_extract diff --git a/ansible/roles/oasys-bip/tasks/install-server.yml b/ansible/roles/oasys-bip/tasks/install-server.yml deleted file mode 100644 index 128280d28..000000000 --- a/ansible/roles/oasys-bip/tasks/install-server.yml +++ /dev/null @@ -1,73 +0,0 @@ ---- -- name: Create software directories - ansible.builtin.file: - path: "{{ item }}" - state: directory - owner: "{{ oracle_install_user }}" - group: "{{ oracle_install_group }}" - mode: "0755" - loop: - - /u01/software/weblogic - - /u01/software/tmp - - /u01/app - - "{{ stage }}" - -- name: Check if weblogic server already installed - ansible.builtin.stat: - path: /u01/app/oracle/Middleware/wlserver_10.3 - register: weblogic_server_installed_check - -- name: Install weblogic server software - block: - - name: Get weblogic install jar from S3 bucket - amazon.aws.aws_s3: - bucket: "{{ image_builder_s3_bucket_name }}" - object: "oasys-bip/u01/software/weblogic/wls1036_generic.jar" - dest: "{{ stage }}/wls1036_generic.jar" - mode: get - overwrite: latest - - - name: Copy weblogic install config - ansible.builtin.template: - src: "{{ item }}.j2" - dest: "{{ stage }}/{{ item }}" - owner: "{{ oracle_install_user }}" - group: "{{ oracle_install_group }}" - loop: - - silent.xml - - - name: Copy oraInst.loc file - ansible.builtin.template: - src: "{{ item }}.j2" - dest: "/etc/{{ item }}" - owner: "{{ oracle_install_user }}" - group: "{{ oracle_install_group }}" - loop: - - oraInst.loc - - - name: Install weblogic server which takes a couple of minutes - become_user: "{{ oracle_install_user }}" - ansible.builtin.shell: | - set -eo pipefail - main() { - echo "# installing weblogic {{ stage }}/wls1036_generic.jar" - java -d64 -Xmx1024m -jar {{ stage }}/wls1036_generic.jar -mode=silent -silent_xml={{ stage }}/silent.xml -Djava.io.tmpdir=/u01/software/tmp -invPtrLoc /etc/oraInst.loc - } - main 2>&1 | logger -p local3.info -t ansible-weblogic - - - name: Remove temporary install files - ansible.builtin.file: - path: "{{ item }}" - state: absent - loop: - - "{{ stage }}/wls1036_generic.jar" - - "{{ stage }}/silent.xml" - - # block - when: not weblogic_server_installed_check.stat.exists - -- name: Update bsu.sh MEM_ARGS - ansible.builtin.lineinfile: - path: /u01/app/oracle/Middleware/utils/bsu/bsu.sh - regexp: "^MEM_ARGS=" - line: 'MEM_ARGS="-Xms4096m -Xmx4096m" # ansible managed modernisation-platform-configuration-management' diff --git a/ansible/roles/oasys-bip/tasks/main.yml b/ansible/roles/oasys-bip/tasks/main.yml index f99d3c4f8..aaf3e36e3 100644 --- a/ansible/roles/oasys-bip/tasks/main.yml +++ b/ansible/roles/oasys-bip/tasks/main.yml @@ -41,37 +41,13 @@ - ec2provision - oracle-limits-changes - - import_tasks: install-server.yml - tags: - - amibuild - - ec2provision - - weblogic_install_server - - - import_tasks: patch-weblogic.yml - vars: - weblogic_patch_filename: /u01/app/oracle/Middleware/utils/bsu/cache_dir/p32832785_1036_Generic.zip - weblogic_patch_id: 3NVW - tags: - - amibuild - - ec2provision - - weblogic_patch_1 - - - import_tasks: patch-weblogic.yml - vars: - weblogic_patch_filename: /u01/app/oracle/Middleware/utils/bsu/cache_dir/p13964737_10360210720_Generic.zip - weblogic_patch_id: UEYM + - import_tasks: rcu.yml tags: - amibuild - ec2provision - - weblogic_patch_2 - - # - import_tasks: certificate-fix.yml - # tags: - # - amibuild - # - ec2provision - # - certificate_fix + - rcu - - import_tasks: rcu.yml + - import_tasks: clone_bip_software.yml tags: - amibuild - ec2provision diff --git a/ansible/roles/oasys-bip/tasks/patch-weblogic.yml b/ansible/roles/oasys-bip/tasks/patch-weblogic.yml deleted file mode 100644 index b9e8a3a71..000000000 --- a/ansible/roles/oasys-bip/tasks/patch-weblogic.yml +++ /dev/null @@ -1,50 +0,0 @@ ---- -- name: Fail if required weblogic patch variables not defined - fail: - msg: "Error, please ensure weblogic_patch_filename and weblogic_patch_ids are defined" - when: weblogic_patch_filename is not defined or weblogic_patch_id is not defined - -- name: Get current weblogic patch - become_user: "{{ oracle_install_user }}" - ansible.builtin.shell: | - . ~/.bash_profile > /dev/null - . $WL_HOME/server/bin/setWLSEnv.sh > /dev/null - cd $WL_HOME/../utils/bsu/ - ./bsu.sh -view -status=applied -prod_dir=$WL_HOME | grep "^Patch ID:" | cut -d: -f2 | sed 's/^ *//g' | cut -d\ -f1 | tr "\n" " " - check_mode: false - changed_when: false - register: weblogic_existing_patch - -- name: Set existing weblogic patch code fact - set_fact: - weblogic_existing_patch_code: "{{ weblogic_existing_patch.stdout }}" - -- name: Install weblogic patch - when: not weblogic_existing_patch_code is search(weblogic_patch_id) - block: - - name: Remove previous patch files - ansible.builtin.file: - path: "{{ weblogic_patch_filename.split('/')[:-1] | join('/') }}" - state: absent - - - import_tasks: extract-s3-archive.yml - vars: - weblogic_s3_archives: - - "{{ weblogic_patch_filename }}" - - # takes forever so run in async mode to prevent connection timeouts - - name: Run weblogic patch {{ weblogic_patch_id }} which takes approx 20 mins - become_user: "{{ oracle_install_user }}" - ansible.builtin.shell: | - set -eo pipefail - . ~/.bash_profile - . $WL_HOME/server/bin/setWLSEnv.sh - main() { - patch_dir={{ weblogic_patch_filename.split('/')[:-1] | join('/') }} - echo "Install patch: ./bsu.sh -install -patch_download_dir=$patch_dir -patchlist={{ weblogic_patch_id }} -prod_dir=$WL_HOME -verbose" - cd $WL_HOME/../utils/bsu/ - ./bsu.sh -install -patch_download_dir=$patch_dir -patchlist={{ weblogic_patch_id }} -prod_dir=$WL_HOME -verbose - } - main 2>&1 | logger -p local3.info -t ansible-weblogic - async: 83600 - poll: 60 diff --git a/ansible/roles/oasys-bip/templates/bi_config_moveplan.xml b/ansible/roles/oasys-bip/templates/bi_config_moveplan.xml new file mode 100644 index 000000000..9f2cee2c3 --- /dev/null +++ b/ansible/roles/oasys-bip/templates/bi_config_moveplan.xml @@ -0,0 +1,557 @@ + + + J2EEDomain + bifoundation_domain + 11.1.1.9.0 + CLONE2023101113001128 + + + Startup Mode + PRODUCTION + + STRING + READ_WRITE + + + + SERVER_CONFIG + + + Server Name + AdminServer + + STRING + READ_ONLY + + + + Listen Address + All Local Addresses + + STRING + READ_WRITE + + + + Listen Port + 7001 + + INTEGER + READ_WRITE + + + + + + Server Name + bi_server1 + + STRING + READ_ONLY + + + + Listen Address + All Local Addresses + + STRING + READ_WRITE + + + + Listen Port + 9704 + + INTEGER + READ_WRITE + + + + + + MACHINE_CONFIG + + + Machine Name + {{ weblogic_domain_hostname }} + + STRING + READ_WRITE + + + + Node Manager Listen Address + {{ weblogic_domain_hostname }} + + STRING + READ_WRITE + + + + Node Manager Listen Port + 9556 + + INTEGER + READ_WRITE + + + + + + CLUSTER_CONFIG + + + Cluster Name + bi_cluster + + STRING + READ_ONLY + + + + Messaging Mode + unicast + + STRING + READ_WRITE + + + + Cluster Address + + + STRING + READ_WRITE + + + + Unicast Channel + + + STRING + READ_WRITE + + + + Multicast Address + 239.192.0.0 + + STRING + READ_WRITE + + + + Multicast Port + 7001 + + INTEGER + READ_WRITE + + + + + + DATASOURCE + + + DataSource Name + mds-owsm + + STRING + READ_ONLY + + + + Driver Class + oracle.jdbc.OracleDriver + + STRING + READ_WRITE + + + + Url + jdbc:oracle:thin:@{{ db_server }}:1521/{{ db_name }} + + STRING + READ_WRITE + + + + User + OAS_MDS + + STRING + READ_WRITE + + + + Password File + {{ stage }}/{{ oas_mds_password_file }} + + STRING + true + READ_WRITE + + + + + + DataSource Name + EPMSystemRegistry + + STRING + READ_ONLY + + + + Driver Class + oracle.jdbc.OracleDriver + + STRING + READ_WRITE + + + + Url + jdbc:oracle:thin:@{{ db_server }}:1521/{{ db_name }} + + STRING + READ_WRITE + + + + User + OAS_BIPLATFORM + + STRING + READ_WRITE + + + + Password File + {{ stage }}/{{ oas_biplatform_password_file }} + + STRING + true + READ_WRITE + + + + + + DataSource Name + bip_datasource + + STRING + READ_ONLY + + + + Driver Class + oracle.jdbc.OracleDriver + + STRING + READ_WRITE + + + + Url + jdbc:oracle:thin:@{{ db_server }}:1521/{{ db_name }} + + STRING + READ_WRITE + + + + User + OAS_BIPLATFORM + + STRING + READ_WRITE + + + + Password File + {{ oas_biplatform_password_file }} + + STRING + true + READ_WRITE + + + + + + OPSS_SECURITY + + + + + + + + + BIEE-DOMAIN-CONFIG + BI EE Domain XML file contains the BI topology details including each BI Oracle Instance. + + + OracleInstances + Contains a property group for each host that is running BI components within the BI Domain + + + BIInstance + Contains domain wide configuration properties used by all hosts running BI components within the BI Domain + + EmailOptions + + smtpServerName + localhost + + STRING + READ_WRITE + + + + port + 25 + + INTEGER + READ_WRITE + + + + fromDisplayName + Oracle Business Intelligence + + STRING + READ_WRITE + + + + emailAddressOfSender + defaultuser@defaultmailserver.com + + STRING + READ_WRITE + + + + + MarketingOptions + + url + http://localhost:8765 + + STRING + READ_WRITE + + + + + SchedulerOptions + + dataSource + dataSourceValue + + STRING + READ_WRITE + + + + + + + + BI-PUBLISHER-CONFIG + BI Publisher config files are xmlp-server.xml, datasources.xml,providers.xml, jms_cluster_config.properties and config properties specified in domain env + + + XMLP-DATASOURCES + There will be a separate config list for each BI Publisher datasource configured + + dataSource + + file + + path + /u01/app/oracle/Middleware/user_projects/domains/bifoundation_domain/config/bipublisher/repository/DemoFiles + + STRING + READ_WRITE + + + + + + dataSource + + connection + + url + jdbc:oraclebi://{{ weblogic_domain_hostname }}:9703/ + + STRING + READ_WRITE + + + + + + dataSource + + connection + + url + jdbc:oracle:thin:@{{ db_server }}:1521:{{ db_name }} + + STRING + READ_WRITE + + + + username + EOR + + STRING + READ_WRITE + + + + + + + XMLP-SCHEDULER-JMS-CONFIG + config list for BIPublisher scheduler cluster config properties + + + + + diff --git a/ansible/roles/oasys-bip/templates/nm_moveplan.xml b/ansible/roles/oasys-bip/templates/nm_moveplan.xml new file mode 100644 index 000000000..2e87a8aa7 --- /dev/null +++ b/ansible/roles/oasys-bip/templates/nm_moveplan.xml @@ -0,0 +1,124 @@ + + + NodeManager + nodemanager + 11.1.1.9.0 + CLONE20231011130318398 + + + NODEMANAGER_PROPERTIES + + Listen Address + {{ weblogic_domain_hostname }} + + STRING + READ_WRITE + + + + Listen Port + 9556 + + INTEGER + READ_WRITE + + + + + DOMAINS + + + Domain Name + bifoundation_domain + + STRING + READ_WRITE + + + + Domain Location + /u01/app/oracle/Middleware/user_projects/domains/bifoundation_domain + + STRING + READ_WRITE + + + + AdminServer Listen Address + {{ weblogic_domain_hostname }} + + STRING + READ_WRITE + + + + AdminServer Listen Port + 7001 + + INTEGER + READ_WRITE + + + + AdminServer User Name + weblogic + + STRING + READ_WRITE + + + + AdminServer Password File + {{ stage }}/{{ admin_password_file }} + + STRING + true + READ_WRITE + + + + Custom Trust Keystore File + + 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. + + STRING + READ_WRITE + + + + Node Manager User Name + weblogic + + STRING + READ_WRITE + + + + Node Manager Password File + {{ stage }}/{{ admin_password_file }} + + STRING + true + READ_WRITE + + + + + + + From c78dff98ed75be52ce0afefa761035e9931e8fbe Mon Sep 17 00:00:00 2001 From: sandhya Gandalwar Date: Tue, 17 Oct 2023 14:15:15 +0100 Subject: [PATCH 08/19] Updated oasys-bip --- ansible/roles/oasys-bip/defaults/main.yml | 4 + .../oasys-bip/tasks/clone_bip_software.yml | 215 ++++++++++++++++-- ansible/roles/oasys-bip/tasks/get-facts.yml | 6 +- ansible/roles/oasys-bip/tasks/main.yml | 61 +++-- ansible/roles/oasys-bip/tasks/packages.yml | 1 + ansible/roles/oasys-bip/tasks/rcu.yml | 2 +- .../templates/addBIPCodeGrants.py.j2 | 35 +++ .../templates/bi_config_moveplan.xml | 12 +- .../templates/bip_paste_binary.sh.j2 | 2 + .../roles/oasys-bip/templates/nm_moveplan.xml | 4 +- .../templates/obfuscatePassword.exp.j2 | 10 + .../roles/oasys-bip/templates/password.txt.j2 | 1 + 12 files changed, 285 insertions(+), 68 deletions(-) create mode 100644 ansible/roles/oasys-bip/templates/addBIPCodeGrants.py.j2 create mode 100644 ansible/roles/oasys-bip/templates/bip_paste_binary.sh.j2 create mode 100644 ansible/roles/oasys-bip/templates/obfuscatePassword.exp.j2 create mode 100644 ansible/roles/oasys-bip/templates/password.txt.j2 diff --git a/ansible/roles/oasys-bip/defaults/main.yml b/ansible/roles/oasys-bip/defaults/main.yml index 165217ca4..8d460861c 100644 --- a/ansible/roles/oasys-bip/defaults/main.yml +++ b/ansible/roles/oasys-bip/defaults/main.yml @@ -11,3 +11,7 @@ oracle_install_user: oracle oracle_install_group: oinstall domain_name: bifoundation_domain domain_home: /u01/app/oracle/Middleware/user_projects/domains +admin_password_file: /u02/stage/admin_password_file.txt +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" diff --git a/ansible/roles/oasys-bip/tasks/clone_bip_software.yml b/ansible/roles/oasys-bip/tasks/clone_bip_software.yml index 5e6639b6b..0e5e94728 100644 --- a/ansible/roles/oasys-bip/tasks/clone_bip_software.yml +++ b/ansible/roles/oasys-bip/tasks/clone_bip_software.yml @@ -1,33 +1,202 @@ --- -- name: Check installed packages - ansible.builtin.package_facts: +- name: Check Oracle BIP Software installed + ansible.builtin.stat: + path: ". {{ wl_home }}/server/bin/setWLSEnv.sh" + register: BIP_software_installed - block: - - name: Create jdk install directory - ansible.builtin.file: - path: "{{ item }}" - state: directory + + # - name: Download software for Oracle BI Publisher cloning for Oasys + # amazon.aws.aws_s3: + # bucket: "{{ image_builder_s3_bucket_name }}" + # object: "oasys-bip/bip_clone_software/{{ item }}" + # dest: "{{ stage}}/{{ item }}" + # mode: get + # overwrite: latest + # loop: + # - bi_config_copy.jar + # - bi_mw_copy_binary.jar + # - cloningclient.jar + # - nm.jar + # - bip_repository_12Oct2023.tar + # - pasteBinary.sh + # when: image_builder_s3_bucket_name is defined + + # - name: Change file ownership, group and permissions + # ansible.builtin.file: + # path: "{{ item }}" + # owner: oracle + # group: oinstall + # mode: '0700' + # loop: + # - "{{ stage }}/pasteBinary.sh" + # - "{{ stage }}/cloningclient.jar" + + # - name: Create stage directory for moveplan + # ansible.builtin.file: + # path: "{{ item }}" + # state: directory + # owner: oracle + # group: oinstall + # mode: "0755" + # loop: + # - "{{ stage }}/nm" + # - "{{ stage }}/bi_config" + # - "{{ stage }}/logs" + + - name: Copy BIP plans for config and nodemanager + ansible.builtin.template: + src: "{{ item }}_moveplan.xml" + dest: "{{ stage }}/{{ item }}/moveplan.xml" owner: oracle group: oinstall - mode: "0755" + mode: "0700" loop: - - /u01/software/jdk - - - name: Get jdk rpm binary from S3 bucket - amazon.aws.aws_s3: - bucket: "{{ image_builder_s3_bucket_name }}" - object: "oasys-bip{{ item }}" - dest: "{{ item }}" - mode: get - overwrite: latest + - nm + - bi_config + + - name: Copy script templates to obfuscate password and to add Privileges for Application Roles + ansible.builtin.template: + src: "{{ item }}.j2" + dest: "{{ stage }}/{{ item }}" + owner: oracle + group: oinstall + mode: "0700" loop: - - /u01/software/jdk/jdk-7u80-linux-x64.rpm - when: image_builder_s3_bucket_name is defined + - obfuscatePassword.exp + - addBIPCodeGrants.py + - bip_paste_binary.sh + + # - name: Copy oraInst.loc + # ansible.builtin.template: + # src: "oraInst.loc.j2" + # dest: "/etc/oraInst.loc" + # owner: root + # group: root + # mode: "0755" + + - name: Oracle BI Publisher paste binary from jar file + become_user: oracle + ansible.builtin.shell: | + set -eo pipefail + main() { + echo "# pasteBinary.sh " + # {{ stage }}/pasteBinary.sh -javaHome /usr/java/jdk1.7.0_80 -archiveLoc {{ stage }}/bi_mw_copy_binary.jar -targetMWHomeLoc {{ middleware_home }} -invPtrLoc /etc/oraInst.loc -logDirLoc {{ stage }}/logs -executeSysPrereqs false + {{ stage }}/bip_paste_binary.sh + } + main 2>&1 | logger -p local3.info -t ansible-oracle-bip + async: 86400 + poll: 10 + when: not ansible_check_mode + + - name: Execute oracleRoot.sh as root + ansible.builtin.shell: | + set -eo pipefail + main() { + echo "# oracleRoot.sh " + {{ middleware_home }}/Oracle_BI1/oracleRoot.sh + } + main 2>&1 | logger -p local3.info -t ansible-oracle-bip + async: 86400 + poll: 60 + when: not ansible_check_mode + + - name: Collect file details for cleanup from nodemanager + ansible.builtin.find: + path: "{{ wl_home }}/common/nodemanager/" + hidden: True + register: collected_files + + - name: remove collected files from nodemenager directory + ansible.builtin.file: + path: "{{ item.path }}" + state: absent + with_items: > + {{ + collected_files.files + }} + + - name: Generate obfuscate password files for OMS_MDS + become_user: oracle + ansible.builtin.shell: | + set -eo pipefail + main() { + export CONFIG_JVM_ARGS="-Xmx2048M -Xms2048M" + echo "# Create obfuscated password file for OAS_MDS " + {{ stage }}/obfuscatePassword.exp {{ bipdb_mds_password }} oas_mds_password.txt + } + main 2>&1 | logger -p local3.info -t ansible-oracle-bip + + - name: Generate obfuscate password files for OAS_BIPLATFORM + become_user: oracle + ansible.builtin.shell: | + set -eo pipefail + main() { + export CONFIG_JVM_ARGS="-Xmx2048M -Xms2048M" + echo "# Create obfuscated password file for OAS_BIPLATFORM " + {{ stage }}/obfuscatePassword.exp {{ bipdb_biplatform_password }} {{ oas_biplatform_password_file }} + } + main 2>&1 | logger -p local3.info -t ansible-oracle-bip + + - name: Generate obfuscate password files for weblogic + become_user: oracle + ansible.builtin.shell: | + set -eo pipefail + main() { + export CONFIG_JVM_ARGS="-Xmx2048M -Xms2048M" + echo "# Create obfuscated password file for WEBLOGIC " + {{ stage }}/obfuscatePassword.exp {{ weblogic_admin_password }} {{ weblogic_password_file }} + } + main 2>&1 | logger -p local3.info -t ansible-oracle-bip + + # - name: Oracle BIP config cloning + # become_user: oracle + # ansible.builtin.shell: | + # set -eo pipefail + # main() { + # {{ middleware_home }}/oracle_common/bin/pasteConfig.sh \ + # -javaHome /usr/java/jdk1.7.0_80 \ + # -archiveLoc {{ stage }}/bi_config_copy.jar \ + # -targetDomainLoc {{ domain_home }}/{{ domain_name }} \ + # -targetMWHomeLoc {{ middleware_home }} \ + # -domainAdminPasswordFile {{ stage }}password.txt \ + # -movePlanLoc {{ stage }}/bi_config/moveplan.xml + # } + # main 2>&1 | logger -p local3.info -t ansible-oracle-bip + # async: 86400 + # poll: 60 + # when: not ansible_check_mode + + # - name: Oracle BIP NodeManager config cloning + # become_user: oracle + # ansible.builtin.shell: | + # set -eo pipefail + # main() { + # {{ middleware_home }}/oracle_common/bin/pasteConfig.sh \ + # -javaHome /usr/java/jdk1.7.0_80 \ + # -archiveLoc {{ stage }}/nm.jar \ + # -targetNMHomeLoc {{ wl_home }}/common/nodemanager \ + # -targetMWHomeLoc {{ middleware_home }} \ + # -movePlanLoc {{ stage }}/nm/moveplan.xml \ + # -silent true + # } + # main 2>&1 | logger -p local3.info -t ansible-oracle-bip + # async: 86400 + # poll: 60 + # when: not ansible_check_mode - - name: Install jdk rpm binary - yum: - name: /u01/software/jdk/jdk-7u80-linux-x64.rpm - state: present + # - name: Enable Standalone BI Publisher to Add Privileges for Application Roles + # become_user: oracle + # ansible.builtin.shell: | + # set -eo pipefail + # main() { + # . {{ wl_home }}/server/bin/setWLSEnv.sh + # {{ middleware_home }}/oracle_common/common/bin/wlst.sh \ + # {{ stage }}/add_BIP_code_grants.py \ + # t3://{{ weblogic_servername }}:7001 weblogic + # } + # main 2>&1 | logger -p local3.info -t ansible-oracle-bip + # when: not ansible_check_mode # block - when: ansible_facts.packages['jdk'] is not defined + when: not BIP_software_installed.stat.exists diff --git a/ansible/roles/oasys-bip/tasks/get-facts.yml b/ansible/roles/oasys-bip/tasks/get-facts.yml index ef9bc1fe6..f9214d1ba 100644 --- a/ansible/roles/oasys-bip/tasks/get-facts.yml +++ b/ansible/roles/oasys-bip/tasks/get-facts.yml @@ -18,8 +18,6 @@ set_fact: weblogic_admin_username: "{{ lookup('aws_ssm', ssm_parameters_path_weblogic_admin_username, region=ansible_ec2_placement_region) }}" weblogic_admin_password: "{{ lookup('aws_ssm', ssm_parameters_path_weblogic_admin_password, region=ansible_ec2_placement_region) }}" - weblogic_db_username: "{{ lookup('aws_ssm', ssm_parameters_path_weblogic_db_username, region=ansible_ec2_placement_region) }}" - weblogic_db_password: "{{ lookup('aws_ssm', ssm_parameters_path_weblogic_db_password, region=ansible_ec2_placement_region) }}" bipdb_sys_password: "{{ lookup('aws_ssm', ssm_parameters_path_bipdb_sys_password, region=ansible_ec2_placement_region) }}" bipdb_biplatform_password: "{{ lookup('aws_ssm', ssm_parameters_path_bipdb_biplatform_password, region=ansible_ec2_placement_region) }}" bipdb_mds_password: "{{ lookup('aws_ssm', ssm_parameters_path_bipdb_mds_password, region=ansible_ec2_placement_region) }}" @@ -36,7 +34,7 @@ when: weblogic_db_name is not defined - debug: - msg: "Configuring Oracle DB {{ weblogic_db_name }} on {{ weblogic_db_hostname_a }},{{ weblogic_db_hostname_b }} with username {{ weblogic_db_username }}" + msg: "Configuring Oracle DB {{ weblogic_db_name }} on {{ weblogic_db_hostname_a }},{{ weblogic_db_hostname_b }}" - debug: msg: "Configuring Admin console {{ weblogic_domain_hostname }} with username {{ weblogic_admin_username }}" @@ -47,8 +45,6 @@ when: - weblogic_admin_username|length > 0 - weblogic_admin_password|length > 0 - - weblogic_db_username|length > 0 - - weblogic_db_password|length > 0 - weblogic_db_hostname_a|length > 0 - weblogic_db_hostname_b|length > 0 - bipdb_sys_password| length> 0 diff --git a/ansible/roles/oasys-bip/tasks/main.yml b/ansible/roles/oasys-bip/tasks/main.yml index aaf3e36e3..4f35418ac 100644 --- a/ansible/roles/oasys-bip/tasks/main.yml +++ b/ansible/roles/oasys-bip/tasks/main.yml @@ -11,47 +11,46 @@ - weblogic_create_managed_app - weblogic_setup_log_rotate - - import_tasks: packages.yml - tags: - - amibuild - - ec2provision - - weblogic_packages + # - import_tasks: packages.yml + # tags: + # - amibuild + # - ec2provision + # - weblogic_packages - - import_tasks: users.yml - tags: - - amibuild - - ec2provision - - weblogic_users + # - import_tasks: users.yml + # tags: + # - amibuild + # - ec2provision + # - weblogic_users - - import_tasks: swap.yml - tags: - - amibuild - - ec2provision - - weblogic_swap + # - import_tasks: swap.yml + # tags: + # - amibuild + # - ec2provision + # - weblogic_swap - - import_tasks: install-jdk.yml - tags: - - amibuild - - ec2provision - - weblogic_install_jdk + # - import_tasks: install-jdk.yml + # tags: + # - amibuild + # - ec2provision + # - weblogic_install_jdk - - import_tasks: oracle-limits-update.yml - tags: - - amibuild - - ec2provision - - oracle-limits-changes + # - import_tasks: oracle-limits-update.yml + # tags: + # - amibuild + # - ec2provision + # - oracle-limits-changes - - import_tasks: rcu.yml - tags: - - amibuild - - ec2provision - - rcu + # - import_tasks: rcu.yml + # tags: + # - amibuild + # - ec2provision + # - rcu - import_tasks: clone_bip_software.yml tags: - amibuild - ec2provision - - rcu when: ansible_distribution in ['RedHat', 'OracleLinux'] and ansible_distribution_major_version == "7" diff --git a/ansible/roles/oasys-bip/tasks/packages.yml b/ansible/roles/oasys-bip/tasks/packages.yml index 694e4f12c..1fe7f8841 100644 --- a/ansible/roles/oasys-bip/tasks/packages.yml +++ b/ansible/roles/oasys-bip/tasks/packages.yml @@ -35,4 +35,5 @@ - xorg-x11-apps - xorg-x11-utils - xorg-x11-xauth + - expect state: latest diff --git a/ansible/roles/oasys-bip/tasks/rcu.yml b/ansible/roles/oasys-bip/tasks/rcu.yml index 8f12d6e6f..ba9bfe51f 100644 --- a/ansible/roles/oasys-bip/tasks/rcu.yml +++ b/ansible/roles/oasys-bip/tasks/rcu.yml @@ -42,7 +42,7 @@ . ~/.bash_profile $WL_HOME//bi_rcu/bin/rcu -silent -createRepository \ -connectString {{ bip_db_server }}:1521/{{ bip_db_name }} \ - -dbUser SYS -dbRole SYSDBA -schemaPrefix TEST \ + -dbUser SYS -dbRole SYSDBA -schemaPrefix OAS \ -component BIPLATFORM -component MDS -f < /u01/stage/obiee_rcu_paramfile.txt } main 2>&1 | logger -p local3.info -t ansible-bip-repository diff --git a/ansible/roles/oasys-bip/templates/addBIPCodeGrants.py.j2 b/ansible/roles/oasys-bip/templates/addBIPCodeGrants.py.j2 new file mode 100644 index 000000000..681229e4a --- /dev/null +++ b/ansible/roles/oasys-bip/templates/addBIPCodeGrants.py.j2 @@ -0,0 +1,35 @@ +#!/usr/bin/python +import os, sys, inspect + +def _getPathToThisFile(): + return os.path.dirname(inspect.getabsfile( inspect.currentframe() )) + +sys.path.append(_getPathToThisFile()) + +WLSAdminUrl = sys.argv[1] +WLSAdminUN = sys.argv[2] +psw = raw_input('Please enter password: ') +WLSAdminPW = psw + +try: + connect(WLSAdminUN, WLSAdminPW, WLSAdminUrl) + #saved_stdout = sys.stdout + #sys.stdout = open('_stdout.log', 'w') + + try: + grantPermission(codeBaseURL="file:${oracle.deployed.app.dir}/bipublisher_11.1.1${oracle.deployed.app.ext}", permTarget="context=APPLICATION,name=obi", permClass="oracle.security.jps.service.policystore.PolicyStoreAccessPermission", permActions="containsAppRole") + + except: + print >> sys.stdout, "Entry for BI Publisher already exist." + else: + print >> sys.stdout, "Entry for BI Publisher has been added successfully." + + sys.stdout.close() + #os.remove('_stdout.log') + #sys.stdout = saved_stdout + disconnect() + # explicitly exit without errors. patching system requires this. + exit() +except: + dumpStack() + raise \ No newline at end of file diff --git a/ansible/roles/oasys-bip/templates/bi_config_moveplan.xml b/ansible/roles/oasys-bip/templates/bi_config_moveplan.xml index 9f2cee2c3..a1dc4d0c0 100644 --- a/ansible/roles/oasys-bip/templates/bi_config_moveplan.xml +++ b/ansible/roles/oasys-bip/templates/bi_config_moveplan.xml @@ -186,7 +186,7 @@ Url - jdbc:oracle:thin:@{{ db_server }}:1521/{{ db_name }} + jdbc:oracle:thin:@{{ weblogic_db_hostname_a }}:1521/{{ weblogic_db_name }} STRING READ_WRITE @@ -202,7 +202,7 @@ Password File - {{ stage }}/{{ oas_mds_password_file }} + {{ oas_mds_password_file }} STRING true @@ -229,7 +229,7 @@ Url - jdbc:oracle:thin:@{{ db_server }}:1521/{{ db_name }} + jdbc:oracle:thin:@{{ weblogic_db_hostname_a }}:1521/{{ weblogic_db_name }} STRING READ_WRITE @@ -245,7 +245,7 @@ Password File - {{ stage }}/{{ oas_biplatform_password_file }} + {{ oas_biplatform_password_file }} STRING true @@ -272,7 +272,7 @@ Url - jdbc:oracle:thin:@{{ db_server }}:1521/{{ db_name }} + jdbc:oracle:thin:@{{ weblogic_db_hostname_a }}:1521/{{ weblogic_db_name }} STRING READ_WRITE @@ -530,7 +530,7 @@ connection url - jdbc:oracle:thin:@{{ db_server }}:1521:{{ db_name }} + jdbc:oracle:thin:@{{ weblogic_db_hostname_a }}:1521:{{ weblogic_db_name }} STRING READ_WRITE diff --git a/ansible/roles/oasys-bip/templates/bip_paste_binary.sh.j2 b/ansible/roles/oasys-bip/templates/bip_paste_binary.sh.j2 new file mode 100644 index 000000000..ab468de9b --- /dev/null +++ b/ansible/roles/oasys-bip/templates/bip_paste_binary.sh.j2 @@ -0,0 +1,2 @@ +#!/bin/bash +/u01/stage/pasteBinary.sh -javaHome /usr/java/jdk1.7.0_80 -archiveLoc /u01/stage/bi_mw_copy_binary.jar -targetMWHomeLoc /u01/app/oracle/Middleware -invPtrLoc /etc/oraInst.loc -logDirLoc /u01/stage/logs -executeSysPrereqs false diff --git a/ansible/roles/oasys-bip/templates/nm_moveplan.xml b/ansible/roles/oasys-bip/templates/nm_moveplan.xml index 2e87a8aa7..677b91d46 100644 --- a/ansible/roles/oasys-bip/templates/nm_moveplan.xml +++ b/ansible/roles/oasys-bip/templates/nm_moveplan.xml @@ -84,7 +84,7 @@ AdminServer Password File - {{ stage }}/{{ admin_password_file }} + {{ admin_password_file }} STRING true @@ -110,7 +110,7 @@ Node Manager Password File - {{ stage }}/{{ admin_password_file }} + {{ admin_password_file }} STRING true diff --git a/ansible/roles/oasys-bip/templates/obfuscatePassword.exp.j2 b/ansible/roles/oasys-bip/templates/obfuscatePassword.exp.j2 new file mode 100644 index 000000000..74fd9cb2b --- /dev/null +++ b/ansible/roles/oasys-bip/templates/obfuscatePassword.exp.j2 @@ -0,0 +1,10 @@ +#!/usr/bin/expect +set PASSWORD [lindex $argv 0] +set FILE [lindex $argv 1] + +spawn /u01/app/oracle/Middleware/oracle_common/bin/obfuscatePassword.sh -javaHome /usr/java/jdk1.7.0_80 +expect "\[Password to obfuscate:\]" +send "$PASSWORD\r" +expect "\[Path of password file to be created:\]" +send "$FILE\r" +expect eof \ No newline at end of file diff --git a/ansible/roles/oasys-bip/templates/password.txt.j2 b/ansible/roles/oasys-bip/templates/password.txt.j2 new file mode 100644 index 000000000..e38a8250f --- /dev/null +++ b/ansible/roles/oasys-bip/templates/password.txt.j2 @@ -0,0 +1 @@ +{{ weblogic_admin_password }} \ No newline at end of file From 9c03bf3707193a0e3f2de1c9a7ce4055501c7a84 Mon Sep 17 00:00:00 2001 From: sandhya Gandalwar Date: Wed, 18 Oct 2023 12:22:14 +0100 Subject: [PATCH 09/19] Updated oasys bip code --- .../oasys-bip/tasks/clone_bip_software.yml | 234 +++++++++--------- .../roles/oasys-bip/tasks/get-db-facts.yml | 3 +- ansible/roles/oasys-bip/tasks/get-facts.yml | 3 +- .../templates/bi_config_moveplan.xml | 2 +- .../oasys-bip/templates/create_bip_db.sh.j2 | 4 +- .../roles/oasys-bip/templates/nm_moveplan.xml | 2 +- .../templates/obfuscatePassword.exp.j2 | 2 +- 7 files changed, 124 insertions(+), 126 deletions(-) diff --git a/ansible/roles/oasys-bip/tasks/clone_bip_software.yml b/ansible/roles/oasys-bip/tasks/clone_bip_software.yml index 0e5e94728..5e6d07c08 100644 --- a/ansible/roles/oasys-bip/tasks/clone_bip_software.yml +++ b/ansible/roles/oasys-bip/tasks/clone_bip_software.yml @@ -9,16 +9,15 @@ # - name: Download software for Oracle BI Publisher cloning for Oasys # amazon.aws.aws_s3: # bucket: "{{ image_builder_s3_bucket_name }}" - # object: "oasys-bip/bip_clone_software/{{ item }}" + # object: "oasys-bip/bipclone/{{ item }}" # dest: "{{ stage}}/{{ item }}" # mode: get # overwrite: latest # loop: + # - test_mw_copy.jar # - bi_config_copy.jar - # - bi_mw_copy_binary.jar # - cloningclient.jar # - nm.jar - # - bip_repository_12Oct2023.tar # - pasteBinary.sh # when: image_builder_s3_bucket_name is defined @@ -44,28 +43,28 @@ # - "{{ stage }}/bi_config" # - "{{ stage }}/logs" - - name: Copy BIP plans for config and nodemanager - ansible.builtin.template: - src: "{{ item }}_moveplan.xml" - dest: "{{ stage }}/{{ item }}/moveplan.xml" - owner: oracle - group: oinstall - mode: "0700" - loop: - - nm - - bi_config - - - name: Copy script templates to obfuscate password and to add Privileges for Application Roles - ansible.builtin.template: - src: "{{ item }}.j2" - dest: "{{ stage }}/{{ item }}" - owner: oracle - group: oinstall - mode: "0700" - loop: - - obfuscatePassword.exp - - addBIPCodeGrants.py - - bip_paste_binary.sh + # - name: Copy BIP plans for config and nodemanager + # ansible.builtin.template: + # src: "{{ item }}_moveplan.xml" + # dest: "{{ stage }}/{{ item }}/moveplan.xml" + # owner: oracle + # group: oinstall + # mode: "0700" + # loop: + # - nm + # - bi_config + + # - name: Copy script templates to obfuscate password and to add Privileges for Application Roles + # ansible.builtin.template: + # src: "{{ item }}.j2" + # dest: "{{ stage }}/{{ item }}" + # owner: oracle + # group: oinstall + # mode: "0700" + # loop: + # - obfuscatePassword.exp + # - addBIPCodeGrants.py + # - bip_paste_binary.sh # - name: Copy oraInst.loc # ansible.builtin.template: @@ -75,128 +74,125 @@ # group: root # mode: "0755" - - name: Oracle BI Publisher paste binary from jar file + # - name: Oracle BI Publisher paste binary from jar file + # become_user: oracle + # ansible.builtin.shell: | + # set -eo pipefail + # main() { + # echo "# pasteBinary.sh " + # {{ stage }}/pasteBinary.sh -javahome /usr/java/jdk1.7.0_80 -archiveLoc {{ stage }}/test_mw_copy.jar -targetMWHomeLoc {{ middleware_home }} -invPtrLoc /etc/oraInst.loc -logDirLoc {{ stage }}/logs -executeSysPrereqs false + # } + # main 2>&1 | logger -p local3.info -t ansible-oracle-bip + # async: 86400 + # poll: 60 + # when: not ansible_check_mode + + # - name: Execute oracleRoot.sh as root + # ansible.builtin.shell: | + # set -eo pipefail + # main() { + # echo "# oracleRoot.sh " + # {{ middleware_home }}/Oracle_BI1/oracleRoot.sh + # } + # main 2>&1 | logger -p local3.info -t ansible-oracle-bip + # when: not ansible_check_mode + + # - name: Collect file details for cleanup from nodemanager + # ansible.builtin.find: + # path: "{{ wl_home }}/common/nodemanager/" + # hidden: True + # register: collected_files + + # - name: remove collected files from nodemenager directory + # ansible.builtin.file: + # path: "{{ item.path }}" + # state: absent + # with_items: > + # {{ + # collected_files.files + # }} + + - name: Generate obfuscate password files for OMS_MDS become_user: oracle ansible.builtin.shell: | set -eo pipefail main() { - echo "# pasteBinary.sh " - # {{ stage }}/pasteBinary.sh -javaHome /usr/java/jdk1.7.0_80 -archiveLoc {{ stage }}/bi_mw_copy_binary.jar -targetMWHomeLoc {{ middleware_home }} -invPtrLoc /etc/oraInst.loc -logDirLoc {{ stage }}/logs -executeSysPrereqs false - {{ stage }}/bip_paste_binary.sh + export CONFIG_JVM_ARGS="-Xmx2048M -Xms2048M" + echo "# Create obfuscated password file for OAS_MDS " + {{ stage }}/obfuscatePassword.exp {{ bipdb_mds_password }} {{ oas_mds_password_file }} } main 2>&1 | logger -p local3.info -t ansible-oracle-bip - async: 86400 - poll: 10 - when: not ansible_check_mode - - name: Execute oracleRoot.sh as root - ansible.builtin.shell: | - set -eo pipefail - main() { - echo "# oracleRoot.sh " - {{ middleware_home }}/Oracle_BI1/oracleRoot.sh - } - main 2>&1 | logger -p local3.info -t ansible-oracle-bip - async: 86400 - poll: 60 - when: not ansible_check_mode + # - name: Generate obfuscate password files for OAS_BIPLATFORM + # become_user: oracle + # ansible.builtin.shell: | + # set -eo pipefail + # main() { + # export CONFIG_JVM_ARGS="-Xmx2048M -Xms2048M" + # echo "# Create obfuscated password file for OAS_BIPLATFORM " + # {{ stage }}/obfuscatePassword.exp {{ bipdb_biplatform_password }} {{ oas_biplatform_password_file }} + # } + # main 2>&1 | logger -p local3.info -t ansible-oracle-bip - - name: Collect file details for cleanup from nodemanager - ansible.builtin.find: - path: "{{ wl_home }}/common/nodemanager/" - hidden: True - register: collected_files - - - name: remove collected files from nodemenager directory - ansible.builtin.file: - path: "{{ item.path }}" - state: absent - with_items: > - {{ - collected_files.files - }} + # - name: Generate obfuscate password files for weblogic + # become_user: oracle + # ansible.builtin.shell: | + # set -eo pipefail + # main() { + # export CONFIG_JVM_ARGS="-Xmx2048M -Xms2048M" + # echo "# Create obfuscated password file for WEBLOGIC " + # {{ stage }}/obfuscatePassword.exp {{ weblogic_admin_password }} {{ weblogic_password_file }} + # } + # main 2>&1 | logger -p local3.info -t ansible-oracle-bip - - name: Generate obfuscate password files for OMS_MDS + - name: Oracle BIP config cloning become_user: oracle ansible.builtin.shell: | set -eo pipefail main() { - export CONFIG_JVM_ARGS="-Xmx2048M -Xms2048M" - echo "# Create obfuscated password file for OAS_MDS " - {{ stage }}/obfuscatePassword.exp {{ bipdb_mds_password }} oas_mds_password.txt + {{ middleware_home }}/oracle_common/bin/pasteConfig.sh \ + -javahome /usr/java/jdk1.7.0_80 \ + -archiveLoc {{ stage }}/bi_config_copy.jar \ + -targetDomainLoc {{ domain_home }}/{{ domain_name }} \ + -targetMWHomeLoc {{ middleware_home }} \ + -domainAdminPasswordFile {{ stage }}password.txt \ + -movePlanLoc {{ stage }}/bi_config/moveplan.xml } main 2>&1 | logger -p local3.info -t ansible-oracle-bip + async: 86400 + poll: 60 + when: not ansible_check_mode - - name: Generate obfuscate password files for OAS_BIPLATFORM + - name: Oracle BIP NodeManager config cloning become_user: oracle ansible.builtin.shell: | set -eo pipefail main() { - export CONFIG_JVM_ARGS="-Xmx2048M -Xms2048M" - echo "# Create obfuscated password file for OAS_BIPLATFORM " - {{ stage }}/obfuscatePassword.exp {{ bipdb_biplatform_password }} {{ oas_biplatform_password_file }} + {{ middleware_home }}/oracle_common/bin/pasteConfig.sh \ + -javahome /usr/java/jdk1.7.0_80 \ + -archiveLoc {{ stage }}/nm.jar \ + -targetNMHomeLoc {{ wl_home }}/common/nodemanager \ + -targetMWHomeLoc {{ middleware_home }} \ + -movePlanLoc {{ stage }}/nm/moveplan.xml \ + -silent true } main 2>&1 | logger -p local3.info -t ansible-oracle-bip + async: 86400 + poll: 60 + when: not ansible_check_mode - - name: Generate obfuscate password files for weblogic + - name: Enable Standalone BI Publisher to Add Privileges for Application Roles become_user: oracle ansible.builtin.shell: | set -eo pipefail main() { - export CONFIG_JVM_ARGS="-Xmx2048M -Xms2048M" - echo "# Create obfuscated password file for WEBLOGIC " - {{ stage }}/obfuscatePassword.exp {{ weblogic_admin_password }} {{ weblogic_password_file }} + . {{ wl_home }}/server/bin/setWLSEnv.sh + {{ middleware_home }}/oracle_common/common/bin/wlst.sh \ + {{ stage }}/add_BIP_code_grants.py \ + t3://{{ weblogic_servername }}:7001 weblogic } main 2>&1 | logger -p local3.info -t ansible-oracle-bip - - # - name: Oracle BIP config cloning - # become_user: oracle - # ansible.builtin.shell: | - # set -eo pipefail - # main() { - # {{ middleware_home }}/oracle_common/bin/pasteConfig.sh \ - # -javaHome /usr/java/jdk1.7.0_80 \ - # -archiveLoc {{ stage }}/bi_config_copy.jar \ - # -targetDomainLoc {{ domain_home }}/{{ domain_name }} \ - # -targetMWHomeLoc {{ middleware_home }} \ - # -domainAdminPasswordFile {{ stage }}password.txt \ - # -movePlanLoc {{ stage }}/bi_config/moveplan.xml - # } - # main 2>&1 | logger -p local3.info -t ansible-oracle-bip - # async: 86400 - # poll: 60 - # when: not ansible_check_mode - - # - name: Oracle BIP NodeManager config cloning - # become_user: oracle - # ansible.builtin.shell: | - # set -eo pipefail - # main() { - # {{ middleware_home }}/oracle_common/bin/pasteConfig.sh \ - # -javaHome /usr/java/jdk1.7.0_80 \ - # -archiveLoc {{ stage }}/nm.jar \ - # -targetNMHomeLoc {{ wl_home }}/common/nodemanager \ - # -targetMWHomeLoc {{ middleware_home }} \ - # -movePlanLoc {{ stage }}/nm/moveplan.xml \ - # -silent true - # } - # main 2>&1 | logger -p local3.info -t ansible-oracle-bip - # async: 86400 - # poll: 60 - # when: not ansible_check_mode - - # - name: Enable Standalone BI Publisher to Add Privileges for Application Roles - # become_user: oracle - # ansible.builtin.shell: | - # set -eo pipefail - # main() { - # . {{ wl_home }}/server/bin/setWLSEnv.sh - # {{ middleware_home }}/oracle_common/common/bin/wlst.sh \ - # {{ stage }}/add_BIP_code_grants.py \ - # t3://{{ weblogic_servername }}:7001 weblogic - # } - # main 2>&1 | logger -p local3.info -t ansible-oracle-bip - # when: not ansible_check_mode + when: not ansible_check_mode # block - when: not BIP_software_installed.stat.exists + when: BIP_software_installed.stat.exists diff --git a/ansible/roles/oasys-bip/tasks/get-db-facts.yml b/ansible/roles/oasys-bip/tasks/get-db-facts.yml index 15e9834cb..34607c0b0 100644 --- a/ansible/roles/oasys-bip/tasks/get-db-facts.yml +++ b/ansible/roles/oasys-bip/tasks/get-db-facts.yml @@ -9,7 +9,8 @@ - name: Set database name set_fact: - db_name: "{{ environment_name }}BIPINF" + # db_name: "{{ environment_name }}BIPINF" + db_name: T2BIPTE - name: Fail if missing parameters fail: diff --git a/ansible/roles/oasys-bip/tasks/get-facts.yml b/ansible/roles/oasys-bip/tasks/get-facts.yml index f9214d1ba..6bb14ba8f 100644 --- a/ansible/roles/oasys-bip/tasks/get-facts.yml +++ b/ansible/roles/oasys-bip/tasks/get-facts.yml @@ -30,7 +30,8 @@ - name: Set db name from ec2 oracle-db-name tag set_fact: - weblogic_db_name: "{{ ec2.tags['oracle-db-name'] }}" + # weblogic_db_name: "{{ ec2.tags['oracle-db-name'] }}" + weblogic_db_name: "T2BIPTE" when: weblogic_db_name is not defined - debug: diff --git a/ansible/roles/oasys-bip/templates/bi_config_moveplan.xml b/ansible/roles/oasys-bip/templates/bi_config_moveplan.xml index a1dc4d0c0..a00eda5ac 100644 --- a/ansible/roles/oasys-bip/templates/bi_config_moveplan.xml +++ b/ansible/roles/oasys-bip/templates/bi_config_moveplan.xml @@ -18,7 +18,7 @@ J2EEDomain bifoundation_domain 11.1.1.9.0 - CLONE2023101113001128 + CLONE20231010113530183 Startup Mode diff --git a/ansible/roles/oasys-bip/templates/create_bip_db.sh.j2 b/ansible/roles/oasys-bip/templates/create_bip_db.sh.j2 index 444cc1328..ded47c122 100644 --- a/ansible/roles/oasys-bip/templates/create_bip_db.sh.j2 +++ b/ansible/roles/oasys-bip/templates/create_bip_db.sh.j2 @@ -26,5 +26,5 @@ dbca -silent -createDatabase \ -ignorePreReqs . oraenv <<< $ORACLE_SID -srvctl add service -d $ORACLE_SID -s RCV_TAF -srvctl start service -d $ORACLE_SID -s RCV_TAF +srvctl add service -d $ORACLE_SID -s BIPINF_TAF +srvctl start service -d $ORACLE_SID -s BIPINF_TAF diff --git a/ansible/roles/oasys-bip/templates/nm_moveplan.xml b/ansible/roles/oasys-bip/templates/nm_moveplan.xml index 677b91d46..72fa79862 100644 --- a/ansible/roles/oasys-bip/templates/nm_moveplan.xml +++ b/ansible/roles/oasys-bip/templates/nm_moveplan.xml @@ -18,7 +18,7 @@ NodeManager nodemanager 11.1.1.9.0 - CLONE20231011130318398 + CLONE20231010121257628 NODEMANAGER_PROPERTIES diff --git a/ansible/roles/oasys-bip/templates/obfuscatePassword.exp.j2 b/ansible/roles/oasys-bip/templates/obfuscatePassword.exp.j2 index 74fd9cb2b..174738cb3 100644 --- a/ansible/roles/oasys-bip/templates/obfuscatePassword.exp.j2 +++ b/ansible/roles/oasys-bip/templates/obfuscatePassword.exp.j2 @@ -2,7 +2,7 @@ set PASSWORD [lindex $argv 0] set FILE [lindex $argv 1] -spawn /u01/app/oracle/Middleware/oracle_common/bin/obfuscatePassword.sh -javaHome /usr/java/jdk1.7.0_80 +spawn /u01/app/oracle/Middleware/oracle_common/bin/obfuscatePassword.sh -javahome /usr/java/jdk1.7.0_80 expect "\[Password to obfuscate:\]" send "$PASSWORD\r" expect "\[Path of password file to be created:\]" From fc091b2474a6167520a0237c9915f2eadc4d84db Mon Sep 17 00:00:00 2001 From: sandhya Gandalwar Date: Thu, 19 Oct 2023 12:35:22 +0100 Subject: [PATCH 10/19] Updated oasys bip code --- ansible/roles/oasys-bip/defaults/main.yml | 6 +- .../oasys-bip/tasks/clone_bip_software.yml | 314 ++++++++++-------- .../oasys-bip/tasks/create_bip_database.yml | 9 +- .../roles/oasys-bip/tasks/get-db-facts.yml | 2 +- ansible/roles/oasys-bip/tasks/get-facts.yml | 2 +- ansible/roles/oasys-bip/tasks/main.yml | 62 ++-- .../templates/addApplicationPrivileges.exp.j2 | 7 + .../templates/add_hidden_parameter.sql.j2 | 9 + .../templates/bi_config_moveplan.xml | 2 +- .../roles/oasys-bip/templates/nm_moveplan.xml | 4 +- 10 files changed, 244 insertions(+), 173 deletions(-) create mode 100644 ansible/roles/oasys-bip/templates/addApplicationPrivileges.exp.j2 create mode 100644 ansible/roles/oasys-bip/templates/add_hidden_parameter.sql.j2 diff --git a/ansible/roles/oasys-bip/defaults/main.yml b/ansible/roles/oasys-bip/defaults/main.yml index 8d460861c..1f10cadb6 100644 --- a/ansible/roles/oasys-bip/defaults/main.yml +++ b/ansible/roles/oasys-bip/defaults/main.yml @@ -6,12 +6,14 @@ middleware_home: /u01/app/oracle/Middleware wl_home: /u01/app/oracle/Middleware/wlserver_10.3 stage: /u01/stage bip_db_server: 10.26.12.211 #should be part of ec2 instance tag -bip_db_name: T2BIPINF #should be part of ec2 instance tag +bip_db_name: T2BIPIN2 #should be part of ec2 instance tag oracle_install_user: oracle oracle_install_group: oinstall domain_name: bifoundation_domain domain_home: /u01/app/oracle/Middleware/user_projects/domains -admin_password_file: /u02/stage/admin_password_file.txt 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" +bip_repository_file: bip_repository_12Oct2023.tar +oasys_db: T2OASYS diff --git a/ansible/roles/oasys-bip/tasks/clone_bip_software.yml b/ansible/roles/oasys-bip/tasks/clone_bip_software.yml index 5e6d07c08..253e5cd14 100644 --- a/ansible/roles/oasys-bip/tasks/clone_bip_software.yml +++ b/ansible/roles/oasys-bip/tasks/clone_bip_software.yml @@ -6,111 +6,132 @@ - block: - # - name: Download software for Oracle BI Publisher cloning for Oasys - # amazon.aws.aws_s3: - # bucket: "{{ image_builder_s3_bucket_name }}" - # object: "oasys-bip/bipclone/{{ item }}" - # dest: "{{ stage}}/{{ item }}" - # mode: get - # overwrite: latest - # loop: - # - test_mw_copy.jar - # - bi_config_copy.jar - # - cloningclient.jar - # - nm.jar - # - pasteBinary.sh - # when: image_builder_s3_bucket_name is defined - - # - name: Change file ownership, group and permissions - # ansible.builtin.file: - # path: "{{ item }}" - # owner: oracle - # group: oinstall - # mode: '0700' - # loop: - # - "{{ stage }}/pasteBinary.sh" - # - "{{ stage }}/cloningclient.jar" - - # - name: Create stage directory for moveplan - # ansible.builtin.file: - # path: "{{ item }}" - # state: directory - # owner: oracle - # group: oinstall - # mode: "0755" - # loop: - # - "{{ stage }}/nm" - # - "{{ stage }}/bi_config" - # - "{{ stage }}/logs" - - # - name: Copy BIP plans for config and nodemanager - # ansible.builtin.template: - # src: "{{ item }}_moveplan.xml" - # dest: "{{ stage }}/{{ item }}/moveplan.xml" - # owner: oracle - # group: oinstall - # mode: "0700" - # loop: - # - nm - # - bi_config - - # - name: Copy script templates to obfuscate password and to add Privileges for Application Roles - # ansible.builtin.template: - # src: "{{ item }}.j2" - # dest: "{{ stage }}/{{ item }}" - # owner: oracle - # group: oinstall - # mode: "0700" - # loop: - # - obfuscatePassword.exp - # - addBIPCodeGrants.py - # - bip_paste_binary.sh - - # - name: Copy oraInst.loc - # ansible.builtin.template: - # src: "oraInst.loc.j2" - # dest: "/etc/oraInst.loc" - # owner: root - # group: root - # mode: "0755" - - # - name: Oracle BI Publisher paste binary from jar file - # become_user: oracle - # ansible.builtin.shell: | - # set -eo pipefail - # main() { - # echo "# pasteBinary.sh " - # {{ stage }}/pasteBinary.sh -javahome /usr/java/jdk1.7.0_80 -archiveLoc {{ stage }}/test_mw_copy.jar -targetMWHomeLoc {{ middleware_home }} -invPtrLoc /etc/oraInst.loc -logDirLoc {{ stage }}/logs -executeSysPrereqs false - # } - # main 2>&1 | logger -p local3.info -t ansible-oracle-bip - # async: 86400 - # poll: 60 - # when: not ansible_check_mode - - # - name: Execute oracleRoot.sh as root - # ansible.builtin.shell: | - # set -eo pipefail - # main() { - # echo "# oracleRoot.sh " - # {{ middleware_home }}/Oracle_BI1/oracleRoot.sh - # } - # main 2>&1 | logger -p local3.info -t ansible-oracle-bip - # when: not ansible_check_mode - - # - name: Collect file details for cleanup from nodemanager - # ansible.builtin.find: - # path: "{{ wl_home }}/common/nodemanager/" - # hidden: True - # register: collected_files - - # - name: remove collected files from nodemenager directory - # ansible.builtin.file: - # path: "{{ item.path }}" - # state: absent - # with_items: > - # {{ - # collected_files.files - # }} + - name: Download software for Oracle BI Publisher cloning for Oasys + amazon.aws.aws_s3: + bucket: "{{ image_builder_s3_bucket_name }}" + object: "oasys-bip/bipclone/{{ item }}" + dest: "{{ stage}}/{{ item }}" + mode: get + overwrite: latest + loop: + - test_mw_copy.jar + - bi_config_copy.jar + - cloningclient.jar + - nm.jar + - pasteBinary.sh + - "{{ bip_repository_file}}" + when: image_builder_s3_bucket_name is defined + + - name: Change file ownership, group and permissions + ansible.builtin.file: + path: "{{ item }}" + owner: oracle + group: oinstall + mode: '0700' + loop: + - "{{ stage }}/pasteBinary.sh" + - "{{ stage }}/cloningclient.jar" + + - name: Create directories for moveplan and bip repository + ansible.builtin.file: + path: "{{ item }}" + state: directory + owner: oracle + group: oinstall + mode: "0755" + loop: + - "{{ stage }}/nm" + - "{{ stage }}/bi_config" + - "{{ stage }}/logs" + - /u01/oracle + + - name: Create a symbolic link + ansible.builtin.file: + src: /u01/oracle + dest: /oracle + owner: oracle + group: oinstall + state: link + + - name: Extract bip_repository + ansible.builtin.unarchive: + owner: oracle + group: oinstall + src: "{{ stage }}/{{ bip_repository_file }}" + dest: /u01/oracle + remote_src: true + keep_newer: true + + + - name: Copy BIP plans for config and nodemanager + ansible.builtin.template: + src: "{{ item }}_moveplan.xml" + dest: "{{ stage }}/{{ item }}/moveplan.xml" + owner: oracle + group: oinstall + mode: "0700" + loop: + - nm + - bi_config + + - name: Copy script templates to obfuscate password and to add Privileges for Application Roles + ansible.builtin.template: + src: "{{ item }}.j2" + dest: "{{ stage }}/{{ item }}" + owner: oracle + group: oinstall + mode: "0700" + loop: + - obfuscatePassword.exp + - addBIPCodeGrants.py + - bip_paste_binary.sh + - password.txt + + - name: Copy oraInst.loc + ansible.builtin.template: + src: "oraInst.loc.j2" + dest: "/etc/oraInst.loc" + owner: root + group: root + mode: "0755" + + - name: Oracle BI Publisher paste binary from jar file + become_user: oracle + ansible.builtin.shell: | + set -eo pipefail + main() { + echo "# pasteBinary.sh " + {{ stage }}/pasteBinary.sh -javahome /usr/java/jdk1.7.0_80 -archiveLoc {{ stage }}/test_mw_copy.jar -targetMWHomeLoc {{ middleware_home }} -invPtrLoc /etc/oraInst.loc -logDirLoc {{ stage }}/logs -executeSysPrereqs false + } + main 2>&1 | logger -p local3.info -t ansible-oracle-bip + async: 86400 + poll: 60 + when: not ansible_check_mode + + - name: Execute oracleRoot.sh as root + ansible.builtin.shell: | + set -eo pipefail + main() { + echo "# oracleRoot.sh " + {{ middleware_home }}/Oracle_BI1/oracleRoot.sh + } + main 2>&1 | logger -p local3.info -t ansible-oracle-bip + when: not ansible_check_mode + + - name: Collect file details for cleanup from nodemanager + ansible.builtin.find: + path: "{{ wl_home }}/common/nodemanager/" + hidden: True + register: collected_files + + - name: remove collected files from nodemenager directory + ansible.builtin.file: + path: "{{ item.path }}" + state: absent + with_items: > + {{ + collected_files.files + }} - name: Generate obfuscate password files for OMS_MDS become_user: oracle @@ -123,27 +144,27 @@ } main 2>&1 | logger -p local3.info -t ansible-oracle-bip - # - name: Generate obfuscate password files for OAS_BIPLATFORM - # become_user: oracle - # ansible.builtin.shell: | - # set -eo pipefail - # main() { - # export CONFIG_JVM_ARGS="-Xmx2048M -Xms2048M" - # echo "# Create obfuscated password file for OAS_BIPLATFORM " - # {{ stage }}/obfuscatePassword.exp {{ bipdb_biplatform_password }} {{ oas_biplatform_password_file }} - # } - # main 2>&1 | logger -p local3.info -t ansible-oracle-bip - - # - name: Generate obfuscate password files for weblogic - # become_user: oracle - # ansible.builtin.shell: | - # set -eo pipefail - # main() { - # export CONFIG_JVM_ARGS="-Xmx2048M -Xms2048M" - # echo "# Create obfuscated password file for WEBLOGIC " - # {{ stage }}/obfuscatePassword.exp {{ weblogic_admin_password }} {{ weblogic_password_file }} - # } - # main 2>&1 | logger -p local3.info -t ansible-oracle-bip + - name: Generate obfuscate password files for OAS_BIPLATFORM + become_user: oracle + ansible.builtin.shell: | + set -eo pipefail + main() { + export CONFIG_JVM_ARGS="-Xmx2048M -Xms2048M" + echo "# Create obfuscated password file for OAS_BIPLATFORM " + {{ stage }}/obfuscatePassword.exp {{ bipdb_biplatform_password }} {{ oas_biplatform_password_file }} + } + main 2>&1 | logger -p local3.info -t ansible-oracle-bip + + - name: Generate obfuscate password files for weblogic + become_user: oracle + ansible.builtin.shell: | + set -eo pipefail + main() { + export CONFIG_JVM_ARGS="-Xmx2048M -Xms2048M" + echo "# Create obfuscated password file for WEBLOGIC " + {{ stage }}/obfuscatePassword.exp {{ weblogic_admin_password }} {{ weblogic_password_file }} + } + main 2>&1 | logger -p local3.info -t ansible-oracle-bip - name: Oracle BIP config cloning become_user: oracle @@ -155,7 +176,7 @@ -archiveLoc {{ stage }}/bi_config_copy.jar \ -targetDomainLoc {{ domain_home }}/{{ domain_name }} \ -targetMWHomeLoc {{ middleware_home }} \ - -domainAdminPasswordFile {{ stage }}password.txt \ + -domainAdminPasswordFile {{ stage }}/password.txt \ -movePlanLoc {{ stage }}/bi_config/moveplan.xml } main 2>&1 | logger -p local3.info -t ansible-oracle-bip @@ -163,6 +184,21 @@ poll: 60 when: not ansible_check_mode + - name: Collect file details for cleanup from nodemanager + ansible.builtin.find: + path: "{{ wl_home }}/common/nodemanager/" + hidden: True + register: collected_files + + - name: remove collected files from nodemenager directory + ansible.builtin.file: + path: "{{ item.path }}" + state: absent + with_items: > + {{ + collected_files.files + }} + - name: Oracle BIP NodeManager config cloning become_user: oracle ansible.builtin.shell: | @@ -171,8 +207,8 @@ {{ middleware_home }}/oracle_common/bin/pasteConfig.sh \ -javahome /usr/java/jdk1.7.0_80 \ -archiveLoc {{ stage }}/nm.jar \ - -targetNMHomeLoc {{ wl_home }}/common/nodemanager \ - -targetMWHomeLoc {{ middleware_home }} \ + -targetnmhomeloc {{ wl_home }}/common/nodemanager \ + -targetmwhomeloc {{ middleware_home }} \ -movePlanLoc {{ stage }}/nm/moveplan.xml \ -silent true } @@ -181,18 +217,30 @@ poll: 60 when: not ansible_check_mode + - name: Start nodemanager + become_user: oracle + ansible.builtin.shell: | + nohup /u01/app/oracle/Middleware/wlserver_10.3/server/bin/startNodeManager.sh & + + - name: Start Adminserver + become_user: oracle + ansible.builtin.shell: | + nohup /u01/app/oracle/Middleware/user_projects/domains/bifoundation_domain/bin/startWebLogic.sh & + + - name: Pause for 5 minutes to let admin server start properly . + ansible.builtin.pause: + minutes: 5 + - name: Enable Standalone BI Publisher to Add Privileges for Application Roles become_user: oracle ansible.builtin.shell: | set -eo pipefail main() { . {{ wl_home }}/server/bin/setWLSEnv.sh - {{ middleware_home }}/oracle_common/common/bin/wlst.sh \ - {{ stage }}/add_BIP_code_grants.py \ - t3://{{ weblogic_servername }}:7001 weblogic + {{ stage }}/addApplicationPrivileges.exp {{ weblogic_admin_password }} } main 2>&1 | logger -p local3.info -t ansible-oracle-bip when: not ansible_check_mode # block - when: BIP_software_installed.stat.exists + when: not BIP_software_installed.stat.exists diff --git a/ansible/roles/oasys-bip/tasks/create_bip_database.yml b/ansible/roles/oasys-bip/tasks/create_bip_database.yml index 47c061710..f927548b3 100644 --- a/ansible/roles/oasys-bip/tasks/create_bip_database.yml +++ b/ansible/roles/oasys-bip/tasks/create_bip_database.yml @@ -9,11 +9,14 @@ - name: Copy BIP database creation scripts template: - src: "create_bip_db.sh.j2" - dest: "{{ stage }}/create_bip_db.sh" + src: "{{ item }}.j2" + dest: "{{ stage }}/{{ item }}" owner: oracle group: oinstall mode: "0700" + loop: + - create_bip_db.sh + - add_hidden_parameter.sql - name: Create BIP database become_user: oracle @@ -22,6 +25,8 @@ main() { echo "# create_recovery_catalog_db.sh " {{ stage }}/create_bip_db.sh {{ db_name }} {{ db_sys_password }} {{ db_system_password }} + . oraenv <<< {{ db_name }} + sqlplus / as sysdba @add_hidden_parameter.sql } main 2>&1 | logger -p local3.info -t ansible-oracle-db async: 86400 diff --git a/ansible/roles/oasys-bip/tasks/get-db-facts.yml b/ansible/roles/oasys-bip/tasks/get-db-facts.yml index 34607c0b0..bd8eaec7f 100644 --- a/ansible/roles/oasys-bip/tasks/get-db-facts.yml +++ b/ansible/roles/oasys-bip/tasks/get-db-facts.yml @@ -10,7 +10,7 @@ - name: Set database name set_fact: # db_name: "{{ environment_name }}BIPINF" - db_name: T2BIPTE + db_name: T2BIPIN2 - name: Fail if missing parameters fail: diff --git a/ansible/roles/oasys-bip/tasks/get-facts.yml b/ansible/roles/oasys-bip/tasks/get-facts.yml index 6bb14ba8f..4380d46af 100644 --- a/ansible/roles/oasys-bip/tasks/get-facts.yml +++ b/ansible/roles/oasys-bip/tasks/get-facts.yml @@ -31,7 +31,7 @@ - name: Set db name from ec2 oracle-db-name tag set_fact: # weblogic_db_name: "{{ ec2.tags['oracle-db-name'] }}" - weblogic_db_name: "T2BIPTE" + weblogic_db_name: "T2BIPIN2" when: weblogic_db_name is not defined - debug: diff --git a/ansible/roles/oasys-bip/tasks/main.yml b/ansible/roles/oasys-bip/tasks/main.yml index 4f35418ac..a03144257 100644 --- a/ansible/roles/oasys-bip/tasks/main.yml +++ b/ansible/roles/oasys-bip/tasks/main.yml @@ -10,42 +10,37 @@ - weblogic_certificate_fix - weblogic_create_managed_app - weblogic_setup_log_rotate + - rcu - # - import_tasks: packages.yml - # tags: - # - amibuild - # - ec2provision - # - weblogic_packages - - # - import_tasks: users.yml - # tags: - # - amibuild - # - ec2provision - # - weblogic_users + - import_tasks: packages.yml + tags: + - amibuild + - ec2provision + - weblogic_packages - # - import_tasks: swap.yml - # tags: - # - amibuild - # - ec2provision - # - weblogic_swap + - import_tasks: users.yml + tags: + - amibuild + - ec2provision + - weblogic_users - # - import_tasks: install-jdk.yml - # tags: - # - amibuild - # - ec2provision - # - weblogic_install_jdk + - import_tasks: swap.yml + tags: + - amibuild + - ec2provision + - weblogic_swap - # - import_tasks: oracle-limits-update.yml - # tags: - # - amibuild - # - ec2provision - # - oracle-limits-changes + - import_tasks: install-jdk.yml + tags: + - amibuild + - ec2provision + - weblogic_install_jdk - # - import_tasks: rcu.yml - # tags: - # - amibuild - # - ec2provision - # - rcu + - import_tasks: oracle-limits-update.yml + tags: + - amibuild + - ec2provision + - oracle-limits-changes - import_tasks: clone_bip_software.yml tags: @@ -63,3 +58,8 @@ tags: - bip_db_create - never + +- import_tasks: rcu.yml + tags: + - bip_db_create + - never diff --git a/ansible/roles/oasys-bip/templates/addApplicationPrivileges.exp.j2 b/ansible/roles/oasys-bip/templates/addApplicationPrivileges.exp.j2 new file mode 100644 index 000000000..8cdc180b2 --- /dev/null +++ b/ansible/roles/oasys-bip/templates/addApplicationPrivileges.exp.j2 @@ -0,0 +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 +expect "\Please enter password:\]" +send "$PASSWORD\r" +expect eof \ No newline at end of file diff --git a/ansible/roles/oasys-bip/templates/add_hidden_parameter.sql.j2 b/ansible/roles/oasys-bip/templates/add_hidden_parameter.sql.j2 new file mode 100644 index 000000000..ce132abd8 --- /dev/null +++ b/ansible/roles/oasys-bip/templates/add_hidden_parameter.sql.j2 @@ -0,0 +1,9 @@ +set echo on +spool {{ stage }}/add_hidden_parameter.log + +ALTER SYSTEM SET "_allow_insert_with_update_check"=TRUE scope=spfile; +shutdown immediate +startup + +spool off +exit \ No newline at end of file diff --git a/ansible/roles/oasys-bip/templates/bi_config_moveplan.xml b/ansible/roles/oasys-bip/templates/bi_config_moveplan.xml index a00eda5ac..b8544004f 100644 --- a/ansible/roles/oasys-bip/templates/bi_config_moveplan.xml +++ b/ansible/roles/oasys-bip/templates/bi_config_moveplan.xml @@ -530,7 +530,7 @@ connection url - jdbc:oracle:thin:@{{ weblogic_db_hostname_a }}:1521:{{ weblogic_db_name }} + jdbc:oracle:thin:@{{ weblogic_db_hostname_a }}:1521:{{ oasys_db }} STRING READ_WRITE diff --git a/ansible/roles/oasys-bip/templates/nm_moveplan.xml b/ansible/roles/oasys-bip/templates/nm_moveplan.xml index 72fa79862..5b3a8f671 100644 --- a/ansible/roles/oasys-bip/templates/nm_moveplan.xml +++ b/ansible/roles/oasys-bip/templates/nm_moveplan.xml @@ -84,7 +84,7 @@ AdminServer Password File - {{ admin_password_file }} + {{ weblogic_password_file }} STRING true @@ -110,7 +110,7 @@ Node Manager Password File - {{ admin_password_file }} + {{ weblogic_password_file }} STRING true From ed40aaa54bdc51f23afcdf0d01c79aa1cf2c881c Mon Sep 17 00:00:00 2001 From: sandhya Gandalwar Date: Wed, 1 Nov 2023 08:38:22 +0000 Subject: [PATCH 11/19] Updated BIP code --- ansible/roles/oasys-bip/defaults/main.yml | 1 + .../oasys-bip/tasks/clone_bip_software.yml | 439 +++++++++--------- ansible/roles/oasys-bip/tasks/install-jdk.yml | 7 +- .../templates/bi_config_moveplan.xml | 2 +- 4 files changed, 238 insertions(+), 211 deletions(-) diff --git a/ansible/roles/oasys-bip/defaults/main.yml b/ansible/roles/oasys-bip/defaults/main.yml index 1f10cadb6..179d22c49 100644 --- a/ansible/roles/oasys-bip/defaults/main.yml +++ b/ansible/roles/oasys-bip/defaults/main.yml @@ -17,3 +17,4 @@ weblogic_password_file: "{{ stage }}/weblogic_password.txt" admin_password_file: "{{ stage }}/weblogic_password.txt" bip_repository_file: bip_repository_12Oct2023.tar oasys_db: T2OASYS +oasys_db_server: t2-oasys-db-a \ No newline at end of file diff --git a/ansible/roles/oasys-bip/tasks/clone_bip_software.yml b/ansible/roles/oasys-bip/tasks/clone_bip_software.yml index 253e5cd14..41f747f5b 100644 --- a/ansible/roles/oasys-bip/tasks/clone_bip_software.yml +++ b/ansible/roles/oasys-bip/tasks/clone_bip_software.yml @@ -6,228 +6,253 @@ - block: - - name: Download software for Oracle BI Publisher cloning for Oasys - amazon.aws.aws_s3: - bucket: "{{ image_builder_s3_bucket_name }}" - object: "oasys-bip/bipclone/{{ item }}" - dest: "{{ stage}}/{{ item }}" - mode: get - overwrite: latest - loop: - - test_mw_copy.jar - - bi_config_copy.jar - - cloningclient.jar - - nm.jar - - pasteBinary.sh - - "{{ bip_repository_file}}" - when: image_builder_s3_bucket_name is defined - - - name: Change file ownership, group and permissions - ansible.builtin.file: - path: "{{ item }}" - owner: oracle - group: oinstall - mode: '0700' - loop: - - "{{ stage }}/pasteBinary.sh" - - "{{ stage }}/cloningclient.jar" - - - name: Create directories for moveplan and bip repository - ansible.builtin.file: - path: "{{ item }}" - state: directory - owner: oracle - group: oinstall - mode: "0755" - loop: - - "{{ stage }}/nm" - - "{{ stage }}/bi_config" - - "{{ stage }}/logs" - - /u01/oracle - - - name: Create a symbolic link - ansible.builtin.file: - src: /u01/oracle - dest: /oracle - owner: oracle - group: oinstall - state: link - - - name: Extract bip_repository - ansible.builtin.unarchive: - owner: oracle - group: oinstall - src: "{{ stage }}/{{ bip_repository_file }}" - dest: /u01/oracle - remote_src: true - keep_newer: true - - - - name: Copy BIP plans for config and nodemanager - ansible.builtin.template: - src: "{{ item }}_moveplan.xml" - dest: "{{ stage }}/{{ item }}/moveplan.xml" - owner: oracle - group: oinstall - mode: "0700" - loop: - - nm - - bi_config - - - name: Copy script templates to obfuscate password and to add Privileges for Application Roles - ansible.builtin.template: - src: "{{ item }}.j2" - dest: "{{ stage }}/{{ item }}" - owner: oracle - group: oinstall - mode: "0700" - loop: - - obfuscatePassword.exp - - addBIPCodeGrants.py - - bip_paste_binary.sh - - password.txt - - - name: Copy oraInst.loc - ansible.builtin.template: - src: "oraInst.loc.j2" - dest: "/etc/oraInst.loc" - owner: root - group: root - mode: "0755" - - - name: Oracle BI Publisher paste binary from jar file - become_user: oracle - ansible.builtin.shell: | - set -eo pipefail - main() { - echo "# pasteBinary.sh " - {{ stage }}/pasteBinary.sh -javahome /usr/java/jdk1.7.0_80 -archiveLoc {{ stage }}/test_mw_copy.jar -targetMWHomeLoc {{ middleware_home }} -invPtrLoc /etc/oraInst.loc -logDirLoc {{ stage }}/logs -executeSysPrereqs false - } - main 2>&1 | logger -p local3.info -t ansible-oracle-bip - async: 86400 - poll: 60 - when: not ansible_check_mode + # - name: Create directories for moveplan and bip repository + # ansible.builtin.file: + # path: "{{ item }}" + # state: directory + # owner: oracle + # group: oinstall + # mode: "0755" + # loop: + # - "{{ stage }}" + # - "{{ stage }}/nm" + # - "{{ stage }}/bi_config" + # - "{{ stage }}/logs" + # - /u01/oracle + # - /u01/app - - name: Execute oracleRoot.sh as root - ansible.builtin.shell: | - set -eo pipefail - main() { - echo "# oracleRoot.sh " - {{ middleware_home }}/Oracle_BI1/oracleRoot.sh - } - main 2>&1 | logger -p local3.info -t ansible-oracle-bip - when: not ansible_check_mode + # - name: Download software for Oracle BI Publisher cloning for Oasys + # amazon.aws.aws_s3: + # bucket: "{{ image_builder_s3_bucket_name }}" + # object: "oasys-bip/bipclone/{{ item }}" + # dest: "{{ stage}}/{{ item }}" + # mode: get + # overwrite: latest + # loop: + # - test_mw_copy.jar + # - bi_config_copy.jar + # - cloningclient.jar + # - nm.jar + # - pasteBinary.sh + # - "{{ bip_repository_file}}" + # when: image_builder_s3_bucket_name is defined - - name: Collect file details for cleanup from nodemanager - ansible.builtin.find: - path: "{{ wl_home }}/common/nodemanager/" - hidden: True - register: collected_files - - - name: remove collected files from nodemenager directory - ansible.builtin.file: - path: "{{ item.path }}" - state: absent - with_items: > - {{ - collected_files.files - }} - - - name: Generate obfuscate password files for OMS_MDS - become_user: oracle - ansible.builtin.shell: | - set -eo pipefail - main() { - export CONFIG_JVM_ARGS="-Xmx2048M -Xms2048M" - echo "# Create obfuscated password file for OAS_MDS " - {{ stage }}/obfuscatePassword.exp {{ bipdb_mds_password }} {{ oas_mds_password_file }} - } - main 2>&1 | logger -p local3.info -t ansible-oracle-bip + # - name: Change file ownership, group and permissions + # ansible.builtin.file: + # path: "{{ item }}" + # owner: oracle + # group: oinstall + # mode: '0700' + # loop: + # - "{{ stage }}/pasteBinary.sh" + # - "{{ stage }}/cloningclient.jar" - - name: Generate obfuscate password files for OAS_BIPLATFORM - become_user: oracle - ansible.builtin.shell: | - set -eo pipefail - main() { - export CONFIG_JVM_ARGS="-Xmx2048M -Xms2048M" - echo "# Create obfuscated password file for OAS_BIPLATFORM " - {{ stage }}/obfuscatePassword.exp {{ bipdb_biplatform_password }} {{ oas_biplatform_password_file }} - } - main 2>&1 | logger -p local3.info -t ansible-oracle-bip + # - name: Create a symbolic link + # ansible.builtin.file: + # src: /u01/oracle + # dest: /oracle + # owner: oracle + # group: oinstall + # state: link - - name: Generate obfuscate password files for weblogic - become_user: oracle - ansible.builtin.shell: | - set -eo pipefail - main() { - export CONFIG_JVM_ARGS="-Xmx2048M -Xms2048M" - echo "# Create obfuscated password file for WEBLOGIC " - {{ stage }}/obfuscatePassword.exp {{ weblogic_admin_password }} {{ weblogic_password_file }} - } - main 2>&1 | logger -p local3.info -t ansible-oracle-bip + # - name: Extract bip_repository + # ansible.builtin.unarchive: + # owner: oracle + # group: oinstall + # src: "{{ stage }}/{{ bip_repository_file }}" + # dest: /u01/oracle + # remote_src: true + # keep_newer: true - - name: Oracle BIP config cloning - become_user: oracle - ansible.builtin.shell: | - set -eo pipefail - main() { - {{ middleware_home }}/oracle_common/bin/pasteConfig.sh \ - -javahome /usr/java/jdk1.7.0_80 \ - -archiveLoc {{ stage }}/bi_config_copy.jar \ - -targetDomainLoc {{ domain_home }}/{{ domain_name }} \ - -targetMWHomeLoc {{ middleware_home }} \ - -domainAdminPasswordFile {{ stage }}/password.txt \ - -movePlanLoc {{ stage }}/bi_config/moveplan.xml - } - main 2>&1 | logger -p local3.info -t ansible-oracle-bip - async: 86400 - poll: 60 - when: not ansible_check_mode - - name: Collect file details for cleanup from nodemanager - ansible.builtin.find: - path: "{{ wl_home }}/common/nodemanager/" - hidden: True - register: collected_files - - - name: remove collected files from nodemenager directory - ansible.builtin.file: - path: "{{ item.path }}" - state: absent - with_items: > - {{ - collected_files.files - }} - - - name: Oracle BIP NodeManager config cloning - become_user: oracle - ansible.builtin.shell: | - set -eo pipefail - main() { - {{ middleware_home }}/oracle_common/bin/pasteConfig.sh \ - -javahome /usr/java/jdk1.7.0_80 \ - -archiveLoc {{ stage }}/nm.jar \ - -targetnmhomeloc {{ wl_home }}/common/nodemanager \ - -targetmwhomeloc {{ middleware_home }} \ - -movePlanLoc {{ stage }}/nm/moveplan.xml \ - -silent true - } - main 2>&1 | logger -p local3.info -t ansible-oracle-bip - async: 86400 - poll: 60 - when: not ansible_check_mode + # - name: Copy BIP plans for config and nodemanager + # ansible.builtin.template: + # src: "{{ item }}_moveplan.xml" + # dest: "{{ stage }}/{{ item }}/moveplan.xml" + # owner: oracle + # group: oinstall + # mode: "0700" + # loop: + # - nm + # - bi_config + + # - name: Copy script templates to obfuscate password and to add Privileges for Application Roles + # ansible.builtin.template: + # src: "{{ item }}.j2" + # dest: "{{ stage }}/{{ item }}" + # owner: oracle + # group: oinstall + # mode: "0700" + # loop: + # - obfuscatePassword.exp + # - addBIPCodeGrants.py + # - bip_paste_binary.sh + # - addApplicationPrivileges.exp + # - password.txt + + # - name: Copy oraInst.loc + # ansible.builtin.template: + # src: "oraInst.loc.j2" + # dest: "/etc/oraInst.loc" + # owner: root + # group: root + # mode: "0755" + + # - name: Oracle BI Publisher paste binary from jar file + # become_user: oracle + # ansible.builtin.shell: | + # set -eo pipefail + # main() { + # echo "# pasteBinary.sh " + # {{ stage }}/pasteBinary.sh -javahome /usr/java/jdk1.7.0_80 -archiveLoc {{ stage }}/test_mw_copy.jar -targetMWHomeLoc {{ middleware_home }} -invPtrLoc /etc/oraInst.loc -logDirLoc {{ stage }}/logs -executeSysPrereqs false + # } + # main 2>&1 | logger -p local3.info -t ansible-oracle-bip + # async: 86400 + # poll: 60 + # when: not ansible_check_mode + + # - name: Execute oracleRoot.sh as root + # ansible.builtin.shell: | + # set -eo pipefail + # main() { + # echo "# oracleRoot.sh " + # {{ middleware_home }}/Oracle_BI1/oracleRoot.sh + # } + # main 2>&1 | logger -p local3.info -t ansible-oracle-bip + # when: not ansible_check_mode + + # - name: Collect file details for cleanup from nodemanager + # ansible.builtin.find: + # path: "{{ wl_home }}/common/nodemanager/" + # hidden: True + # register: collected_files + + # - name: remove collected files from nodemenager directory + # ansible.builtin.file: + # path: "{{ item.path }}" + # state: absent + # with_items: > + # {{ + # collected_files.files + # }} + + # - name: Generate obfuscate password files for OMS_MDS + # become_user: oracle + # ansible.builtin.shell: | + # set -eo pipefail + # main() { + # export CONFIG_JVM_ARGS="-Xmx2048M -Xms2048M" + # echo "# Create obfuscated password file for OAS_MDS " + # {{ stage }}/obfuscatePassword.exp {{ bipdb_mds_password }} {{ oas_mds_password_file }} + # } + # main 2>&1 | logger -p local3.info -t ansible-oracle-bip + + # - name: Generate obfuscate password files for OAS_BIPLATFORM + # become_user: oracle + # ansible.builtin.shell: | + # set -eo pipefail + # main() { + # export CONFIG_JVM_ARGS="-Xmx2048M -Xms2048M" + # echo "# Create obfuscated password file for OAS_BIPLATFORM " + # {{ stage }}/obfuscatePassword.exp {{ bipdb_biplatform_password }} {{ oas_biplatform_password_file }} + # } + # main 2>&1 | logger -p local3.info -t ansible-oracle-bip + + # - name: Generate obfuscate password files for weblogic + # become_user: oracle + # ansible.builtin.shell: | + # set -eo pipefail + # main() { + # export CONFIG_JVM_ARGS="-Xmx2048M -Xms2048M" + # echo "# Create obfuscated password file for WEBLOGIC " + # {{ stage }}/obfuscatePassword.exp {{ weblogic_admin_password }} {{ weblogic_password_file }} + # } + # main 2>&1 | logger -p local3.info -t ansible-oracle-bip + + # - name: Oracle BIP config cloning + # become_user: oracle + # ansible.builtin.shell: | + # set -eo pipefail + # main() { + # {{ middleware_home }}/oracle_common/bin/pasteConfig.sh \ + # -javahome /usr/java/jdk1.7.0_80 \ + # -archiveLoc {{ stage }}/bi_config_copy.jar \ + # -targetDomainLoc {{ domain_home }}/{{ domain_name }} \ + # -targetMWHomeLoc {{ middleware_home }} \ + # -domainAdminPasswordFile {{ stage }}/password.txt \ + # -movePlanLoc {{ stage }}/bi_config/moveplan.xml + # } + # main 2>&1 | logger -p local3.info -t ansible-oracle-bip + # async: 86400 + # poll: 60 + # when: not ansible_check_mode + + # - name: Collect file details for cleanup for mbase.bin and mbase.lck files + # ansible.builtin.find: + # path: "{{ domain_home }}/bifoundation_domain/config/bipublisher/repository/meta/" + # hidden: True + # register: collected_files + + # - name: remove collected files from nodemenager directory + # ansible.builtin.file: + # path: "{{ item.path }}" + # state: absent + # with_items: > + # {{ + # collected_files.files + # }} + + # - name: Collect file details for cleanup for mbase.bin and mbase.lck files + # ansible.builtin.find: + # path: "{{ wl_home }}/common/nodemanager/" + # hidden: True + # register: collected_files + + # - name: remove collected files from nodemenager directory + # ansible.builtin.file: + # path: "{{ item.path }}" + # state: absent + # with_items: > + # {{ + # 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 + # ansible.builtin.pause: + # minutes: 15 + + # - name: Oracle BIP NodeManager config cloning + # become_user: oracle + # ansible.builtin.shell: | + # set -eo pipefail + # main() { + # {{ middleware_home }}/oracle_common/bin/pasteConfig.sh \ + # -javahome /usr/java/jdk1.7.0_80 \ + # -archiveLoc {{ stage }}/nm.jar \ + # -targetnmhomeloc {{ wl_home }}/common/nodemanager \ + # -targetmwhomeloc {{ middleware_home }} \ + # -movePlanLoc {{ stage }}/nm/moveplan.xml \ + # -silent true + # } + # main 2>&1 | logger -p local3.info -t ansible-oracle-bip + # async: 86400 + # poll: 30 + # when: not ansible_check_mode - name: Start nodemanager become_user: oracle ansible.builtin.shell: | nohup /u01/app/oracle/Middleware/wlserver_10.3/server/bin/startNodeManager.sh & - - name: Start Adminserver + - name: Boot.properties file creation for bi_server1 + + + - name: Start BI_SERVER1 become_user: oracle ansible.builtin.shell: | - nohup /u01/app/oracle/Middleware/user_projects/domains/bifoundation_domain/bin/startWebLogic.sh & + nohup /u01/app/oracle/Middleware/user_projects/domains/bifoundation_domain/bin/startManagedWebLogic.sh bi_server1 & - - name: Pause for 5 minutes to let admin server start properly . + - name: Pause for 15 minutes to let admin server start properly . ansible.builtin.pause: minutes: 5 diff --git a/ansible/roles/oasys-bip/tasks/install-jdk.yml b/ansible/roles/oasys-bip/tasks/install-jdk.yml index 5e6639b6b..1e0961019 100644 --- a/ansible/roles/oasys-bip/tasks/install-jdk.yml +++ b/ansible/roles/oasys-bip/tasks/install-jdk.yml @@ -11,13 +11,14 @@ group: oinstall mode: "0755" loop: - - /u01/software/jdk + - "{{ stage }}" + - "{{ stage }}/jdk" - name: Get jdk rpm binary from S3 bucket amazon.aws.aws_s3: bucket: "{{ image_builder_s3_bucket_name }}" object: "oasys-bip{{ item }}" - dest: "{{ item }}" + dest: "{{ stage }}" mode: get overwrite: latest loop: @@ -26,7 +27,7 @@ - name: Install jdk rpm binary yum: - name: /u01/software/jdk/jdk-7u80-linux-x64.rpm + name: "{{ stage}}/jdk/jdk-7u80-linux-x64.rpm" state: present # block diff --git a/ansible/roles/oasys-bip/templates/bi_config_moveplan.xml b/ansible/roles/oasys-bip/templates/bi_config_moveplan.xml index b8544004f..38ddedd52 100644 --- a/ansible/roles/oasys-bip/templates/bi_config_moveplan.xml +++ b/ansible/roles/oasys-bip/templates/bi_config_moveplan.xml @@ -530,7 +530,7 @@ connection url - jdbc:oracle:thin:@{{ weblogic_db_hostname_a }}:1521:{{ oasys_db }} + jdbc:oracle:thin:@{{ oasys_db_server }}:1521:{{ oasys_db }} STRING READ_WRITE From f31411af12ac99f2730fcf16c4c719c7417dcbff Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Fri, 10 Nov 2023 16:59:26 +0000 Subject: [PATCH 12/19] Commit changes made by code formatters --- ansible/roles/oasys-bip/defaults/main.yml | 2 +- .../oasys-bip/tasks/clone_bip_software.yml | 33 +++++++++---------- .../templates/addBIPCodeGrants.py.j2 | 23 ++++++++----- 3 files changed, 30 insertions(+), 28 deletions(-) diff --git a/ansible/roles/oasys-bip/defaults/main.yml b/ansible/roles/oasys-bip/defaults/main.yml index 179d22c49..92bd65739 100644 --- a/ansible/roles/oasys-bip/defaults/main.yml +++ b/ansible/roles/oasys-bip/defaults/main.yml @@ -17,4 +17,4 @@ weblogic_password_file: "{{ stage }}/weblogic_password.txt" admin_password_file: "{{ stage }}/weblogic_password.txt" bip_repository_file: bip_repository_12Oct2023.tar oasys_db: T2OASYS -oasys_db_server: t2-oasys-db-a \ No newline at end of file +oasys_db_server: t2-oasys-db-a diff --git a/ansible/roles/oasys-bip/tasks/clone_bip_software.yml b/ansible/roles/oasys-bip/tasks/clone_bip_software.yml index 41f747f5b..a2dfc9d18 100644 --- a/ansible/roles/oasys-bip/tasks/clone_bip_software.yml +++ b/ansible/roles/oasys-bip/tasks/clone_bip_software.yml @@ -5,7 +5,6 @@ register: BIP_software_installed - block: - # - name: Create directories for moveplan and bip repository # ansible.builtin.file: # path: "{{ item }}" @@ -21,7 +20,7 @@ # - /u01/oracle # - /u01/app - # - name: Download software for Oracle BI Publisher cloning for Oasys + # - name: Download software for Oracle BI Publisher cloning for Oasys # amazon.aws.aws_s3: # bucket: "{{ image_builder_s3_bucket_name }}" # object: "oasys-bip/bipclone/{{ item }}" @@ -41,7 +40,7 @@ # ansible.builtin.file: # path: "{{ item }}" # owner: oracle - # group: oinstall + # group: oinstall # mode: '0700' # loop: # - "{{ stage }}/pasteBinary.sh" @@ -64,8 +63,7 @@ # remote_src: true # keep_newer: true - - # - name: Copy BIP plans for config and nodemanager + # - name: Copy BIP plans for config and nodemanager # ansible.builtin.template: # src: "{{ item }}_moveplan.xml" # dest: "{{ stage }}/{{ item }}/moveplan.xml" @@ -85,12 +83,12 @@ # mode: "0700" # loop: # - obfuscatePassword.exp - # - addBIPCodeGrants.py + # - addBIPCodeGrants.py # - bip_paste_binary.sh # - addApplicationPrivileges.exp # - password.txt - # - name: Copy oraInst.loc + # - name: Copy oraInst.loc # ansible.builtin.template: # src: "oraInst.loc.j2" # dest: "/etc/oraInst.loc" @@ -98,7 +96,7 @@ # group: root # mode: "0755" - # - name: Oracle BI Publisher paste binary from jar file + # - name: Oracle BI Publisher paste binary from jar file # become_user: oracle # ansible.builtin.shell: | # set -eo pipefail @@ -111,7 +109,7 @@ # poll: 60 # when: not ansible_check_mode - # - name: Execute oracleRoot.sh as root + # - name: Execute oracleRoot.sh as root # ansible.builtin.shell: | # set -eo pipefail # main() { @@ -187,7 +185,7 @@ # poll: 60 # when: not ansible_check_mode - # - name: Collect file details for cleanup for mbase.bin and mbase.lck files + # - name: Collect file details for cleanup for mbase.bin and mbase.lck files # ansible.builtin.find: # path: "{{ domain_home }}/bifoundation_domain/config/bipublisher/repository/meta/" # hidden: True @@ -202,7 +200,7 @@ # collected_files.files # }} - # - name: Collect file details for cleanup for mbase.bin and mbase.lck files + # - name: Collect file details for cleanup for mbase.bin and mbase.lck files # ansible.builtin.find: # path: "{{ wl_home }}/common/nodemanager/" # hidden: True @@ -217,11 +215,11 @@ # 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 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: Oracle BIP NodeManager config cloning + # - name: Oracle BIP NodeManager config cloning # become_user: oracle # ansible.builtin.shell: | # set -eo pipefail @@ -239,20 +237,19 @@ # poll: 30 # when: not ansible_check_mode - - name: Start nodemanager + - name: Start nodemanager become_user: oracle ansible.builtin.shell: | nohup /u01/app/oracle/Middleware/wlserver_10.3/server/bin/startNodeManager.sh & - - name: Boot.properties file creation for bi_server1 - + - name: Boot.properties file creation for bi_server1 - - name: Start BI_SERVER1 + - name: Start BI_SERVER1 become_user: oracle ansible.builtin.shell: | nohup /u01/app/oracle/Middleware/user_projects/domains/bifoundation_domain/bin/startManagedWebLogic.sh bi_server1 & - - name: Pause for 15 minutes to let admin server start properly . + - name: Pause for 15 minutes to let admin server start properly . ansible.builtin.pause: minutes: 5 diff --git a/ansible/roles/oasys-bip/templates/addBIPCodeGrants.py.j2 b/ansible/roles/oasys-bip/templates/addBIPCodeGrants.py.j2 index 681229e4a..cc285dee6 100644 --- a/ansible/roles/oasys-bip/templates/addBIPCodeGrants.py.j2 +++ b/ansible/roles/oasys-bip/templates/addBIPCodeGrants.py.j2 @@ -1,8 +1,12 @@ #!/usr/bin/python -import os, sys, inspect +import os +import sys +import inspect + def _getPathToThisFile(): - return os.path.dirname(inspect.getabsfile( inspect.currentframe() )) + return os.path.dirname(inspect.getabsfile(inspect.currentframe())) + sys.path.append(_getPathToThisFile()) @@ -13,11 +17,12 @@ WLSAdminPW = psw try: connect(WLSAdminUN, WLSAdminPW, WLSAdminUrl) - #saved_stdout = sys.stdout - #sys.stdout = open('_stdout.log', 'w') - + # saved_stdout = sys.stdout + # sys.stdout = open('_stdout.log', 'w') + try: - grantPermission(codeBaseURL="file:${oracle.deployed.app.dir}/bipublisher_11.1.1${oracle.deployed.app.ext}", permTarget="context=APPLICATION,name=obi", permClass="oracle.security.jps.service.policystore.PolicyStoreAccessPermission", permActions="containsAppRole") + grantPermission(codeBaseURL="file:${oracle.deployed.app.dir}/bipublisher_11.1.1${oracle.deployed.app.ext}", permTarget="context=APPLICATION,name=obi", + permClass="oracle.security.jps.service.policystore.PolicyStoreAccessPermission", permActions="containsAppRole") except: print >> sys.stdout, "Entry for BI Publisher already exist." @@ -25,11 +30,11 @@ try: print >> sys.stdout, "Entry for BI Publisher has been added successfully." sys.stdout.close() - #os.remove('_stdout.log') - #sys.stdout = saved_stdout + # os.remove('_stdout.log') + # sys.stdout = saved_stdout disconnect() # explicitly exit without errors. patching system requires this. exit() except: dumpStack() - raise \ No newline at end of file + raise From 5ea67c74af263b8e11b71f1b1e1f28c2d78481fc Mon Sep 17 00:00:00 2001 From: Dominic Robinson Date: Mon, 13 Nov 2023 17:35:13 +0000 Subject: [PATCH 13/19] Update to use secretsmanager --- ansible/roles/oasys-bip/defaults/main.yml | 44 ++++++++++++-- .../oasys-bip/tasks/clone_bip_software.yml | 30 +++++----- .../oasys-bip/tasks/create_bip_database.yml | 4 +- .../roles/oasys-bip/tasks/get-db-facts.yml | 40 ++++--------- ansible/roles/oasys-bip/tasks/get-facts.yml | 57 +++++++------------ .../templates/bi_config_moveplan.xml | 8 +-- 6 files changed, 92 insertions(+), 91 deletions(-) diff --git a/ansible/roles/oasys-bip/defaults/main.yml b/ansible/roles/oasys-bip/defaults/main.yml index 179d22c49..db7cb44b4 100644 --- a/ansible/roles/oasys-bip/defaults/main.yml +++ b/ansible/roles/oasys-bip/defaults/main.yml @@ -1,12 +1,25 @@ --- -ssm_parameters_prefix: "weblogic" +# Following tags must be set on the ASG +# oasys-environment: t2 +# bip-db-name: T2BIPINF +# bip-db-hostname: t2-oasys-db-a +# oasys-db-name: T2OASYS +# oasys-db-hostname: t2-oasys-db-a +# +# Following tags must be set on the DB +# bip-db-name: T2BIPINF + +oasys_environment: "{{ ec2.tags['oasys-environment'] }}" +bip_db_name: "{{ ec2.tags['bip-db-name'] }}" +bip_db_server: "{{ ec2.tags['bip-db-hostname'] }}" +oasys_db_name: "{{ ec2.tags['oasys-db-name'] }}" +oasys_db_server: "{{ ec2.tags['oasys-db-hostname'] }}" + weblogic_domain_hostname: "{{ ansible_facts.hostname }}" weblogic_servername: "{{ ansible_facts.hostname }}" middleware_home: /u01/app/oracle/Middleware wl_home: /u01/app/oracle/Middleware/wlserver_10.3 stage: /u01/stage -bip_db_server: 10.26.12.211 #should be part of ec2 instance tag -bip_db_name: T2BIPIN2 #should be part of ec2 instance tag oracle_install_user: oracle oracle_install_group: oinstall domain_name: bifoundation_domain @@ -16,5 +29,26 @@ oas_biplatform_password_file: "{{ stage }}/oas_biplatform_password.txt" weblogic_password_file: "{{ stage }}/weblogic_password.txt" admin_password_file: "{{ stage }}/weblogic_password.txt" bip_repository_file: bip_repository_12Oct2023.tar -oasys_db: T2OASYS -oasys_db_server: t2-oasys-db-a \ No newline at end of file +weblogic_admin_username: weblogic + +bip_weblogic_secretsmanager_secrets: + bipweb: + secret: "/oracle/bip/{{ oasys_environment }}/passwords" + users: + - weblogic: + bipdbshared: + secret: "/oracle/database/{{ bip_db_name }}/bip-passwords" + users: + - sys: + - mds: + - biplatform: + +bip_db_secretsmanager_secrets: + bipdbshared: + secret: "/oracle/database/{{ bip_db_name }}/bip-passwords" + users: + - sys: + bipdb: + secret: "/oracle/database/{{ bip_db_name }}/passwords" + users: + - system: diff --git a/ansible/roles/oasys-bip/tasks/clone_bip_software.yml b/ansible/roles/oasys-bip/tasks/clone_bip_software.yml index 41f747f5b..566a481c9 100644 --- a/ansible/roles/oasys-bip/tasks/clone_bip_software.yml +++ b/ansible/roles/oasys-bip/tasks/clone_bip_software.yml @@ -21,7 +21,7 @@ # - /u01/oracle # - /u01/app - # - name: Download software for Oracle BI Publisher cloning for Oasys + # - name: Download software for Oracle BI Publisher cloning for Oasys # amazon.aws.aws_s3: # bucket: "{{ image_builder_s3_bucket_name }}" # object: "oasys-bip/bipclone/{{ item }}" @@ -41,7 +41,7 @@ # ansible.builtin.file: # path: "{{ item }}" # owner: oracle - # group: oinstall + # group: oinstall # mode: '0700' # loop: # - "{{ stage }}/pasteBinary.sh" @@ -65,7 +65,7 @@ # keep_newer: true - # - name: Copy BIP plans for config and nodemanager + # - name: Copy BIP plans for config and nodemanager # ansible.builtin.template: # src: "{{ item }}_moveplan.xml" # dest: "{{ stage }}/{{ item }}/moveplan.xml" @@ -85,12 +85,12 @@ # mode: "0700" # loop: # - obfuscatePassword.exp - # - addBIPCodeGrants.py + # - addBIPCodeGrants.py # - bip_paste_binary.sh # - addApplicationPrivileges.exp # - password.txt - # - name: Copy oraInst.loc + # - name: Copy oraInst.loc # ansible.builtin.template: # src: "oraInst.loc.j2" # dest: "/etc/oraInst.loc" @@ -98,7 +98,7 @@ # group: root # mode: "0755" - # - name: Oracle BI Publisher paste binary from jar file + # - name: Oracle BI Publisher paste binary from jar file # become_user: oracle # ansible.builtin.shell: | # set -eo pipefail @@ -111,7 +111,7 @@ # poll: 60 # when: not ansible_check_mode - # - name: Execute oracleRoot.sh as root + # - name: Execute oracleRoot.sh as root # ansible.builtin.shell: | # set -eo pipefail # main() { @@ -187,7 +187,7 @@ # poll: 60 # when: not ansible_check_mode - # - name: Collect file details for cleanup for mbase.bin and mbase.lck files + # - name: Collect file details for cleanup for mbase.bin and mbase.lck files # ansible.builtin.find: # path: "{{ domain_home }}/bifoundation_domain/config/bipublisher/repository/meta/" # hidden: True @@ -202,7 +202,7 @@ # collected_files.files # }} - # - name: Collect file details for cleanup for mbase.bin and mbase.lck files + # - name: Collect file details for cleanup for mbase.bin and mbase.lck files # ansible.builtin.find: # path: "{{ wl_home }}/common/nodemanager/" # hidden: True @@ -217,11 +217,11 @@ # 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 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: Oracle BIP NodeManager config cloning + # - name: Oracle BIP NodeManager config cloning # become_user: oracle # ansible.builtin.shell: | # set -eo pipefail @@ -239,20 +239,20 @@ # poll: 30 # when: not ansible_check_mode - - name: Start nodemanager + - name: Start nodemanager become_user: oracle ansible.builtin.shell: | nohup /u01/app/oracle/Middleware/wlserver_10.3/server/bin/startNodeManager.sh & - - name: Boot.properties file creation for bi_server1 + # - name: Boot.properties file creation for bi_server1 - - name: Start BI_SERVER1 + - name: Start BI_SERVER1 become_user: oracle ansible.builtin.shell: | nohup /u01/app/oracle/Middleware/user_projects/domains/bifoundation_domain/bin/startManagedWebLogic.sh bi_server1 & - - name: Pause for 15 minutes to let admin server start properly . + - name: Pause for 15 minutes to let admin server start properly . ansible.builtin.pause: minutes: 5 diff --git a/ansible/roles/oasys-bip/tasks/create_bip_database.yml b/ansible/roles/oasys-bip/tasks/create_bip_database.yml index f927548b3..cf91b20d4 100644 --- a/ansible/roles/oasys-bip/tasks/create_bip_database.yml +++ b/ansible/roles/oasys-bip/tasks/create_bip_database.yml @@ -24,8 +24,8 @@ set -eo pipefail main() { echo "# create_recovery_catalog_db.sh " - {{ stage }}/create_bip_db.sh {{ db_name }} {{ db_sys_password }} {{ db_system_password }} - . oraenv <<< {{ db_name }} + {{ stage }}/create_bip_db.sh {{ bip_db_name }} {{ bipdb_sys_password }} {{ bipdb_system_password }} + . oraenv <<< {{ bip_db_name }} sqlplus / as sysdba @add_hidden_parameter.sql } main 2>&1 | logger -p local3.info -t ansible-oracle-db diff --git a/ansible/roles/oasys-bip/tasks/get-db-facts.yml b/ansible/roles/oasys-bip/tasks/get-db-facts.yml index bd8eaec7f..21a4efe2a 100644 --- a/ansible/roles/oasys-bip/tasks/get-db-facts.yml +++ b/ansible/roles/oasys-bip/tasks/get-db-facts.yml @@ -1,42 +1,26 @@ --- -- name: Get server name - set_fact: - server_name: '{{ ec2.tags["server-name"] }}' - -- name: Extract environment from server name - set_fact: - environment_name: "{{ server_name[:2] | upper }}" +- name: Get secrets + import_role: + name: secretsmanager-passwords + vars: + secretsmanager_passwords: "{{ bip_db_secretsmanager_secrets }}" -- name: Set database name +- name: Set secret facts set_fact: - # db_name: "{{ environment_name }}BIPINF" - db_name: T2BIPIN2 + bipdb_sys_password: "{{ secretsmanager_passwords_dict['bipdbshared'].passwords['sys'] }}" + bipdb_system_password: "{{ secretsmanager_passwords_dict['bipdb'].passwords['system'] }}" - name: Fail if missing parameters fail: - msg: "Ensure {{ db_name }} variable is defined in db_configs fact" - when: db_configs[db_name] is not defined - -- name: Set SSM parameters path fact from ec2 ssm-parameters-prefix and Name tag - set_fact: - ssm_parameters_path: '/{{ ec2.tags["ssm-parameters-prefix"] }}{{ ec2.tags["Name"] }}' - -- name: Set SSM parameters database path facts - set_fact: - ssm_parameters_path_db_sys_password: "{{ ssm_parameters_path }}/{{ db_name}}/syspassword" - ssm_parameters_path_db_system_password: "{{ ssm_parameters_path }}/{{ db_name }}/systempassword" - -- name: Get SSM parameters - set_fact: - db_sys_password: "{{ lookup('aws_ssm', ssm_parameters_path_db_sys_password, region=ansible_ec2_placement_region) }}" - db_system_password: "{{ lookup('aws_ssm', ssm_parameters_path_db_system_password, region=ansible_ec2_placement_region) }}" + msg: "Ensure {{ bip_db_name }} variable is defined in db_configs fact" + when: db_configs[bip_db_name] is not defined - name: Check parameters set_fact: db_all_variables_set: true when: - - db_sys_password|length > 0 - - db_system_password| length > 0 + - bipdb_sys_password|length > 0 + - bipdb_system_password| length > 0 - name: Fail if missing parameters fail: diff --git a/ansible/roles/oasys-bip/tasks/get-facts.yml b/ansible/roles/oasys-bip/tasks/get-facts.yml index 4380d46af..2b56c2dae 100644 --- a/ansible/roles/oasys-bip/tasks/get-facts.yml +++ b/ansible/roles/oasys-bip/tasks/get-facts.yml @@ -1,41 +1,22 @@ --- -- name: Set SSM parameters path fact from ec2 ssm-parameters-prefix and Name tag - set_fact: - ssm_parameters_path: '/{{ ssm_parameters_prefix }}/{{ ec2.tags["Name"] }}' - when: ssm_parameters_path is not defined - -- name: Set SSM parameters weblogic path facts - set_fact: - ssm_parameters_path_weblogic_admin_username: "{{ ssm_parameters_path }}/admin_username" - ssm_parameters_path_weblogic_admin_password: "{{ ssm_parameters_path }}/admin_password" - ssm_parameters_path_weblogic_db_username: "{{ ssm_parameters_path }}/db_username" - ssm_parameters_path_weblogic_db_password: "{{ ssm_parameters_path }}/db_password" - ssm_parameters_path_bipdb_sys_password: "{{ ssm_parameters_path }}/syspassword" - ssm_parameters_path_bipdb_biplatform_password: "{{ ssm_parameters_path }}/biplatformpassword" - ssm_parameters_path_bipdb_mds_password: "{{ ssm_parameters_path }}/mdspassword" +- name: Get secrets + import_role: + name: secretsmanager-passwords + vars: + secretsmanager_passwords: "{{ bip_weblogic_secretsmanager_secrets }}" -- name: Get SSM parameters +- name: Set secret facts set_fact: - weblogic_admin_username: "{{ lookup('aws_ssm', ssm_parameters_path_weblogic_admin_username, region=ansible_ec2_placement_region) }}" - weblogic_admin_password: "{{ lookup('aws_ssm', ssm_parameters_path_weblogic_admin_password, region=ansible_ec2_placement_region) }}" - bipdb_sys_password: "{{ lookup('aws_ssm', ssm_parameters_path_bipdb_sys_password, region=ansible_ec2_placement_region) }}" - bipdb_biplatform_password: "{{ lookup('aws_ssm', ssm_parameters_path_bipdb_biplatform_password, region=ansible_ec2_placement_region) }}" - bipdb_mds_password: "{{ lookup('aws_ssm', ssm_parameters_path_bipdb_mds_password, region=ansible_ec2_placement_region) }}" - when: weblogic_admin_username is not defined + weblogic_admin_password: "{{ secretsmanager_passwords_dict['bipweb'].passwords['weblogic'] }}" + bipdb_sys_password: "{{ secretsmanager_passwords_dict['bipdbshared'].passwords['sys'] }}" + bipdb_biplatform_password: "{{ secretsmanager_passwords_dict['bipdbshared'].passwords['biplatform'] }}" + bipdb_mds_password: "{{ secretsmanager_passwords_dict['bipdbshared'].passwords['mds'] }}" -- name: Set db hostname from ec2 oracle-db-hostname tag - set_fact: - weblogic_db_hostname_a: "{{ ec2.tags['oracle-db-hostname-a'] }}" - weblogic_db_hostname_b: "{{ ec2.tags['oracle-db-hostname-b'] }}" - -- name: Set db name from ec2 oracle-db-name tag - set_fact: - # weblogic_db_name: "{{ ec2.tags['oracle-db-name'] }}" - weblogic_db_name: "T2BIPIN2" - when: weblogic_db_name is not defined +- debug: + msg: "Configuring BIP DB {{ bip_db_name }} on {{ bip_db_server }}" - debug: - msg: "Configuring Oracle DB {{ weblogic_db_name }} on {{ weblogic_db_hostname_a }},{{ weblogic_db_hostname_b }}" + msg: "Configuring OASys DB {{ oasys_db_name }} on {{ oasys_db_server }}" - debug: msg: "Configuring Admin console {{ weblogic_domain_hostname }} with username {{ weblogic_admin_username }}" @@ -46,11 +27,13 @@ when: - weblogic_admin_username|length > 0 - weblogic_admin_password|length > 0 - - weblogic_db_hostname_a|length > 0 - - weblogic_db_hostname_b|length > 0 - - bipdb_sys_password| length> 0 - - bipdb_biplatform_password| length> 0 - - bipdb_mds_password| length> 0 + - bip_db_name|length > 0 + - bip_db_server|length > 0 + - oasys_db_name|length > 0 + - oasys_db_server|length > 0 + - bipdb_sys_password|length> 0 + - bipdb_biplatform_password|length> 0 + - bipdb_mds_password|length> 0 - name: Fail if missing SSM parameters or tags fail: diff --git a/ansible/roles/oasys-bip/templates/bi_config_moveplan.xml b/ansible/roles/oasys-bip/templates/bi_config_moveplan.xml index 38ddedd52..f19654eae 100644 --- a/ansible/roles/oasys-bip/templates/bi_config_moveplan.xml +++ b/ansible/roles/oasys-bip/templates/bi_config_moveplan.xml @@ -186,7 +186,7 @@ Url - jdbc:oracle:thin:@{{ weblogic_db_hostname_a }}:1521/{{ weblogic_db_name }} + jdbc:oracle:thin:@{{ bip_db_server }}:1521/{{ bip_db_name }} STRING READ_WRITE @@ -229,7 +229,7 @@ Url - jdbc:oracle:thin:@{{ weblogic_db_hostname_a }}:1521/{{ weblogic_db_name }} + jdbc:oracle:thin:@{{ bip_db_server }}:1521/{{ bip_db_name }} STRING READ_WRITE @@ -272,7 +272,7 @@ Url - jdbc:oracle:thin:@{{ weblogic_db_hostname_a }}:1521/{{ weblogic_db_name }} + jdbc:oracle:thin:@{{ bip_db_server }}:1521/{{ bip_db_name }} STRING READ_WRITE @@ -530,7 +530,7 @@ connection url - jdbc:oracle:thin:@{{ oasys_db_server }}:1521:{{ oasys_db }} + jdbc:oracle:thin:@{{ oasys_db_server }}:1521:{{ oasys_db_name }} STRING READ_WRITE From 182cb07cfa7575aad44e40dd058c82dc3e80fa14 Mon Sep 17 00:00:00 2001 From: sandhya Gandalwar Date: Tue, 14 Nov 2023 16:29:09 +0000 Subject: [PATCH 14/19] Successfully tested code --- .../oasys-bip/tasks/clone_bip_software.yml | 445 +++++++++--------- ansible/roles/oasys-bip/tasks/install-jdk.yml | 2 +- 2 files changed, 218 insertions(+), 229 deletions(-) diff --git a/ansible/roles/oasys-bip/tasks/clone_bip_software.yml b/ansible/roles/oasys-bip/tasks/clone_bip_software.yml index a54bf8c4c..9337950af 100644 --- a/ansible/roles/oasys-bip/tasks/clone_bip_software.yml +++ b/ansible/roles/oasys-bip/tasks/clone_bip_software.yml @@ -5,258 +5,247 @@ register: BIP_software_installed - block: - # - name: Create directories for moveplan and bip repository - # ansible.builtin.file: - # path: "{{ item }}" - # state: directory - # owner: oracle - # group: oinstall - # mode: "0755" - # loop: - # - "{{ stage }}" - # - "{{ stage }}/nm" - # - "{{ stage }}/bi_config" - # - "{{ stage }}/logs" - # - /u01/oracle - # - /u01/app + - name: Create directories for moveplan and bip repository + ansible.builtin.file: + path: "{{ item }}" + state: directory + owner: oracle + group: oinstall + mode: "0755" + loop: + - "{{ stage }}" + - "{{ stage }}/nm" + - "{{ stage }}/bi_config" + - "{{ stage }}/logs" + - /u01/oracle + - /u01/app - # - name: Download software for Oracle BI Publisher cloning for Oasys - # amazon.aws.aws_s3: - # bucket: "{{ image_builder_s3_bucket_name }}" - # object: "oasys-bip/bipclone/{{ item }}" - # dest: "{{ stage}}/{{ item }}" - # mode: get - # overwrite: latest - # loop: - # - test_mw_copy.jar - # - bi_config_copy.jar - # - cloningclient.jar - # - nm.jar - # - pasteBinary.sh - # - "{{ bip_repository_file}}" - # when: image_builder_s3_bucket_name is defined + - name: Download software for Oracle BI Publisher cloning for Oasys + amazon.aws.aws_s3: + bucket: "{{ image_builder_s3_bucket_name }}" + object: "oasys-bip/bipclone/{{ item }}" + dest: "{{ stage}}/{{ item }}" + mode: get + overwrite: latest + loop: + - test_mw_copy.jar + - bi_config_copy.jar + - cloningclient.jar + - nm.jar + - pasteBinary.sh + - "{{ bip_repository_file}}" + when: image_builder_s3_bucket_name is defined - # - name: Change file ownership, group and permissions - # ansible.builtin.file: - # path: "{{ item }}" - # owner: oracle - # group: oinstall - # mode: '0700' - # loop: - # - "{{ stage }}/pasteBinary.sh" - # - "{{ stage }}/cloningclient.jar" + - name: Change file ownership, group and permissions + ansible.builtin.file: + path: "{{ item }}" + owner: oracle + group: oinstall + mode: '0700' + loop: + - "{{ stage }}/pasteBinary.sh" + - "{{ stage }}/cloningclient.jar" - # - name: Create a symbolic link - # ansible.builtin.file: - # src: /u01/oracle - # dest: /oracle - # owner: oracle - # group: oinstall - # state: link + - name: Create a symbolic link + ansible.builtin.file: + src: /u01/oracle + dest: /oracle + owner: oracle + group: oinstall + state: link - # - name: Extract bip_repository - # ansible.builtin.unarchive: - # owner: oracle - # group: oinstall - # src: "{{ stage }}/{{ bip_repository_file }}" - # dest: /u01/oracle - # remote_src: true - # keep_newer: true + - name: Extract bip_repository + ansible.builtin.unarchive: + owner: oracle + group: oinstall + src: "{{ stage }}/{{ bip_repository_file }}" + dest: /u01/oracle + remote_src: true + keep_newer: true -<<<<<<< HEAD + - name: Copy BIP plans for config and nodemanager + ansible.builtin.template: + src: "{{ item }}_moveplan.xml" + dest: "{{ stage }}/{{ item }}/moveplan.xml" + owner: oracle + group: oinstall + mode: "0700" + loop: + - nm + - bi_config -======= ->>>>>>> f31411af12ac99f2730fcf16c4c719c7417dcbff - # - name: Copy BIP plans for config and nodemanager - # ansible.builtin.template: - # src: "{{ item }}_moveplan.xml" - # dest: "{{ stage }}/{{ item }}/moveplan.xml" - # owner: oracle - # group: oinstall - # mode: "0700" - # loop: - # - nm - # - bi_config + - name: Copy script templates to obfuscate password and to add Privileges for Application Roles + ansible.builtin.template: + src: "{{ item }}.j2" + dest: "{{ stage }}/{{ item }}" + owner: oracle + group: oinstall + mode: "0700" + loop: + - obfuscatePassword.exp + - addBIPCodeGrants.py + - bip_paste_binary.sh + - addApplicationPrivileges.exp + - password.txt + - boot.properties - # - name: Copy script templates to obfuscate password and to add Privileges for Application Roles - # ansible.builtin.template: - # src: "{{ item }}.j2" - # dest: "{{ stage }}/{{ item }}" - # owner: oracle - # group: oinstall - # mode: "0700" - # loop: - # - obfuscatePassword.exp - # - addBIPCodeGrants.py - # - bip_paste_binary.sh - # - addApplicationPrivileges.exp - # - password.txt + - name: Copy oraInst.loc + ansible.builtin.template: + src: "oraInst.loc.j2" + dest: "/etc/oraInst.loc" + owner: root + group: root + mode: "0755" - # - name: Copy oraInst.loc - # ansible.builtin.template: - # src: "oraInst.loc.j2" - # dest: "/etc/oraInst.loc" - # owner: root - # group: root - # mode: "0755" - - # - name: Oracle BI Publisher paste binary from jar file - # become_user: oracle - # ansible.builtin.shell: | - # set -eo pipefail - # main() { - # echo "# pasteBinary.sh " - # {{ stage }}/pasteBinary.sh -javahome /usr/java/jdk1.7.0_80 -archiveLoc {{ stage }}/test_mw_copy.jar -targetMWHomeLoc {{ middleware_home }} -invPtrLoc /etc/oraInst.loc -logDirLoc {{ stage }}/logs -executeSysPrereqs false - # } - # main 2>&1 | logger -p local3.info -t ansible-oracle-bip - # async: 86400 - # poll: 60 - # when: not ansible_check_mode - - # - name: Execute oracleRoot.sh as root - # ansible.builtin.shell: | - # set -eo pipefail - # main() { - # echo "# oracleRoot.sh " - # {{ middleware_home }}/Oracle_BI1/oracleRoot.sh - # } - # main 2>&1 | logger -p local3.info -t ansible-oracle-bip - # when: not ansible_check_mode - - # - name: Collect file details for cleanup from nodemanager - # ansible.builtin.find: - # path: "{{ wl_home }}/common/nodemanager/" - # hidden: True - # register: collected_files - - # - name: remove collected files from nodemenager directory - # ansible.builtin.file: - # path: "{{ item.path }}" - # state: absent - # with_items: > - # {{ - # collected_files.files - # }} - - # - name: Generate obfuscate password files for OMS_MDS - # become_user: oracle - # ansible.builtin.shell: | - # set -eo pipefail - # main() { - # export CONFIG_JVM_ARGS="-Xmx2048M -Xms2048M" - # echo "# Create obfuscated password file for OAS_MDS " - # {{ stage }}/obfuscatePassword.exp {{ bipdb_mds_password }} {{ oas_mds_password_file }} - # } - # main 2>&1 | logger -p local3.info -t ansible-oracle-bip + - name: Oracle BI Publisher paste binary from jar file + become_user: oracle + ansible.builtin.shell: | + set -eo pipefail + main() { + echo "# pasteBinary.sh " + {{ stage }}/pasteBinary.sh -javahome /usr/java/jdk1.7.0_80 -archiveLoc {{ stage }}/test_mw_copy.jar -targetMWHomeLoc {{ middleware_home }} -invPtrLoc /etc/oraInst.loc -logDirLoc {{ stage }}/logs -executeSysPrereqs false + } + main 2>&1 | logger -p local3.info -t ansible-oracle-bip + async: 86400 + poll: 60 + when: not ansible_check_mode - # - name: Generate obfuscate password files for OAS_BIPLATFORM - # become_user: oracle - # ansible.builtin.shell: | - # set -eo pipefail - # main() { - # export CONFIG_JVM_ARGS="-Xmx2048M -Xms2048M" - # echo "# Create obfuscated password file for OAS_BIPLATFORM " - # {{ stage }}/obfuscatePassword.exp {{ bipdb_biplatform_password }} {{ oas_biplatform_password_file }} - # } - # main 2>&1 | logger -p local3.info -t ansible-oracle-bip + - name: Execute oracleRoot.sh as root + ansible.builtin.shell: | + set -eo pipefail + main() { + echo "# oracleRoot.sh " + {{ middleware_home }}/Oracle_BI1/oracleRoot.sh + } + main 2>&1 | logger -p local3.info -t ansible-oracle-bip + when: not ansible_check_mode - # - name: Generate obfuscate password files for weblogic - # become_user: oracle - # ansible.builtin.shell: | - # set -eo pipefail - # main() { - # export CONFIG_JVM_ARGS="-Xmx2048M -Xms2048M" - # echo "# Create obfuscated password file for WEBLOGIC " - # {{ stage }}/obfuscatePassword.exp {{ weblogic_admin_password }} {{ weblogic_password_file }} - # } - # main 2>&1 | logger -p local3.info -t ansible-oracle-bip + - name: Collect file details for cleanup from nodemanager + ansible.builtin.find: + path: "{{ wl_home }}/common/nodemanager/" + hidden: True + register: collected_files - # - name: Oracle BIP config cloning - # become_user: oracle - # ansible.builtin.shell: | - # set -eo pipefail - # main() { - # {{ middleware_home }}/oracle_common/bin/pasteConfig.sh \ - # -javahome /usr/java/jdk1.7.0_80 \ - # -archiveLoc {{ stage }}/bi_config_copy.jar \ - # -targetDomainLoc {{ domain_home }}/{{ domain_name }} \ - # -targetMWHomeLoc {{ middleware_home }} \ - # -domainAdminPasswordFile {{ stage }}/password.txt \ - # -movePlanLoc {{ stage }}/bi_config/moveplan.xml - # } - # main 2>&1 | logger -p local3.info -t ansible-oracle-bip - # async: 86400 - # poll: 60 - # when: not ansible_check_mode + - name: remove collected files from nodemenager directory + ansible.builtin.file: + path: "{{ item.path }}" + state: absent + with_items: > + {{ + collected_files.files + }} - # - name: Collect file details for cleanup for mbase.bin and mbase.lck files - # ansible.builtin.find: - # path: "{{ domain_home }}/bifoundation_domain/config/bipublisher/repository/meta/" - # hidden: True - # register: collected_files + - name: Generate obfuscate password files for OMS_MDS + become_user: oracle + ansible.builtin.shell: | + set -eo pipefail + main() { + export CONFIG_JVM_ARGS="-Xmx2048M -Xms2048M" + echo "# Create obfuscated password file for OAS_MDS " + {{ stage }}/obfuscatePassword.exp {{ bipdb_mds_password }} {{ oas_mds_password_file }} + } + main 2>&1 | logger -p local3.info -t ansible-oracle-bip - # - name: remove collected files from nodemenager directory - # ansible.builtin.file: - # path: "{{ item.path }}" - # state: absent - # with_items: > - # {{ - # collected_files.files - # }} + - name: Generate obfuscate password files for OAS_BIPLATFORM + become_user: oracle + ansible.builtin.shell: | + set -eo pipefail + main() { + export CONFIG_JVM_ARGS="-Xmx2048M -Xms2048M" + echo "# Create obfuscated password file for OAS_BIPLATFORM " + {{ stage }}/obfuscatePassword.exp {{ bipdb_biplatform_password }} {{ oas_biplatform_password_file }} + } + main 2>&1 | logger -p local3.info -t ansible-oracle-bip - # - name: Collect file details for cleanup for mbase.bin and mbase.lck files - # ansible.builtin.find: - # path: "{{ wl_home }}/common/nodemanager/" - # hidden: True - # register: collected_files + - name: Generate obfuscate password files for weblogic + become_user: oracle + ansible.builtin.shell: | + set -eo pipefail + main() { + export CONFIG_JVM_ARGS="-Xmx2048M -Xms2048M" + echo "# Create obfuscated password file for WEBLOGIC " + {{ stage }}/obfuscatePassword.exp {{ weblogic_admin_password }} {{ weblogic_password_file }} + } + main 2>&1 | logger -p local3.info -t ansible-oracle-bip - # - name: remove collected files from nodemenager directory - # ansible.builtin.file: - # path: "{{ item.path }}" - # state: absent - # with_items: > - # {{ - # collected_files.files - # }} + - name: Oracle BIP config cloning + become_user: oracle + ansible.builtin.shell: | + set -eo pipefail + main() { + {{ middleware_home }}/oracle_common/bin/pasteConfig.sh \ + -javahome /usr/java/jdk1.7.0_80 \ + -archiveLoc {{ stage }}/bi_config_copy.jar \ + -targetDomainLoc {{ domain_home }}/{{ domain_name }} \ + -targetMWHomeLoc {{ middleware_home }} \ + -domainAdminPasswordFile {{ stage }}/password.txt \ + -movePlanLoc {{ stage }}/bi_config/moveplan.xml + } + main 2>&1 | logger -p local3.info -t ansible-oracle-bip + async: 86400 + poll: 60 + when: not ansible_check_mode - # - 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: Collect file details for cleanup for mbase.bin and mbase.lck files + ansible.builtin.find: + path: "{{ domain_home }}/bifoundation_domain/config/bipublisher/repository/meta/" + hidden: True + register: collected_files - # - name: Oracle BIP NodeManager config cloning - # become_user: oracle - # ansible.builtin.shell: | - # set -eo pipefail - # main() { - # {{ middleware_home }}/oracle_common/bin/pasteConfig.sh \ - # -javahome /usr/java/jdk1.7.0_80 \ - # -archiveLoc {{ stage }}/nm.jar \ - # -targetnmhomeloc {{ wl_home }}/common/nodemanager \ - # -targetmwhomeloc {{ middleware_home }} \ - # -movePlanLoc {{ stage }}/nm/moveplan.xml \ - # -silent true - # } - # main 2>&1 | logger -p local3.info -t ansible-oracle-bip - # async: 86400 - # poll: 30 - # when: not ansible_check_mode + - name: remove collected files from nodemenager directory + ansible.builtin.file: + path: "{{ item.path }}" + state: absent + with_items: > + {{ + collected_files.files + }} - - name: Start nodemanager - become_user: oracle - ansible.builtin.shell: | - nohup /u01/app/oracle/Middleware/wlserver_10.3/server/bin/startNodeManager.sh & + - name: Collect file details for cleanup for mbase.bin and mbase.lck files + ansible.builtin.find: + path: "{{ wl_home }}/common/nodemanager/" + hidden: True + register: collected_files - # - name: Boot.properties file creation for bi_server1 + - name: remove collected files from nodemenager directory + ansible.builtin.file: + path: "{{ item.path }}" + state: absent + with_items: > + {{ + 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 + ansible.builtin.pause: + minutes: 15 - - name: Start BI_SERVER1 + - name: Oracle BIP NodeManager config cloning become_user: oracle ansible.builtin.shell: | - nohup /u01/app/oracle/Middleware/user_projects/domains/bifoundation_domain/bin/startManagedWebLogic.sh bi_server1 & + set -eo pipefail + main() { + {{ middleware_home }}/oracle_common/bin/pasteConfig.sh \ + -javahome /usr/java/jdk1.7.0_80 \ + -archiveLoc {{ stage }}/nm.jar \ + -targetnmhomeloc {{ wl_home }}/common/nodemanager \ + -targetmwhomeloc {{ middleware_home }} \ + -movePlanLoc {{ stage }}/nm/moveplan.xml \ + -silent true + } + main 2>&1 | logger -p local3.info -t ansible-oracle-bip + async: 86400 + poll: 30 + when: not ansible_check_mode - - name: Pause for 15 minutes to let admin server start properly . - ansible.builtin.pause: - minutes: 5 + - name: Boot.properties file creation for bi_server1 + ansible.builtin.copy: + src: "{{ domain_home }}/{{ domain_name }}/servers/AdminServer/security/boot.properties" + dest: "{{ domain_home }}/{{ domain_name }}/servers/bi_server1/security/boot.properties" + owner: oracle + group: oinstall + mode: "0600" + remote_src: true - name: Enable Standalone BI Publisher to Add Privileges for Application Roles become_user: oracle diff --git a/ansible/roles/oasys-bip/tasks/install-jdk.yml b/ansible/roles/oasys-bip/tasks/install-jdk.yml index 1e0961019..6a819893e 100644 --- a/ansible/roles/oasys-bip/tasks/install-jdk.yml +++ b/ansible/roles/oasys-bip/tasks/install-jdk.yml @@ -18,7 +18,7 @@ amazon.aws.aws_s3: bucket: "{{ image_builder_s3_bucket_name }}" object: "oasys-bip{{ item }}" - dest: "{{ stage }}" + dest: "{{ stage }}/jdk/jdk-7u80-linux-x64.rpm" mode: get overwrite: latest loop: From f55eedcb8505d8eed84653bd4ea37e54bf713c59 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 14 Nov 2023 16:30:13 +0000 Subject: [PATCH 15/19] Commit changes made by code formatters --- ansible/roles/oasys-bip/tasks/clone_bip_software.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ansible/roles/oasys-bip/tasks/clone_bip_software.yml b/ansible/roles/oasys-bip/tasks/clone_bip_software.yml index 9337950af..574747af2 100644 --- a/ansible/roles/oasys-bip/tasks/clone_bip_software.yml +++ b/ansible/roles/oasys-bip/tasks/clone_bip_software.yml @@ -41,7 +41,7 @@ path: "{{ item }}" owner: oracle group: oinstall - mode: '0700' + mode: "0700" loop: - "{{ stage }}/pasteBinary.sh" - "{{ stage }}/cloningclient.jar" From 377e8411cc5709984ee836eb18b156c01867bd48 Mon Sep 17 00:00:00 2001 From: sandhya Gandalwar Date: Thu, 16 Nov 2023 10:15:18 +0000 Subject: [PATCH 16/19] Updated bip install to include cleanup step at the end of install --- ansible/roles/oasys-bip/defaults/main.yml | 5 + ansible/roles/oasys-bip/tasks/cleanup.yml | 23 ++++ .../oasys-bip/tasks/clone_bip_software.yml | 21 ++- ansible/roles/oasys-bip/tasks/main.yml | 23 ++++ ansible/roles/oasys-bip/tasks/service.yml | 30 ---- ansible/roles/oasys-bip/tasks/services.yml | 60 ++++++++ .../oasys-bip/tasks/setup-log-rotate.yml | 43 ++++++ .../systemd/system/wls_adminserver.service | 12 ++ .../systemd/system/wls_managedserver.service | 13 ++ .../systemd/system/wls_nodemanager.service | 12 ++ .../10.3/home/oracle/admin/scripts/README.md | 23 ++++ .../admin/scripts/set_ms_log_rotation.py | 57 ++++++++ .../admin/scripts/startManagedWebLogic.sh | 11 ++ .../oracle/admin/scripts/startNodeManager.sh | 11 ++ .../oracle/admin/scripts/startWebLogic.sh | 11 ++ .../admin/scripts/stopManagedWebLogic.sh | 54 ++++++++ .../oracle/admin/scripts/stopNodeManager.sh | 47 +++++++ .../home/oracle/admin/scripts/stopWebLogic.sh | 53 +++++++ .../admin/scripts/waitManagedWebLogic.sh | 11 ++ .../oracle/admin/scripts/waitNodeManager.sh | 11 ++ .../home/oracle/admin/scripts/waitWebLogic.sh | 11 ++ .../admin/scripts/wait_for_entry_in_log.sh | 34 +++++ .../oracle/admin/scripts/weblogic.properties | 2 + .../oracle/admin/scripts/weblogicControl.py | 130 ++++++++++++++++++ .../templates/AdminServer.properties | 7 + .../oasys-bip/templates/bi_server1.properties | 8 ++ .../oasys-bip/templates/domain.properties | 15 ++ 27 files changed, 706 insertions(+), 32 deletions(-) create mode 100644 ansible/roles/oasys-bip/tasks/cleanup.yml delete mode 100644 ansible/roles/oasys-bip/tasks/service.yml create mode 100644 ansible/roles/oasys-bip/tasks/services.yml create mode 100644 ansible/roles/oasys-bip/tasks/setup-log-rotate.yml create mode 100644 ansible/roles/oasys-bip/templates/10.3/etc/systemd/system/wls_adminserver.service create mode 100644 ansible/roles/oasys-bip/templates/10.3/etc/systemd/system/wls_managedserver.service create mode 100644 ansible/roles/oasys-bip/templates/10.3/etc/systemd/system/wls_nodemanager.service create mode 100644 ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/README.md create mode 100644 ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/set_ms_log_rotation.py create mode 100755 ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/startManagedWebLogic.sh create mode 100755 ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/startNodeManager.sh create mode 100755 ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/startWebLogic.sh create mode 100755 ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/stopManagedWebLogic.sh create mode 100755 ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/stopNodeManager.sh create mode 100755 ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/stopWebLogic.sh create mode 100755 ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/waitManagedWebLogic.sh create mode 100755 ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/waitNodeManager.sh create mode 100755 ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/waitWebLogic.sh create mode 100755 ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/wait_for_entry_in_log.sh create mode 100644 ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/weblogic.properties create mode 100644 ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/weblogicControl.py create mode 100644 ansible/roles/oasys-bip/templates/AdminServer.properties create mode 100644 ansible/roles/oasys-bip/templates/bi_server1.properties create mode 100644 ansible/roles/oasys-bip/templates/domain.properties diff --git a/ansible/roles/oasys-bip/defaults/main.yml b/ansible/roles/oasys-bip/defaults/main.yml index db7cb44b4..f44949582 100644 --- a/ansible/roles/oasys-bip/defaults/main.yml +++ b/ansible/roles/oasys-bip/defaults/main.yml @@ -30,6 +30,11 @@ weblogic_password_file: "{{ stage }}/weblogic_password.txt" admin_password_file: "{{ stage }}/weblogic_password.txt" bip_repository_file: bip_repository_12Oct2023.tar weblogic_admin_username: weblogic +managed_server: bi_server1 +scripts_dir: /home/oracle/admin/scripts +weblogic_servers: + - { name: bi_server1 } + - { name: AdminServer } bip_weblogic_secretsmanager_secrets: bipweb: diff --git a/ansible/roles/oasys-bip/tasks/cleanup.yml b/ansible/roles/oasys-bip/tasks/cleanup.yml new file mode 100644 index 000000000..8199aa5de --- /dev/null +++ b/ansible/roles/oasys-bip/tasks/cleanup.yml @@ -0,0 +1,23 @@ +--- +- name: Collect file details for cleanup from {{ stage }} + ansible.builtin.find: + path: "{{ stage }}" + hidden: True + register: collected_files + +- name: Collect directory details for cleanup from {{ stage }} + ansible.builtin.find: + paths: "{{ stage }}" + hidden: True + file_type: directory + register: collected_directories + +- name: remove collected files and directories + ansible.builtin.file: + path: "{{ item.path }}" + state: absent + with_items: > + {{ + collected_files.files + + collected_directories.files + }} diff --git a/ansible/roles/oasys-bip/tasks/clone_bip_software.yml b/ansible/roles/oasys-bip/tasks/clone_bip_software.yml index 574747af2..f13ad6a69 100644 --- a/ansible/roles/oasys-bip/tasks/clone_bip_software.yml +++ b/ansible/roles/oasys-bip/tasks/clone_bip_software.yml @@ -41,7 +41,7 @@ path: "{{ item }}" owner: oracle group: oinstall - mode: "0700" + mode: '0700' loop: - "{{ stage }}/pasteBinary.sh" - "{{ stage }}/cloningclient.jar" @@ -218,7 +218,7 @@ - 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 + minutes: 10 - name: Oracle BIP NodeManager config cloning become_user: oracle @@ -247,6 +247,10 @@ 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 + ansible.builtin.pause: + minutes: 10 + - name: Enable Standalone BI Publisher to Add Privileges for Application Roles become_user: oracle ansible.builtin.shell: | @@ -258,5 +262,18 @@ main 2>&1 | logger -p local3.info -t ansible-oracle-bip when: not ansible_check_mode + - name: Stop Weblogic and nodemanager + become_user: oracle + ansible.builtin.shell: | + set -eo pipefail + main() { + . {{ wl_home }}/server/bin/setWLSEnv.sh + {{ domain_home }}/{{ domain_name }}/bin/stoptWebLogic.sh + kill -9 `ps -ef | grep weblogic.NodeManager|grep -v grep | awk '{ print $2 " " $3 }'` + } + main 2>&1 | logger -p local3.info -t ansible-oracle-bip + when: not ansible_check_mode + + # block when: not BIP_software_installed.stat.exists diff --git a/ansible/roles/oasys-bip/tasks/main.yml b/ansible/roles/oasys-bip/tasks/main.yml index a03144257..e4cefb8e9 100644 --- a/ansible/roles/oasys-bip/tasks/main.yml +++ b/ansible/roles/oasys-bip/tasks/main.yml @@ -47,6 +47,29 @@ - amibuild - ec2provision + - import_tasks: services.yml + tags: + - amibuild + - ec2provision + + - include_tasks: + file: setup-log-rotate.yml + apply: + tags: + - ec2provision + - weblogic_setup_log_rotate + tags: + - ec2provision + - weblogic_setup_log_rotate + loop_control: + loop_var: weblogic_managed_app_list + loop: "{{ weblogic_servers }}" + + - import_tasks: cleanup.yml + tags: + - amibuild + - ec2provision + when: ansible_distribution in ['RedHat', 'OracleLinux'] and ansible_distribution_major_version == "7" - import_tasks: get-db-facts.yml diff --git a/ansible/roles/oasys-bip/tasks/service.yml b/ansible/roles/oasys-bip/tasks/service.yml deleted file mode 100644 index 6d715004b..000000000 --- a/ansible/roles/oasys-bip/tasks/service.yml +++ /dev/null @@ -1,30 +0,0 @@ ---- -- name: Copy systemd unit file for weblogic - ansible.builtin.template: - src: "10.3/{{ item }}" - dest: "{{ item }}" - loop: - - /etc/systemd/system/wls_nodemanager.service - - /etc/systemd/system/wls_adminserver.service - - /etc/systemd/system/wls_managedserver.service - -- name: Enable weblogic services - ansible.builtin.systemd: - name: "{{ item }}" - daemon_reload: yes - enabled: yes - loop: - - wls_nodemanager - - wls_adminserver - - wls_managedserver - -- name: Start weblogic services - ansible.builtin.systemd: - name: "{{ item }}" - state: "started" - loop: - - wls_nodemanager - - wls_adminserver - - wls_managedserver - async: 3600 - poll: 60 diff --git a/ansible/roles/oasys-bip/tasks/services.yml b/ansible/roles/oasys-bip/tasks/services.yml new file mode 100644 index 000000000..031cca039 --- /dev/null +++ b/ansible/roles/oasys-bip/tasks/services.yml @@ -0,0 +1,60 @@ +--- + +- name: Create scripts install directory + ansible.builtin.file: + path: "{{ scripts_dir }}" + state: directory + owner: oracle + group: oinstall + mode: "0700" + +- name: Copy nodemanager systemd helper scripts + ansible.builtin.template: + src: "10.3{{ item }}" + dest: "{{ item }}" + mode: "0755" + owner: oracle + group: oinstall + loop: + - "{{ scripts_dir }}/startNodeManager.sh" + - "{{ scripts_dir }}/waitNodeManager.sh" + - "{{ scripts_dir }}/stopNodeManager.sh" + - "{{ scripts_dir }}/startWebLogic.sh" + - "{{ scripts_dir }}/waitWebLogic.sh" + - "{{ scripts_dir }}/stopWebLogic.sh" + - "{{ scripts_dir }}/startManagedWebLogic.sh" + - "{{ scripts_dir }}/waitManagedWebLogic.sh" + - "{{ scripts_dir }}/stopManagedWebLogic.sh" + - "{{ scripts_dir }}/wait_for_entry_in_log.sh" + - "{{ scripts_dir }}/set_ms_log_rotation.py" + +- name: Copy weblogic systemd service + ansible.builtin.template: + src: "10.3{{ item }}" + dest: "{{ item }}" + loop: + - /etc/systemd/system/wls_nodemanager.service + - /etc/systemd/system/wls_adminserver.service + - /etc/systemd/system/wls_managedserver.service + +- name: Run systemd reload + ansible.builtin.systemd: + daemon_reload: true + +- name: Enable wls_nodemanager service + ansible.builtin.service: + name: "{{ item }}" + enabled: yes + loop: + - wls_nodemanager + - wls_adminserver + - wls_managedserver + +- name: Start weblogic services + ansible.builtin.service: + name: "{{ item }}" + state: started + loop: + - wls_nodemanager + - wls_adminserver + - wls_managedserver diff --git a/ansible/roles/oasys-bip/tasks/setup-log-rotate.yml b/ansible/roles/oasys-bip/tasks/setup-log-rotate.yml new file mode 100644 index 000000000..764c40f0a --- /dev/null +++ b/ansible/roles/oasys-bip/tasks/setup-log-rotate.yml @@ -0,0 +1,43 @@ +--- +- name: Set weblogic managed app facts + 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: + src: "{{ item }}" + dest: "{{ stage }}/{{ item }}" + owner: oracle + group: oinstall + loop: + - "{{ weblogic_managed_app }}.properties" + + - name: Configure log setup + become_user: oracle + ansible.builtin.shell: | + set -eo pipefail + . ~/.bash_profile + . $WL_HOME/server/bin/setWLSEnv.sh + main() { + echo "# configure log setup app {{ weblogic_managed_app }}" + java weblogic.WLST {{ scripts_dir }}/set_ms_log_rotation.py -p {{ stage }}/{{ weblogic_managed_app }}.properties + } + main 2>&1 | logger -s -p local3.info -t ansible-xtag-weblogic + + always: + - name: Remove temporary install files + ansible.builtin.file: + path: "{{ item }}" + state: absent + loop: + - "{{ stage }}/{{ weblogic_managed_app }}.properties" diff --git a/ansible/roles/oasys-bip/templates/10.3/etc/systemd/system/wls_adminserver.service b/ansible/roles/oasys-bip/templates/10.3/etc/systemd/system/wls_adminserver.service new file mode 100644 index 000000000..9ce1fea16 --- /dev/null +++ b/ansible/roles/oasys-bip/templates/10.3/etc/systemd/system/wls_adminserver.service @@ -0,0 +1,12 @@ +[Unit] +Description=WebLogic Admin Server + +[Service] +Type=simple +TimeoutStartSec=120 +ExecStart={{ scripts_dir }}/startWebLogic.sh +ExecStartPost={{ scripts_dir }}/waitWebLogic.sh +ExecStop={{ scripts_dir }}/stopWebLogic.sh + +[Install] +WantedBy=multi-user.target diff --git a/ansible/roles/oasys-bip/templates/10.3/etc/systemd/system/wls_managedserver.service b/ansible/roles/oasys-bip/templates/10.3/etc/systemd/system/wls_managedserver.service new file mode 100644 index 000000000..771937137 --- /dev/null +++ b/ansible/roles/oasys-bip/templates/10.3/etc/systemd/system/wls_managedserver.service @@ -0,0 +1,13 @@ +[Unit] +Description=WebLogic managed server Service + +[Service] +Type=simple +After=wls_adminserver +TimeoutStartSec=180 +ExecStart={{ scripts_dir }}/startManagedWebLogic.sh +ExecStartPost={{ scripts_dir }}/waitManagedWebLogic.sh +ExecStop={{ scripts_dir }}/stopManagedWebLogic.sh + +[Install] +WantedBy=multi-user.target diff --git a/ansible/roles/oasys-bip/templates/10.3/etc/systemd/system/wls_nodemanager.service b/ansible/roles/oasys-bip/templates/10.3/etc/systemd/system/wls_nodemanager.service new file mode 100644 index 000000000..34fff51e3 --- /dev/null +++ b/ansible/roles/oasys-bip/templates/10.3/etc/systemd/system/wls_nodemanager.service @@ -0,0 +1,12 @@ +[Unit] +Description=WebLogic NodeManager Service + +[Service] +Type=simple +TimeoutStartSec=60 +ExecStart={{ scripts_dir }}/startNodeManager.sh +ExecStartPost={{ scripts_dir }}/waitNodeManager.sh +ExecStop={{ scripts_dir }}/stopNodeManager.sh + +[Install] +WantedBy=multi-user.target diff --git a/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/README.md b/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/README.md new file mode 100644 index 000000000..b19a12f88 --- /dev/null +++ b/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/README.md @@ -0,0 +1,23 @@ +The python scripts in this directory are designed to be run with wlst. +Credentials should be picked up automatically from boot.properties + +Setting environment + +``` +. $WL_HOME/server/bin/setWLSEnv.sh +. /u01/app/oracle/Middleware/user_projects/domains/NomisDomain/bin/setDomainEnv.sh +``` + +Checking managed server status +``` +wlst.sh ~/admin/scripts/ms_state.py +``` + +Use systemctl scripts for starting and stopping each individual component. +This ensures any component output goes to /var/log/messages. + +``` +systemctl start wls_nodemanager +systemctl start wls_adminserver +systemctl start wls_managedserver +``` diff --git a/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/set_ms_log_rotation.py b/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/set_ms_log_rotation.py new file mode 100644 index 000000000..49a3df0a7 --- /dev/null +++ b/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/set_ms_log_rotation.py @@ -0,0 +1,57 @@ +#!/usr/bin/python + +from java.io import FileInputStream +import time +import getopt +import sys +import re + +# Get location of the properties file. +properties = '' +try: + opts, args = getopt.getopt(sys.argv[1:], "p:h::", ["properies="]) +except getopt.GetoptError: + print 'set_ms_log_rotation.py -p ' + sys.exit(2) +for opt, arg in opts: + if opt == '-h': + print 'set_ms_log_rotation.py -p ' + sys.exit() + elif opt in ("-p", "--properties"): + properties = arg +print 'properties=', properties + +# Load the properties from the properties file. + +propInputStream = FileInputStream(properties) +configProps = Properties() +configProps.load(propInputStream) + +# Set all variables from values in properties file. +adminUsername = configProps.get("admin.username") +adminPassword = configProps.get("admin.password") +adminURL = configProps.get("admin.url") +msName = configProps.get("ms.name") + +# Connect to the AdminServer. +connect(adminUsername, adminPassword, adminURL) + +edit() +startEdit() + +# Manage logging. +cd('/Servers/' + msName + '/Log/' + msName) +cmo.setRotationType('bySize') +cmo.setFileMinSize(50000) +cmo.setNumberOfFilesLimited(true) +cmo.setFileCount(10) +cmo.setRedirectStderrToServerLogEnabled(false) +cmo.setRedirectStdoutToServerLogEnabled(false) +cmo.setMemoryBufferSeverity('Debug') +cmo.setLogFileSeverity('Trace') + +save() +activate() + +disconnect() +exit() diff --git a/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/startManagedWebLogic.sh b/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/startManagedWebLogic.sh new file mode 100755 index 000000000..f2b0c8f89 --- /dev/null +++ b/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/startManagedWebLogic.sh @@ -0,0 +1,11 @@ +#!/bin/bash +if [[ $(whoami) == "root" ]]; then + echo 'su - oracle -c ". {{ wl_home }}/server/bin/setWLSEnv.sh && {{ domain_home }}/{{ domain_name }}/bin/startManagedWebLogic.sh {{ managed_server }}"' + su - oracle -c ". {{ wl_home }}/server/bin/setWLSEnv.sh && {{ domain_home }}/{{ domain_name }}/bin/startManagedWebLogic.sh {{ managed_server }}" + exitcode=$? + echo "Started: exitcode=$exitcode" + exit $exitcode +else + echo "must be run as root" + exit 1 +fi \ No newline at end of file diff --git a/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/startNodeManager.sh b/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/startNodeManager.sh new file mode 100755 index 000000000..7dec44f85 --- /dev/null +++ b/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/startNodeManager.sh @@ -0,0 +1,11 @@ +#!/bin/bash +if [[ $(whoami) == "root" ]]; then + echo 'su - oracle -c {{ wl_home }}/server/bin/startNodeManager.sh' + su - oracle -c {{ wl_home }}/server/bin/startNodeManager.sh + exitcode=$? + echo "Started: exitcode=$exitcode" + exit $exitcode +else + echo "must be run as root" + exit 1 +fi diff --git a/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/startWebLogic.sh b/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/startWebLogic.sh new file mode 100755 index 000000000..ace2f53c2 --- /dev/null +++ b/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/startWebLogic.sh @@ -0,0 +1,11 @@ +#!/bin/bash +if [[ $(whoami) == "root" ]]; then + echo 'su - oracle -c {{ domain_home }}/{{ domain_name }}/bin/startWebLogic.sh' + su - oracle -c {{ domain_home }}/{{ domain_name }}/bin/startWebLogic.sh + exitcode=$? + echo "Started: exitcode=$exitcode" + exit $exitcode +else + echo "must be run as root" + exit 1 +fi diff --git a/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/stopManagedWebLogic.sh b/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/stopManagedWebLogic.sh new file mode 100755 index 000000000..3f4050851 --- /dev/null +++ b/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/stopManagedWebLogic.sh @@ -0,0 +1,54 @@ +#!/bin/bash + +get_process_pids() { + process_pids1=$(pgrep -u oracle -f "startManagedWebLogic.sh$" 2> /dev/null) + process_pids2=$(pgrep -u oracle -f "weblogic.Name={{ managed_server }}" 2> /dev/null) + [[ -z $process_pids1 && -z $process_pids2 ]] && return 1 + ( + for process_pid in $process_pids1 $process_pids2; do + pstree -ap "$process_pid" | grep -v '{' | cut -d, -f2 | cut -d\ -f1 + done + ) | sort -u | tr '\n' ' ' +} + +stop_process() { + if ! PIDS=$(get_process_pids); then + echo "already stopped" + return 0 + fi + + timeout 60 {{ domain_home }}/{{ domain_name }}/bin/stopManagedWebLogic.sh {{ managed_server }} + + if ! PIDS=$(get_process_pids); then + echo "stopped" + return 0 + fi + + echo "kill $PIDS" + kill $PIDS + sleep 2 + + if ! get_process_pids > /dev/null; then + echo "stopped" + return 0 + fi + + sleep 5 + if ! PIDS=$(get_process_pids); then + echo "stopped after 5 seconds" + return 0 + fi + + echo "kill -9 $PIDS" + kill -9 $PIDS + sleep 2 + + if ! PIDS=$(get_process_pids); then + echo "stopped after kill -9" + return 0 + fi + echo "could not kill $PIDS" + return 1 +} + +stop_process diff --git a/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/stopNodeManager.sh b/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/stopNodeManager.sh new file mode 100755 index 000000000..09accd5fe --- /dev/null +++ b/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/stopNodeManager.sh @@ -0,0 +1,47 @@ +#!/bin/bash + +get_process_pids() { + process_pids1=$(pgrep -u oracle -f "startNodeManager.sh$" 2> /dev/null) + process_pids2=$(pgrep -u oracle -f "weblogic.NodeManager" 2> /dev/null) + [[ -z $process_pids1 && -z $process_pids2 ]] && return 1 + ( + for process_pid in $process_pids1 $process_pids2; do + pstree -ap "$process_pid" | grep -v '{' | cut -d, -f2 | cut -d\ -f1 + done + ) | sort -u | tr '\n' ' ' +} + +stop_process() { + if ! PIDS=$(get_process_pids); then + echo "already stopped" + return 0 + fi + + echo "kill $PIDS" + kill $PIDS + sleep 2 + + if ! get_process_pids > /dev/null; then + echo "stopped" + return 0 + fi + + sleep 5 + if ! PIDS=$(get_process_pids); then + echo "stopped after 5 seconds" + return 0 + fi + + echo "kill -9 $PIDS" + kill -9 $PIDS + sleep 2 + + if ! PIDS=$(get_process_pids); then + echo "stopped after kill -9" + return 0 + fi + echo "could not kill $PIDS" + return 1 +} + +stop_process diff --git a/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/stopWebLogic.sh b/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/stopWebLogic.sh new file mode 100755 index 000000000..dfff32726 --- /dev/null +++ b/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/stopWebLogic.sh @@ -0,0 +1,53 @@ +#!/bin/bash + +get_process_pids() { + process_pids1=$(pgrep -u oracle -f "startWebLogic.sh$" 2> /dev/null) + [[ -z $process_pids1 ]] && return 1 + ( + for process_pid in $process_pids1; do + pstree -ap "$process_pid" | grep -v '{' | cut -d, -f2 | cut -d\ -f1 + done + ) | sort -u | tr '\n' ' ' +} + +stop_process() { + if ! PIDS=$(get_process_pids); then + echo "already stopped" + return 0 + fi + + timeout 60 {{ domain_home }}/{{ domain_name }}/bin/stopWebLogic.sh + + if ! PIDS=$(get_process_pids); then + echo "stopped" + return 0 + fi + + echo "kill $PIDS" + kill $PIDS + sleep 2 + + if ! get_process_pids > /dev/null; then + echo "stopped" + return 0 + fi + + sleep 5 + if ! PIDS=$(get_process_pids); then + echo "stopped after 5 seconds" + return 0 + fi + + echo "kill -9 $PIDS" + kill -9 $PIDS + sleep 2 + + if ! PIDS=$(get_process_pids); then + echo "stopped after kill -9" + return 0 + fi + echo "could not kill $PIDS" + return 1 +} + +stop_process diff --git a/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/waitManagedWebLogic.sh b/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/waitManagedWebLogic.sh new file mode 100755 index 000000000..607473117 --- /dev/null +++ b/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/waitManagedWebLogic.sh @@ -0,0 +1,11 @@ +#!/bin/bash +if [[ $(whoami) == "root" ]]; then + echo 'wait_for_entry_in_log.sh wls_managedserver.service "Server started in RUNNING mode" "startManagedWebLogic.sh"' + {{ scripts_dir }}/wait_for_entry_in_log.sh wls_managedserver.service "Server started in RUNNING mode" "startManagedWebLogic.sh" + exitcode=$? + echo "Waited: exitcode=$exitcode" + exit $exitcode +else + echo "must be run as root" + return 1 +fi diff --git a/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/waitNodeManager.sh b/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/waitNodeManager.sh new file mode 100755 index 000000000..15c1b2950 --- /dev/null +++ b/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/waitNodeManager.sh @@ -0,0 +1,11 @@ +#!/bin/bash +if [[ $(whoami) == "root" ]]; then + echo 'wait_for_entry_in_log.sh wls_nodemanager.service "listener started" "startNodeManager.sh"' + {{ scripts_dir }}/wait_for_entry_in_log.sh wls_nodemanager.service "listener started" "startNodeManager.sh" + exitcode=$? + echo "Waited: exitcode=$exitcode" + exit $exitcode +else + echo "must be run as root" + return 1 +fi diff --git a/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/waitWebLogic.sh b/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/waitWebLogic.sh new file mode 100755 index 000000000..b5c8875ce --- /dev/null +++ b/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/waitWebLogic.sh @@ -0,0 +1,11 @@ +#!/bin/bash +if [[ $(whoami) == "root" ]]; then + echo 'wait_for_entry_in_log.sh wls_adminserver.service "Server started in RUNNING mode" "startWebLogic.sh"' + {{ scripts_dir }}/wait_for_entry_in_log.sh wls_adminserver.service "Server started in RUNNING mode" "startWebLogic.sh" + exitcode=$? + echo "Waited: exitcode=$exitcode" + exit $exitcode +else + echo "must be run as root" + return 1 +fi diff --git a/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/wait_for_entry_in_log.sh b/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/wait_for_entry_in_log.sh new file mode 100755 index 000000000..a8e29467e --- /dev/null +++ b/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/wait_for_entry_in_log.sh @@ -0,0 +1,34 @@ +#!/bin/bash +logfile=$1 +match_pattern=$2 +filter_pattern=$3 +if [[ -z $match_pattern ]]; then + echo "Usage $0 []" >&2 + exit 1 +fi +if [[ -e "$logfile" ]]; then + # wait until a matching line found in the log file + # only way I could get this to work was to spawn tail in a subshell + if [[ -z $filter_pattern ]]; then + ( tail -f -n0 "$logfile" & ) | grep -qE "${match_pattern}" + else + ( tail -f -n0 "$logfile" & ) | grep -qE "${filter_pattern}(.*)${match_pattern}" + fi + # kill the tail subshell. It's not so easy to find the pid + pid=$(ps -o pid= -o cmd --forest -g $(ps -o sid= -p $$) | grep -F "tail -f -n0 $logfile" | grep -v grep | cut -d\ -f1) + [[ -n $pid ]] && kill $pid 2> /dev/null + exit 0 +elif [[ "$logfile" =~ .service$ ]]; then + if [[ -z $filter_pattern ]]; then + ( journalctl -u $logfile -f -S -10s & ) | grep -qE "${match_pattern}" + else + ( journalctl -u $logfile -f -S -10s & ) | grep -qE "${filter_pattern}(.*)${match_pattern}" + fi + # kill the tail subshell. It's not so easy to find the pid + pid=$(ps -o pid= -o cmd --forest -g $(ps -o sid= -p $$) | grep -F "tail -f -n0 $logfile" | grep -v grep | cut -d\ -f1) + [[ -n $pid ]] && kill $pid 2> /dev/null + exit 0 +else + echo "$logfile not found" >&2 + exit 1 +fi diff --git a/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/weblogic.properties b/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/weblogic.properties new file mode 100644 index 000000000..0beca34a8 --- /dev/null +++ b/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/weblogic.properties @@ -0,0 +1,2 @@ +domain.adminServerName=AdminServer +domain.adminurl={{ weblogic_domain_hostname }}:7001 diff --git a/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/weblogicControl.py b/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/weblogicControl.py new file mode 100644 index 000000000..5c900c125 --- /dev/null +++ b/ansible/roles/oasys-bip/templates/10.3/home/oracle/admin/scripts/weblogicControl.py @@ -0,0 +1,130 @@ +# --------------------------------------------------------- +# Check the status of all WL instances including the admin +# --------------------------------------------------------- +import sys +from java.io import FileInputStream + +propInputStream = FileInputStream( + "{{ script_dir }}/weblogic.properties") +configProps = Properties() +configProps.load(propInputStream) +domainName = configProps.get("domain.name") +domainHome = configProps.get("domain.home") +wlConfigFile = configProps.get("domain.configfile") +wlKeyFile = configProps.get("domain.keyfile") +nmConfigFile = configProps.get("nm.configfile") +nmKeyFile = configProps.get("nm.keyfile") +nmHome = configProps.get("nm.home") +nmPort = configProps.get("nm.port") +nmMachines = configProps.get("nm.host") +adminUrl = configProps.get("domain.adminurl") +adminServerName = configProps.get("domain.adminServerName") + + +def conn(): + try: + connect(userConfigFile=wlConfigFile, + userKeyFile=wlKeyFile, url=adminUrl) + except ConnectionException, e: + print 'Unable to find admin server' + exit() + + +def ServerState(server): + if server != 'wls': + nmConnect(userConfigFile=nmConfigFile, userKeyFile=nmKeyFile, port=nmPort, + host=nmMachines, domainName=domainName, domainDir=domainHome, nmType='Plain') + nmServerStatus(server) + exit() + else: + conn() + serverNames = cmo.getServers() + domainRuntime() + print 'Fetching state of every WebLogic instance' + print '' + for name in serverNames: + cd("/ServerLifeCycleRuntimes/" + name.getName()) + serverState = cmo.getState() + print '%-20s' % (name.getName()) + serverState + disconnect() + exit() + + +def nmConn(machine): + try: + nmConnect(userConfigFile=nmConfigFile, userKeyFile=nmKeyFile, port=nmPort, + host=nmMachines, domainName=domainName, domainDir=domainHome, nmType='Plain') + status = "SUCCESS" + except ConnectionException, e: + status = "FAILED" + print 'Nodemanager Connection: ' + status + + +def nmStartNM(machine): + try: + nmConnect(userConfigFile=nmConfigFile, userKeyFile=nmKeyFile, port=nmPort, + host=nmMachines, domainName=domainName, domainDir=domainHome, nmType='Plain') + print 'Nodemanager already running' + + except: + print 'start nodemaneger except' + startNodeManager(verbose='false', NodeManagerHome=nmHome, + ListenPort=nmPort, ListenAddress=nmMachines) + + +def nmStop(): + try: + nmConnect(userConfigFile=nmConfigFile, userKeyFile=nmKeyFile, port=nmPort, + host=nmMachines, domainName=domainName, domainDir=domainHome, nmType='Plain') + stopNodeManager() + print 'Stopped nodemanager' + except: + print 'Reached exception for nmstop' + + +def nmStartAS(): + try: + nmStart(adminServerName) + except: + print 'Issues starting admin server' + + +if __name__ == "main": + action = sys.argv[1] + module = sys.argv[2] + if action == 'status': + if module == 'nm': + nmConn(nmMachines) + exit() + elif module == 'wls': + ServerState(module) + elif module == 'as': + ServerState(adminServerName) + elif action == 'stop': + if module == 'as': + conn() + shutdown(adminServerName, 'Server', 'true', 0, block='true') + disconnect() + exit() + elif module == 'ms': + msname = sys.argv[3] + nmConn(nmMachines) + nmKill(msname) + exit() + elif module == 'nm': + nmStop() + exit() + elif action == 'start': + if module == 'ms': + msname = sys.argv[3] + nmConn(nmMachines) + nmStart(msname) + exit() + elif module == 'nm': + print nmMachines + nmStartNM(nmMachines) + exit() + elif module == 'as': + nmConn(nmMachines) + nmStartAS() + exit() diff --git a/ansible/roles/oasys-bip/templates/AdminServer.properties b/ansible/roles/oasys-bip/templates/AdminServer.properties new file mode 100644 index 000000000..9976e6d1f --- /dev/null +++ b/ansible/roles/oasys-bip/templates/AdminServer.properties @@ -0,0 +1,7 @@ +# AdminServer connection details. +admin.username={{ weblogic_admin_username }} +admin.password={{ weblogic_admin_password }} +admin.url={{ weblogic_domain_hostname }}:7001 + +# Managed Server +ms.name=AdminServer \ No newline at end of file diff --git a/ansible/roles/oasys-bip/templates/bi_server1.properties b/ansible/roles/oasys-bip/templates/bi_server1.properties new file mode 100644 index 000000000..f800abb72 --- /dev/null +++ b/ansible/roles/oasys-bip/templates/bi_server1.properties @@ -0,0 +1,8 @@ +# AdminServer Connection + +admin.username={{ weblogic_admin_username }} +admin.password={{ weblogic_admin_password }} +admin.url={{ weblogic_domain_hostname }}:7001 + +# Managed Server +ms.name=bi_server1 diff --git a/ansible/roles/oasys-bip/templates/domain.properties b/ansible/roles/oasys-bip/templates/domain.properties new file mode 100644 index 000000000..45d64e651 --- /dev/null +++ b/ansible/roles/oasys-bip/templates/domain.properties @@ -0,0 +1,15 @@ +# Paths +path.middleware={{ middleware_home }} +path.wls={{ wl_home }} +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.address={{ weblogic_domain_hostname }} + +# Domain details +domain.name={{ domain_name }} +machine={{ weblogic_domain_hostname }} From d558b5245cd1f9579f247a8b9d3d922b5428d639 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 16 Nov 2023 10:16:22 +0000 Subject: [PATCH 17/19] Commit changes made by code formatters --- ansible/roles/oasys-bip/tasks/clone_bip_software.yml | 5 ++--- ansible/roles/oasys-bip/tasks/services.yml | 3 +-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/ansible/roles/oasys-bip/tasks/clone_bip_software.yml b/ansible/roles/oasys-bip/tasks/clone_bip_software.yml index f13ad6a69..4dad9b865 100644 --- a/ansible/roles/oasys-bip/tasks/clone_bip_software.yml +++ b/ansible/roles/oasys-bip/tasks/clone_bip_software.yml @@ -41,7 +41,7 @@ path: "{{ item }}" owner: oracle group: oinstall - mode: '0700' + mode: "0700" loop: - "{{ stage }}/pasteBinary.sh" - "{{ stage }}/cloningclient.jar" @@ -262,7 +262,7 @@ main 2>&1 | logger -p local3.info -t ansible-oracle-bip when: not ansible_check_mode - - name: Stop Weblogic and nodemanager + - name: Stop Weblogic and nodemanager become_user: oracle ansible.builtin.shell: | set -eo pipefail @@ -274,6 +274,5 @@ main 2>&1 | logger -p local3.info -t ansible-oracle-bip when: not ansible_check_mode - # block when: not BIP_software_installed.stat.exists diff --git a/ansible/roles/oasys-bip/tasks/services.yml b/ansible/roles/oasys-bip/tasks/services.yml index 031cca039..8221adcd6 100644 --- a/ansible/roles/oasys-bip/tasks/services.yml +++ b/ansible/roles/oasys-bip/tasks/services.yml @@ -1,5 +1,4 @@ --- - - name: Create scripts install directory ansible.builtin.file: path: "{{ scripts_dir }}" @@ -50,7 +49,7 @@ - wls_adminserver - wls_managedserver -- name: Start weblogic services +- name: Start weblogic services ansible.builtin.service: name: "{{ item }}" state: started From 023836cc32691993d3df6bcc2b184470051bc335 Mon Sep 17 00:00:00 2001 From: sandhya Gandalwar Date: Thu, 16 Nov 2023 14:16:29 +0000 Subject: [PATCH 18/19] Final code --- .../roles/oasys-bip/tasks/clone_bip_software.yml | 12 ------------ ansible/roles/oasys-bip/tasks/services.yml | 13 +++++++++++++ 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/ansible/roles/oasys-bip/tasks/clone_bip_software.yml b/ansible/roles/oasys-bip/tasks/clone_bip_software.yml index 4dad9b865..e74a8f3e8 100644 --- a/ansible/roles/oasys-bip/tasks/clone_bip_software.yml +++ b/ansible/roles/oasys-bip/tasks/clone_bip_software.yml @@ -262,17 +262,5 @@ main 2>&1 | logger -p local3.info -t ansible-oracle-bip when: not ansible_check_mode - - name: Stop Weblogic and nodemanager - become_user: oracle - ansible.builtin.shell: | - set -eo pipefail - main() { - . {{ wl_home }}/server/bin/setWLSEnv.sh - {{ domain_home }}/{{ domain_name }}/bin/stoptWebLogic.sh - kill -9 `ps -ef | grep weblogic.NodeManager|grep -v grep | awk '{ print $2 " " $3 }'` - } - main 2>&1 | logger -p local3.info -t ansible-oracle-bip - when: not ansible_check_mode - # block when: not BIP_software_installed.stat.exists diff --git a/ansible/roles/oasys-bip/tasks/services.yml b/ansible/roles/oasys-bip/tasks/services.yml index 8221adcd6..8ca9bb49e 100644 --- a/ansible/roles/oasys-bip/tasks/services.yml +++ b/ansible/roles/oasys-bip/tasks/services.yml @@ -1,4 +1,17 @@ --- + +- name: Stop Weblogic and nodemanager + become_user: oracle + ansible.builtin.shell: | + set -eo pipefail + main() { + . {{ wl_home }}/server/bin/setWLSEnv.sh + {{ domain_home }}/{{ domain_name }}/bin/stopWebLogic.sh + kill -9 `ps -ef | grep weblogic.NodeManager|grep -v grep | awk '{ print $2 " " $3 }'` + } + main 2>&1 | logger -p local3.info -t ansible-oracle-bip + when: not ansible_check_mode + - name: Create scripts install directory ansible.builtin.file: path: "{{ scripts_dir }}" From 620477aeffcf796559f0a8aa6aa17988f92bf060 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 16 Nov 2023 14:17:21 +0000 Subject: [PATCH 19/19] Commit changes made by code formatters --- ansible/roles/oasys-bip/tasks/services.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/ansible/roles/oasys-bip/tasks/services.yml b/ansible/roles/oasys-bip/tasks/services.yml index 8ca9bb49e..2c37fdce8 100644 --- a/ansible/roles/oasys-bip/tasks/services.yml +++ b/ansible/roles/oasys-bip/tasks/services.yml @@ -1,5 +1,4 @@ --- - - name: Stop Weblogic and nodemanager become_user: oracle ansible.builtin.shell: |