Skip to content

Commit f76fdb4

Browse files
committed
User _dbs to find _primarydb
1 parent 93873c7 commit f76fdb4

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

playbooks/oracle_restore_points/playbook.yml

+3-8
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
- name: Block connections to Delius primary database
8484
import_playbook: ../block_sessions/playbook.yml
8585
vars:
86-
target_host: "{{ target_dbs.split(',') | select('search', '.*delius_primarydb') | first }}"
86+
target_host: "{{ target_dbs.split(',') | select('match','.*delius_dbs') | first | replace('dbs','primarydb') }}"
8787
database: { "delius": { "high_availability_count": 0 } }
8888
action: block
8989
when:
@@ -198,17 +198,12 @@
198198

199199
when: (restore_date_time | default() | length > 0) and database_primary_sid is defined
200200

201-
- name: Get environment name and application name
202-
set_fact:
203-
environment_name: "{{ hostvars[inventory_hostname].group_names[2] | replace(hostvars[inventory_hostname].group_names[2].split('_')[-1],'') }}"
204-
application_name: "{{ hostvars[inventory_hostname].group_names[3].split('_')[-2] }}"
205-
206201
- name: Create Oracle Standby Restore Points
207202
script: create_standby_restore_points.sh
208203
when: database_standby_sid is defined
209204
environment:
210205
RESTORE_POINT_NAME: "{{ uplift_restore_point_name | default(restore_point_name) | upper }}"
211-
SCN: "{{ hostvars[groups[environment_name + application_name + '_primarydb'][0]]['scn'] | default('0') }}"
206+
SCN: "{{ hostvars[groups[hostvars[inventory_hostname].group_names | select('match','.*_dbs') | first | replace('dbs','primarydb')][0]]['scn'] | default('0') }}"
212207

213208
- name: Create Oracle Primary Restore Points
214209
script: create_primary_restore_points.sh
@@ -306,7 +301,7 @@
306301
- name: Unblock connections to Delius primary database
307302
import_playbook: ../block_sessions/playbook.yml
308303
vars:
309-
target_host: "{{ target_dbs.split(',') | select('search', '.*delius_primarydb') | first }}"
304+
target_host: "{{ target_dbs.split(',') | select('match','.*delius_dbs') | first | replace('dbs','primarydb') }}"
310305
database: { "delius": { "high_availability_count": 0 } }
311306
action: unblock
312307
ignore_flashback: true

0 commit comments

Comments
 (0)