Skip to content

my fix to issue#30 #34

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

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
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
11 changes: 10 additions & 1 deletion roles/sap_control/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,17 @@ sap_control_stop: "StopWait 180 2"
# get_all_sap_sid_dir_nw: "/sapmnt"
# get_all_sap_sid_dir_hana: "/hana/shared"

# Functions
# Sort Order to start SAP instances defined by SAP and recommended by SAP Basis Administrators
sap_control_instance_type_sortorder:
- "HDB"
- "ERS"
- "ASCS"
- "SCS"
- "PAS"
- "Java"
- "WebDisp"

# Functions
sap_control_functions_list:
- restart_all_sap
- stop_all_sap
Expand Down
18 changes: 14 additions & 4 deletions roles/sap_control/tasks/prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,23 @@
ansible.builtin.set_fact:
sap_control_name_header: "{{ sap_type | upper }} {{ funct_type | capitalize }}"

- name: SAP Control
- name: Prepare - Sort sap_facts_register by sap_control_instance_type_sortorder
ansible.builtin.set_fact:
sorted_sap_facts: "{{ (sorted_sap_facts | default([]) | unique) + ( __type_list | difference(sorted_sap_facts | default([]))) }}"
loop: "{{ sap_control_instance_type_sortorder | reverse if funct_type == 'stop' else sap_control_instance_type_sortorder }}"
vars:
__type_list: "{{ sap_facts_register.ansible_facts.sap | selectattr('TYPE', 'equalto', item) | list }}"
when:
- __type_list | length > 0

- name: Prepare - SAP Control
vars:
sap_control_execute_sid: "{{ item.SID }}"
sap_control_execute_type: "{{ item.Type }}"
sap_control_execute_type: "{{ item.TYPE }}"
sap_control_execute_instance_nr: "{{ item.NR }}"
sap_control_execute_instance_type: "{{ item.InstanceType }}"
ansible.builtin.include_tasks: "sapcontrol.yml"
loop: "{{ sap_facts_register.ansible_facts.sap }}"
loop: "{{ sorted_sap_facts }}"
when:
- "item.InstanceType | lower == sap_type | lower"
- item.InstanceType | lower == sap_type | lower
...