Skip to content

Commit 58a17b4

Browse files
authored
Merge pull request #34 from crweller/dev
Long outstanding and approved PR. Will merge now my fix to issue#30
2 parents f728d6b + 366b6dd commit 58a17b4

File tree

2 files changed

+24
-5
lines changed

2 files changed

+24
-5
lines changed

roles/sap_control/defaults/main.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,17 @@ 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-
# Functions
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"
1422

23+
# Functions
1524
sap_control_functions_list:
1625
- restart_all_sap
1726
- stop_all_sap

roles/sap_control/tasks/prepare.yml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,23 @@
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) + ( __type_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+
vars:
17+
__type_list: "{{ sap_facts_register.ansible_facts.sap | selectattr('TYPE', 'equalto', item) | list }}"
18+
when:
19+
- __type_list | length > 0
20+
21+
- name: Prepare - SAP Control
1322
vars:
1423
sap_control_execute_sid: "{{ item.SID }}"
15-
sap_control_execute_type: "{{ item.Type }}"
24+
sap_control_execute_type: "{{ item.TYPE }}"
1625
sap_control_execute_instance_nr: "{{ item.NR }}"
1726
sap_control_execute_instance_type: "{{ item.InstanceType }}"
1827
ansible.builtin.include_tasks: "sapcontrol.yml"
19-
loop: "{{ sap_facts_register.ansible_facts.sap }}"
28+
loop: "{{ sorted_sap_facts }}"
2029
when:
21-
- "item.InstanceType | lower == sap_type | lower"
30+
- item.InstanceType | lower == sap_type | lower
31+
...

0 commit comments

Comments
 (0)