Skip to content

Commit

Permalink
Merge pull request #340 from ministryofjustice/ncr-sh-configs
Browse files Browse the repository at this point in the history
Added more logic related to patching
  • Loading branch information
crvgilbertson authored Sep 21, 2023
2 parents 35e9e07 + 21d0aa0 commit ccb24f0
Show file tree
Hide file tree
Showing 11 changed files with 291 additions and 91 deletions.
30 changes: 15 additions & 15 deletions ansible/group_vars/server_type_ncr_bip_cmc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,21 @@ users_and_groups_system:
- sapsys

server_type_roles_list:
# - users-and-groups
# - sudoers
# - get-ec2-facts
# - set-ec2-hostname
# - domain-search
# - disable-ipv6
# - disable-firewall
# - time
# - packages
# - message-of-the-day
# - amazon-ssm-agent
# - amazon-cli
# - disks
# - oracle-19c-client
# - oracle-tns-entries
- users-and-groups
- sudoers
- get-ec2-facts
- set-ec2-hostname
- domain-search
- disable-ipv6
- disable-firewall
- time
- packages
- message-of-the-day
- amazon-ssm-agent
- amazon-cli
- disks
- oracle-19c-client
- oracle-tns-entries
- ncr-bip-cmc

roles_list: "{{ (ami_roles_list | default([]) | difference(server_type_roles_list | default([]))) + (server_type_roles_list | default([])) }}"
Expand Down
6 changes: 1 addition & 5 deletions ansible/roles/ncr-bip-cmc/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ sap_bi_platform_extraction_directory: /u02/software/BIP_4_3_SP1
sap_bi_platform_installation_directory: /u01/app/bobj/BIP4
sap_jvm_unpack_base_directory: /opt/sap/java

sap_bi_platform_platform_files:
- BIPLATS4303P_300-70002683_P1.EXE
- BIPLATS4303P_300-70002683_P2.RAR

s3:
bip_bucket_name: nomis-combined-reporting-bip-packages20230612143115114600000001
packages_prefix: BIP/
Expand All @@ -20,4 +16,4 @@ s3:
sap_jvm: SAPJVM8_94-80000202.SAR
sapcar: SAPCAR_1324-80000935.EXE

ssm_parameters_prefix: "bi-platform-cmc"
ssm_parameters_prefix: "bip-cmc"
1 change: 1 addition & 0 deletions ansible/roles/ncr-bip-cmc/tasks/install_bip_cmc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
- name: Perform pre-requesite checks
become_user: bobj
ansible.builtin.shell: "/u02/software/BIP_4_3_SP1/setup.sh -InstallDir /u01/app/bobj/BIP4/ -pre_requisite_check /u02/software/BIP_4_3_SP1/prereq_checks.ini /u02/software/BIP_4_3_SP1/failedPrereqs.txt"
ignore_errors: true

- name: Run Silent Installation
become_user: bobj
Expand Down
94 changes: 47 additions & 47 deletions ansible/roles/ncr-bip-cmc/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,51 +1,51 @@
---
# - import_tasks: get_facts.yml
# tags:
# - amibuild
# - ec2provision
# when: ansible_distribution in ['RedHat']

# - import_tasks: install_packages.yml
# tags:
# - amibuild
# - ec2provision
# when: ansible_distribution in ['RedHat']

# - import_tasks: add_groups.yml
# tags:
# - amibuild
# - ec2provision
# when: ansible_distribution in ['RedHat']

# - import_tasks: assign_permissions.yml
# tags:
# - amibuild
# - ec2provision
# when: ansible_distribution in ['RedHat']

# - import_tasks: users.yml
# tags:
# - amibuild
# - ec2provision
# when: ansible_distribution in ['RedHat']

# - import_tasks: retrieve_files.yml
# tags:
# - amibuild
# - ec2provision
# when: ansible_distribution in ['RedHat']

# - import_tasks: extract_files.yml
# tags:
# - amibuild
# - ec2provision
# when: ansible_distribution in ['RedHat']

# - import_tasks: add_response_file.yml
# tags:
# - amibuild
# - ec2provision
# when: ansible_distribution in ['RedHat']
- import_tasks: get_facts.yml
tags:
- amibuild
- ec2provision
when: ansible_distribution in ['RedHat']

