Skip to content

Commit 3302e82

Browse files
committed
my fix to issue#30
1 parent f728d6b commit 3302e82

File tree

2 files changed

+22
-4
lines changed

2 files changed

+22
-4
lines changed

roles/sap_control/defaults/main.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,16 @@ sap_control_stop: "StopWait 180 2"
1010
# get_all_sap_sid_dir_nw: "/sapmnt"
1111
# get_all_sap_sid_dir_hana: "/hana/shared"
1212

13+
# Sort Order to start SAP instances defined by SAP and recommended by SAP Basis Administrators
14+
sap_control_instance_type_sortorder:
15+
- "HDB"
16+
- "ERS"
17+
- "ASCS"
18+
- "SCS"
19+
- "PAS"
20+
- "Java"
21+
- "WebDisp"
22+
1323
# Functions
1424

1525
sap_control_functions_list:

roles/sap_control/tasks/prepare.yml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,21 @@
99
ansible.builtin.set_fact:
1010
sap_control_name_header: "{{ sap_type | upper }} {{ funct_type | capitalize }}"
1111

12-
- name: SAP Control
12+
- name: Prepare - Sort sap_facts_register by sap_control_instance_type_sortorder
13+
ansible.builtin.set_fact:
14+
sorted_sap_facts: "{{ (sorted_sap_facts | default([]) | unique) + (sap_facts_register.ansible_facts.sap | selectattr('TYPE', 'equalto', item) | list | difference(sorted_sap_facts | default([]))) }}"
15+
loop: "{{ sap_control_instance_type_sortorder | reverse if funct_type == 'stop' else sap_control_instance_type_sortorder }}"
16+
when:
17+
- sap_facts_register.ansible_facts.sap | selectattr('TYPE', 'equalto', item) | list | length > 0
18+
19+
- name: Prepare - SAP Control
1320
vars:
1421
sap_control_execute_sid: "{{ item.SID }}"
15-
sap_control_execute_type: "{{ item.Type }}"
22+
sap_control_execute_type: "{{ item.TYPE }}"
1623
sap_control_execute_instance_nr: "{{ item.NR }}"
1724
sap_control_execute_instance_type: "{{ item.InstanceType }}"
1825
ansible.builtin.include_tasks: "sapcontrol.yml"
19-
loop: "{{ sap_facts_register.ansible_facts.sap }}"
26+
loop: "{{ sorted_sap_facts }}"
2027
when:
21-
- "item.InstanceType | lower == sap_type | lower"
28+
- item.InstanceType | lower == sap_type | lower
29+
...

0 commit comments

Comments
 (0)