Skip to content

Commit 5b79079

Browse files
committed
Fixing ignored sap_sid parameter
Signed-off-by: Nicolas Bettembourg <[email protected]>
1 parent 1b6737b commit 5b79079

File tree

2 files changed

+46
-22
lines changed

2 files changed

+46
-22
lines changed

roles/sap_control/tasks/main.yml

Lines changed: 29 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -53,29 +53,37 @@
5353
# - stop_sap_hana
5454
# - start_sap_hana
5555

56-
- name: Set function list facts
57-
ansible.builtin.set_fact:
58-
sap_control_act_type: "{{ sap_control_function.split('_')[0] | lower }}"
59-
sap_control_get_type: "{{ sap_control_function.split('_')[1] | lower }}"
60-
sap_control_sap_type: "{{ sap_control_function.split('_')[2] | lower }}"
61-
62-
- name: Set sap_facts_param
63-
ansible.builtin.set_fact:
64-
sap_facts_param: "{{ sap_control_get_type }}"
56+
# These facts were only used for the sap_system_facts module, but it doesn't accept sap_facts_param anymore.
57+
# - name: Set function list facts
58+
# ansible.builtin.set_fact:
59+
# sap_control_act_type: "{{ sap_control_function.split('_')[0] | lower }}"
60+
# sap_control_get_type: "{{ sap_control_function.split('_')[1] | lower }}"
61+
# sap_control_sap_type: "{{ sap_control_function.split('_')[2] | lower }}"
62+
63+
# - name: Set sap_facts_param
64+
# ansible.builtin.set_fact:
65+
# sap_facts_param: "{{ sap_control_get_type }}"
66+
67+
# - name: Set sap_facts_param
68+
# ansible.builtin.set_fact:
69+
# sap_facts_param: "{{ sap_control_sap_type }}"
70+
# when:
71+
# - "'all' in sap_control_function"
72+
# - "'sap' not in sap_control_sap_type"
6573

66-
- name: Set sap_facts_param
67-
ansible.builtin.set_fact:
68-
sap_facts_param: "{{ sap_control_sap_type }}"
69-
when:
70-
- "'all' in sap_control_function"
71-
- "'sap' not in sap_control_sap_type"
74+
# # When not all
75+
# - name: Set sap_facts_param
76+
# ansible.builtin.set_fact:
77+
# sap_facts_param: "{{ sap_sid }}"
78+
# when:
79+
# - "'all' not in sap_control_function"
7280

73-
# When not all
74-
- name: Set sap_facts_param
75-
ansible.builtin.set_fact:
76-
sap_facts_param: "{{ sap_sid }}"
77-
when:
78-
- "'all' not in sap_control_function"
81+
# # Get SAP Info
82+
# - name: Get SAP Info
83+
# vars:
84+
# sap_info_get_function: "get_{{ sap_control_get_type }}_{{ sap_control_sap_type }}"
85+
# ansible.builtin.include_role:
86+
# name: roles/sap_info
7987

8088
# # Get SAP Info
8189
# - name: Get SAP Info

roles/sap_control/tasks/prepare.yml

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

12+
- name: Prepare - Set SAP System List
13+
ansible.builtin.set_fact:
14+
sap_system_list: "{{ ('all' in sap_control_function)
15+
| ansible.builtin.ternary(sap_facts_register.ansible_facts.sap, sap_facts_register.ansible_facts.sap | selectattr('SID', 'eq', sap_sid | upper))
16+
| list }}"
17+
18+
- name: Debug found SID
19+
ansible.builtin.debug:
20+
msg: "Found SAP systems for SID: {{ sap_sid }} - {{ sap_system_list }} system(s) found"
21+
verbosity: 1
22+
23+
- name: Fail if no SAP systems found
24+
ansible.builtin.fail:
25+
msg: "No SAP systems found for SID: {{ sap_sid }}"
26+
when: sap_system_list | length == 0
27+
1228
- name: SAP Control
1329
vars:
1430
sap_control_execute_sid: "{{ item.SID }}"
1531
sap_control_execute_type: "{{ item.Type }}"
1632
sap_control_execute_instance_nr: "{{ item.NR }}"
1733
sap_control_execute_instance_type: "{{ item.InstanceType }}"
1834
ansible.builtin.include_tasks: "sapcontrol.yml"
19-
loop: "{{ sap_facts_register.ansible_facts.sap }}"
35+
loop: "{{ sap_system_list }}"
2036
when:
2137
- "item.InstanceType | lower == sap_type | lower"

0 commit comments

Comments
 (0)