- import_tasks: install_packages.yml
tags:
- amibuild
- ec2provision
when: ansible_distribution in ['RedHat']

- import_tasks: add_groups.yml
tags:
- amibuild
- ec2provision
when: ansible_distribution in ['RedHat']

- import_tasks: assign_permissions.yml
tags:
- amibuild
- ec2provision
when: ansible_distribution in ['RedHat']

- import_tasks: users.yml
tags:
- amibuild
- ec2provision
when: ansible_distribution in ['RedHat']

- import_tasks: retrieve_files.yml
tags:
- amibuild
- ec2provision
when: ansible_distribution in ['RedHat']

- import_tasks: extract_files.yml
tags:
- amibuild
- ec2provision
when: ansible_distribution in ['RedHat']

- import_tasks: add_response_file.yml
tags:
- amibuild
- ec2provision
when: ansible_distribution in ['RedHat']

- import_tasks: install_bip_cmc.yml
tags:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ selectedlanguagepacks=en
setupuilanguage=en

### SIA node name
sianame=t1ncrbipcmc
sianame=NOMIS1

### SIA connector port
siaport=6410
Expand Down
6 changes: 1 addition & 5 deletions ansible/roles/ncr-bip/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ sap_bi_platform_extraction_directory: /u02/software/BIP_4_3_SP1
sap_bi_platform_installation_directory: /u01/app/bobj/BIP4
sap_jvm_unpack_base_directory: /opt/sap/java

sap_bi_platform_platform_files:
- BIPLATS4303P_300-70002683_P1.EXE
- BIPLATS4303P_300-70002683_P2.RAR

s3:
bip_bucket_name: nomis-combined-reporting-bip-packages20230612143115114600000001
packages_prefix: BIP/
Expand All @@ -20,4 +16,4 @@ s3:
sap_jvm: SAPJVM8_94-80000202.SAR
sapcar: SAPCAR_1324-80000935.EXE

ssm_parameters_prefix: "bi-platform"
ssm_parameters_prefix: "bip"
26 changes: 13 additions & 13 deletions ansible/roles/ncr-bip/tasks/add_response_file.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

- name: Copy response file
ansible.builtin.template:
src: u02/software/BIP_4_3_SP1/cmc_response.ini
src: u02/software/BIP_4_3_SP1/bip_response.ini
dest: "{{ sap_bi_platform_extraction_directory }}/bip_response.ini"
owner: bobj
group: binstall
Expand All @@ -18,34 +18,34 @@
ansible.builtin.lineinfile:
path: "{{ sap_bi_platform_extraction_directory }}/bip_response.ini"
regexp: "^clusterkey="
line: "clusterkey={{ bip_cmc_cms_cluster_key }}"
line: "clusterkey={{ bip_cms_cluster_key }}"

- name: Ensure cms admin password is set in response file
ansible.builtin.lineinfile:
path: "{{ sap_bi_platform_extraction_directory }}/bip_response.ini"
regexp: "^cmspassword="
line: "cmspassword={{ bip_cmc_cms_admin_password }}"
line: "cmspassword={{ bip_cms_admin_password }}"

- name: Ensure lcm password is set in response file
- name: Ensure cms db password is set in response file
ansible.builtin.lineinfile:
path: "{{ sap_bi_platform_extraction_directory }}/bip_response.ini"
regexp: "^lcmpassword="
line: "lcmpassword={{ bip_cmc_lcm_password }}"
regexp: "^existingcmsdbpassword="
line: "existingcmsdbpassword={{ bip_cms_db_password }}"

- name: Ensure cms db password is set in response file
- name: Ensure lcm password is set in response file
ansible.builtin.lineinfile:
path: "{{ sap_bi_platform_extraction_directory }}/bip_response.ini"
regexp: "^existingcmsdbpassword="
line: "existingcmsdbpassword={{ bip_cmc_cms_db_password }}"
regexp: "^lcmpassword="
line: "lcmpassword={{ bip_lcm_password }}"

