Skip to content

Commit fa9111f

Browse files
committed
fix: flag for ibm power
1 parent c0fef1a commit fa9111f

File tree

3 files changed

+50
-0
lines changed

3 files changed

+50
-0
lines changed

all/ansible_playbooks_for_sap/create_ansible_extravars.tf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,8 @@ sap_vm_provision_ssh_host_private_key_file_path: "${abspath(path.root)}/tmp/host
3838
${ strcontains(var.module_var_ansible_sap_scenario_selection, "hana") ? "# Ansible Playbooks for SAP - SAP HANA variables when multiple hosts (HA or Scale-Out)" : "" }
3939
${ strcontains(var.module_var_ansible_sap_scenario_selection, "hana") ? "sap_hana_install_update_firewall: true" : "" }
4040
41+
${ var.module_var_ibmpower_flag ? "# Ansible Playbooks for SAP - IBM Power" : "" }
42+
${ var.module_var_ibmpower_flag ? "sap_storage_setup_multipath_enable_and_detect: true" : "" }
43+
4144
EOF
4245
}

all/ansible_playbooks_for_sap/module_variables.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,7 @@ variable "module_var_ansible_sap_system_nwas_java_scs_instance_nr" {}
4646
variable "module_var_ansible_sap_system_nwas_java_ci_instance_nr" {}
4747
variable "module_var_ansible_sap_maintenance_planner_transaction_name" {}
4848
variable "module_var_ansible_sap_software_download_directory" {}
49+
50+
variable "module_var_ibmpower_flag" {
51+
default = false
52+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# CPU Architecture detection
2+
3+
Added flag for IBM Power. With the homogenised approach leveraging 'existing hosts' created by Terraform and execution of the Ansible Playbooks for SAP, there is no Terraform Variable that indicates the hosts are IBM Power.
4+
5+
6+
# Alternative data conversion
7+
8+
Data conversion from Terraform Map of host specifications, to a Python (Ansible) Dictionary can be achieved instead using Jinja:
9+
10+
```yaml
11+
# For end user ease of use, the host specifications dictionary uses disk_count to indicate how many disks will be provisioned
12+
# However the sap_storage_setup Ansible Role can not detect disk_count, and requires the key to be renamed lvm_lv_stripes
13+
- name: Convert sap_vm_provision_*_host_specifications_dictionary.storage_definition to sap_storage_setup.sap_storage_setup_definition
14+
ansible.builtin.set_fact:
15+
sap_storage_setup_definition: "{{ sap_storage_setup_definition | default([]) + [converted_element] }}"
16+
vars:
17+
converted_element: |
18+
{% set current_element = (convert_item | dict2items) %}
19+
{% set new_element = [] %}
20+
{% for entry in current_element %}
21+
{%- if "disk_count" in entry.key %}
22+
{%- set conv = new_element.extend([
23+
{
24+
'key': 'lvm_lv_stripes',
25+
'value': entry.value,
26+
}
27+
]) %}
28+
{%- elif not "disk_type" in entry.key %}
29+
{%- set add_entry = new_element.extend([
30+
{
31+
'key': entry.key,
32+
'value': entry.value,
33+
}
34+
]) %}
35+
{%- endif -%}
36+
{% endfor %}
37+
{{ new_element | items2dict }}
38+
loop: "{{ terraform_host_specification_storage_definition | list }}"
39+
# loop: "{{ terraform_host_specification[inventory_hostname]['storage_definition'] | list }}"
40+
loop_control:
41+
loop_var: convert_item
42+
label: "{{ convert_item.name }}"
43+
```

0 commit comments

Comments
 (0)