Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nomis: DSOS-2238: xtag fix #366

Merged
merged 5 commits into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions ansible/roles/epel/tasks/install-from-rpm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,13 @@
ansible.builtin.rpm_key:
state: present
key: "/root/epel/{{ epel_gpg_key_filename }}"
when: not ansible_check_mode

- name: Install epel RPM from S3
ansible.builtin.yum:
state: present
name: "/root/epel/{{ epel_rpm_filename }}"
when: not ansible_check_mode

always:
- name: Restore SELinux state to Enforcing
Expand Down
26 changes: 25 additions & 1 deletion ansible/roles/nomis-xtag-weblogic/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
---
ssm_parameters_prefix: "weblogic"
# Following tags must be set on the ASG
# nomis-environment: e.g. t1
# oracle-db-name: T1CNOM
# oracle-db-hostname-a: t1-nomis-db-1-a.fqdn
# oracle-db-hostname-b: none
# ndh-ems-hostname: t1-ndh-ems
nomis_environment: "{{ ec2.tags['nomis-environment'] }}"
weblogic_db_name: "{{ ec2.tags['oracle-db-name'] }}"
weblogic_db_hostname_a: "{{ ec2.tags['oracle-db-hostname-a'] }}"
weblogic_db_hostname_b: "{{ ec2.tags['oracle-db-hostname-b'] }}"
ndh_ems_server: "{{ ec2.tags['ndh-ems-hostname'] }}"

weblogic_domain_hostname: "{{ ansible_facts.hostname }}"
weblogic_servername: "{{ ansible_facts.hostname }}"
weblogic_cluster: "{{ ansible_facts.hostname }}"
Expand All @@ -10,7 +21,20 @@ 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_admin_username: weblogic
weblogic_db_username: xtag

weblogic_servers:
- { name: WLS_XTAG_OUTBOUND_01 }
- { name: AdminServer }

db_config: "{{ db_configs[weblogic_db_name] }}"
xtag_ssm_passwords:
weblogic:
parameter: "/oracle/weblogic/{{ nomis_environment }}/passwords"
users:
- weblogic: auto
db:
parameter: "/oracle/database/{{ db_config.db_name }}/weblogic-passwords"
users:
- xtag:
34 changes: 7 additions & 27 deletions ansible/roles/nomis-xtag-weblogic/tasks/get-facts.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,14 @@
---
- 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"] }}'

- 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) }}"
import_role:
name: ssm-passwords
vars:
ssm_passwords: "{{ xtag_ssm_passwords }}"

- 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'] }}"

- name: Set ndh ems name from ec2 ndh-ems-hostname tag
- name: Get SSM parameters
set_fact:
ndh_ems_server: "{{ ec2.tags['ndh-ems-hostname'] }}"
weblogic_admin_password: "{{ ssm_passwords_dict['weblogic'].passwords[weblogic_admin_username] }}"
weblogic_db_password: "{{ ssm_passwords_dict['db'].passwords[weblogic_db_username] }}"

- debug:
msg: "Configuring Oracle DB {{ weblogic_db_name }} on {{ weblogic_db_hostname_a }},{{ weblogic_db_hostname_b }} with username {{ weblogic_db_username }}"
Expand Down
Loading