- name: Ensure auditing db password is set in response file
- name: Ensure node name is set in response file
ansible.builtin.lineinfile:
path: "{{ sap_bi_platform_extraction_directory }}/bip_response.ini"
regexp: "^existingauditingdbpassword="
line: "existingauditingdbpassword={{ bip_cmc_auditing_db_password }}"
regexp: "^sianame="
line: "sianame=NOMIS{{ node_number }}"

- name: Ensure product key is set in response file
ansible.builtin.lineinfile:
path: "{{ sap_bi_platform_extraction_directory }}/bip_response.ini"
regexp: "^productkey="
line: "productkey={{ bip_cmc_product_key }}"
line: "productkey={{ bip_product_key }}"
18 changes: 14 additions & 4 deletions ansible/roles/ncr-bip/tasks/get_facts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,21 @@
ssm_parameters_path_bip_cms_cluster_key: "{{ ssm_parameters_path }}/cms_cluster_key"
ssm_parameters_path_bip_cms_admin_password: "{{ ssm_parameters_path }}/cms_admin_password"
ssm_parameters_path_bip_cms_db_password: "{{ ssm_parameters_path }}/cms_db_password"
ssm_parameters_path_bip_lcm_password: "{{ ssm_parameters_path }}/lcm_password"
ssm_parameters_path_bip_product_key: "{{ ssm_parameters_path }}/product_key"

- name: Get SSM parameters
set_fact:
bip_cmc_cms_cluster_key: "{{ lookup('aws_ssm', ssm_parameters_path_bip_cmc_cms_cluster_key, region=ansible_ec2_placement_region) }}"
bip_cmc_cms_admin_password: "{{ lookup('aws_ssm', ssm_parameters_path_bip_cmc_cms_admin_password, region=ansible_ec2_placement_region) }}"
bip_cmc_cms_db_password: "{{ lookup('aws_ssm', ssm_parameters_path_bip_cmc_cms_db_password, region=ansible_ec2_placement_region) }}"
bip_cmc_product_key: "{{ lookup('aws_ssm', ssm_parameters_path_bip_cmc_product_key, region=ansible_ec2_placement_region) }}"
bip_cms_cluster_key: "{{ lookup('aws_ssm', ssm_parameters_path_bip_cms_cluster_key, region=ansible_ec2_placement_region) }}"
bip_cms_admin_password: "{{ lookup('aws_ssm', ssm_parameters_path_bip_cms_admin_password, region=ansible_ec2_placement_region) }}"
bip_cms_db_password: "{{ lookup('aws_ssm', ssm_parameters_path_bip_cms_db_password, region=ansible_ec2_placement_region) }}"
bip_lcm_password: "{{ lookup('aws_ssm', ssm_parameters_path_bip_lcm_password, region=ansible_ec2_placement_region) }}"
bip_product_key: "{{ lookup('aws_ssm', ssm_parameters_path_bip_product_key, region=ansible_ec2_placement_region) }}"

- name: Set node number
ansible.builtin.shell: "echo $(({{ ansible_ec2_ami_launch_index }}+2))"
register: node_number_command

- name: Set node number
set_fact:
node_number: "{{ node_number_command.stdout }}"
15 changes: 15 additions & 0 deletions ansible/roles/ncr-bip/tasks/install_bip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,21 @@
- name: Perform pre-requesite checks
become_user: bobj
ansible.builtin.shell: "/u02/software/BIP_4_3_SP1/setup.sh -InstallDir /u01/app/bobj/BIP4/ -pre_requisite_check /u02/software/BIP_4_3_SP1/prereq_checks.ini /u02/software/BIP_4_3_SP1/failedPrereqs.txt"
ignore_errors: true

- name: Verfy checks have passed
become_user: bobj
lineinfile:
path: /u02/software/BIP_4_3_SP1/failedPrereqs.txt
line: "All product pre-reqs have passed."
state: present
check_mode: yes
register: prereqs
failed_when: prereqs is changed

- name: "sample task in case the String present in the file"
debug: msg="All product pre requesites have passed"
when: prereqs is not changed

- name: Run Silent Installation
become_user: bobj
Expand Down
Loading

0 comments on commit ccb24f0

Please sign in to comment.