Skip to content

Commit

Permalink
Merge pull request #575 from ministryofjustice/feature/DSOS-2631/env-…
Browse files Browse the repository at this point in the history
…specific-ansible

DSOS-2631-env-specific-ansible
  • Loading branch information
crvgilbertson authored Feb 27, 2024
2 parents ac9d322 + 471d4f1 commit 0507cb9
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 21 deletions.
5 changes: 3 additions & 2 deletions ansible/roles/ncr-bip-cms/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ 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

ncr_environment: "{{ ec2.tags['ncr-environment'] }}"
ncr_environment: "{{ ec2.tags['nomis-combined-reporting-environment'] }}"
node: "{{ ec2.tags['node'] }}"

s3:
bip_bucket_name: nomis-combined-reporting-bip-packages20230612143115114600000001
Expand All @@ -22,6 +23,6 @@ ssm_parameters_prefix: "bip-cms"

bip_cms_secretsmanager_passwords:
bip_cms:
secret: "/ec2/ncr-bip-cms/t1/passwords"
secret: "/ec2/ncr-bip-cms/{{ ncr_environment }}/passwords"
users:
- bip_cms: auto
2 changes: 1 addition & 1 deletion ansible/roles/ncr-bip-cms/tasks/add_response_file.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,4 @@
ansible.builtin.lineinfile:
path: "{{ sap_bi_platform_extraction_directory }}/cms_response.ini"
regexp: "^sianame="
line: "sianame={{ sia_name }}1"
line: "sianame={{ ncr_environment }}ncr{{ node }}"
2 changes: 0 additions & 2 deletions ansible/roles/ncr-bip-cms/tasks/get_facts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
lcm_password: "{{ secretsmanager_passwords_dict['bip_cms'].passwords['lcm_password'] }}"
product_key: "{{ secretsmanager_passwords_dict['bip_cms'].passwords['product_key'] }}"
auditing_db_password: "{{ secretsmanager_passwords_dict['bip_cms'].passwords['auditing_db_password'] }}"
sia_name: "{{ secretsmanager_passwords_dict['bip_cms'].passwords['sia_name'] }}"

- name: Check all SSM parameters and tags are set
set_fact:
Expand All @@ -25,7 +24,6 @@
- cms_db_password|length > 0
- auditing_db_password|length > 0
- product_key|length > 0
- sia_name|length > 0

- name: Fail if missing SSM parameters or tags
fail:
Expand Down
15 changes: 11 additions & 4 deletions ansible/roles/ncr-bip-cms/tasks/install_bip_cms.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
block:
- 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"
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
Expand All @@ -23,8 +23,15 @@
path: /etc/init.d/SAPBOBJEnterpriseXI40
register: setupinit_folder_check

- name: Execute setup script
become: true
ansible.builtin.shell: /u01/app/bobj/BIP4/sap_bobj/init/setupinit.sh
- name: Run setup
block:
- name: Copy setupinit file
ansible.builtin.template:
src: u01/app/bobj/BIP4/sap_bobj/init/setupinit.sh
dest: /u01/app/bobj/BIP4/sap_bobj/init/setupinit.sh

- name: Execute setup script
become: true
ansible.builtin.shell: /u01/app/bobj/BIP4/sap_bobj/init/setupinit.sh
when:
- not setupinit_folder_check.stat.exists
5 changes: 3 additions & 2 deletions ansible/roles/ncr-tomcat-admin/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ 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

ncr_environment: "{{ ec2.tags['ncr-environment'] }}"
ncr_environment: "{{ ec2.tags['nomis-combined-reporting-environment'] }}"
cms_name: "{{ ncr_environment }}-ncr-cms"

s3:
bip_bucket_name: nomis-combined-reporting-bip-packages20230612143115114600000001
Expand All @@ -27,6 +28,6 @@ tomcat_post_install_directories:

tomcat_admin_secretsmanager_passwords:
tomcat_admin:
secret: "/ec2/ncr-tomcat-admin/t1/passwords"
secret: "/ec2/ncr-tomcat-admin/{{ ncr_environment }}/passwords"
users:
- tomcat_admin: auto
1 change: 0 additions & 1 deletion ansible/roles/ncr-tomcat-admin/tasks/get_facts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@

- name: Set password facts
set_fact:
cms_name: "{{ secretsmanager_passwords_dict['tomcat_admin'].passwords['cms_name'] }}"
cms_admin_password: "{{ secretsmanager_passwords_dict['tomcat_admin'].passwords['cms_admin_password'] }}"
product_key: "{{ secretsmanager_passwords_dict['tomcat_admin'].passwords['product_key'] }}"
19 changes: 10 additions & 9 deletions ansible/roles/ncr-tomcat-admin/tasks/install_tomcat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
block:
- 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"
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
Expand All @@ -18,19 +18,20 @@
/u02/software/BIP_4_3_SP1/setup.sh -InstallDir /u01/app/bobj/BIP4/ -r /u02/software/BIP_4_3_SP1/tomcat_admin_response.ini
when: not bip_installed_check.stat.exists

- name: Check if init file exists
stat:
path: /u01/app/bobj/BIP4/sap_bobj/init/setupinit.sh
register: bip_init_file_check

- name: Check if init has been run
stat:
path: /etc/init.d/SAPBOBJEnterpriseXI40
register: setupinit_folder_check

- name: Run setup
become: true
ansible.builtin.shell: /u01/app/bobj/BIP4/sap_bobj/init/setupinit.sh
block:
- name: Copy setupinit file
ansible.builtin.template:
src: u01/app/bobj/BIP4/sap_bobj/init/setupinit.sh
dest: /u01/app/bobj/BIP4/sap_bobj/init/setupinit.sh

- name: Execute setup script
become: true
ansible.builtin.shell: /u01/app/bobj/BIP4/sap_bobj/init/setupinit.sh
when:
- bip_init_file_check.stat.exists
- not setupinit_folder_check.stat.exists

0 comments on commit 0507cb9

Please sign in to comment.