Skip to content

Commit

Permalink
all: amend var names for sap_hana_scaleout
Browse files Browse the repository at this point in the history
  • Loading branch information
sean-freeman committed Apr 28, 2024
1 parent 92f45da commit 55dbb4c
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ sap_hana_install_update_etchosts: 'false'
# Mandatory parameters : Infrastructure provisioning definitions - SAP HANA scale-out
####

sap_hana_scaleout_active_coordinator: 1
sap_hana_scaleout_active_worker: 2
sap_hana_scaleout_standby: 1 # Only 0 or 1
sap_vm_provision_calculate_sap_hana_scaleout_active_coordinator: 1
sap_vm_provision_calculate_sap_hana_scaleout_active_worker: 2
sap_vm_provision_calculate_sap_hana_scaleout_standby: 1 # Only 0 or 1



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,38 +56,38 @@
ansible.builtin.set_fact:
"{{ sap_vm_provision_iac_platform + '_host_specifications_dictionary_scaleout' }}": "{{ {} | combine({sap_vm_provision_host_specification_plan: {}}) }}"
when:
- sap_hana_scaleout_active_coordinator is defined
- sap_vm_provision_calculate_sap_hana_scaleout_active_coordinator is defined
# - sap_vm_provision_iac_type == "ansible"

- name: Input construct - VM provisioning via Ansible - SAP HANA Scale-Out - dynamically build new Ansible Dictionary
ansible.builtin.set_fact:
"scaleout_build": "{{ scaleout_build | default({}) | combine({(lookup('ansible.builtin.vars', 'sap_vm_provision_' + sap_vm_provision_iac_platform + '_host_specifications_dictionary')[sap_vm_provision_host_specification_plan].keys() | first + host_scaleout_node | string): lookup('ansible.builtin.vars', 'sap_vm_provision_' + sap_vm_provision_iac_platform + '_host_specifications_dictionary')[sap_vm_provision_host_specification_plan][lookup('ansible.builtin.vars', 'sap_vm_provision_' + sap_vm_provision_iac_platform + '_host_specifications_dictionary')[sap_vm_provision_host_specification_plan].keys() | first]}) }}"
loop: "{{ range(0, (sap_hana_scaleout_active_coordinator | int + sap_hana_scaleout_active_worker | int + sap_hana_scaleout_standby | int), 1) | list }}"
loop: "{{ range(0, (sap_vm_provision_calculate_sap_hana_scaleout_active_coordinator | int + sap_vm_provision_calculate_sap_hana_scaleout_active_worker | int + sap_vm_provision_calculate_sap_hana_scaleout_standby | int), 1) | list }}"
loop_control:
loop_var: host_scaleout_node
when:
- sap_hana_scaleout_active_coordinator is defined
- sap_vm_provision_calculate_sap_hana_scaleout_active_coordinator is defined
# - sap_vm_provision_iac_type == "ansible"

- name: Input construct - VM provisioning via Ansible - SAP HANA Scale-Out - SAP NetWeaver hosts dynamically build new Ansible Dictionary
ansible.builtin.set_fact:
"other_host_spec_hosts": "{{ lookup('ansible.builtin.vars', 'sap_vm_provision_' + sap_vm_provision_iac_platform + '_host_specifications_dictionary')[sap_vm_provision_host_specification_plan] | combine({lookup('ansible.builtin.vars', 'sap_vm_provision_' + sap_vm_provision_iac_platform + '_host_specifications_dictionary')[sap_vm_provision_host_specification_plan].keys() | first: omit}) }}"
when:
- sap_hana_scaleout_active_coordinator is defined
- sap_vm_provision_calculate_sap_hana_scaleout_active_coordinator is defined
# - sap_vm_provision_iac_type == "ansible"

- name: Input construct - VM provisioning via Ansible - SAP HANA Scale-Out - Merge dynamically built new Ansible Dictionary keys
ansible.builtin.set_fact:
all_host_specs: "{{ {} | combine(scaleout_build, other_host_spec_hosts) }}"
when:
- sap_hana_scaleout_active_coordinator is defined
- sap_vm_provision_calculate_sap_hana_scaleout_active_coordinator is defined
# - sap_vm_provision_iac_type == "ansible"

- name: Input construct - VM provisioning via Ansible - SAP HANA Scale-Out - populate new Ansible Dictionary
ansible.builtin.set_fact:
"{{ sap_vm_provision_iac_platform + '_host_specifications_dictionary_scaleout' }}": "{{ lookup('ansible.builtin.vars', sap_vm_provision_iac_platform + '_host_specifications_dictionary_scaleout') | combine({sap_vm_provision_host_specification_plan: all_host_specs}) }}"
when:
- sap_hana_scaleout_active_coordinator is defined
- sap_vm_provision_calculate_sap_hana_scaleout_active_coordinator is defined
# - sap_vm_provision_iac_type == "ansible"


Expand All @@ -104,7 +104,7 @@
group: sap_vm_provision_target_inventory_group
loop: "{{ lookup('ansible.builtin.vars', sap_vm_provision_iac_platform + '_host_specifications_dictionary_scaleout')[sap_vm_provision_host_specification_plan].keys() | default(lookup('ansible.builtin.vars', 'sap_vm_provision_' + sap_vm_provision_iac_platform + '_host_specifications_dictionary')[sap_vm_provision_host_specification_plan].keys()) }}"
when:
- sap_hana_scaleout_active_coordinator is defined
- sap_vm_provision_calculate_sap_hana_scaleout_active_coordinator is defined
- sap_vm_provision_iac_type == "ansible" or sap_vm_provision_iac_type == "ansible_to_terraform"

- name: Ansible Play to provision hosts for SAP
Expand Down Expand Up @@ -430,12 +430,12 @@
- name: Ansible Vars extravars file check if non-interactive (no var prompts) requested by end user
ansible.builtin.set_fact:
sap_hana_install_addhosts: |
{%- if sap_hana_scaleout_standby > 0 -%}
{%- if sap_vm_provision_calculate_sap_hana_scaleout_standby > 0 -%}
{%- for host in (groups['hana_primary'] | reject('search', '0') | list)[:-1] -%}
{{ hostvars[host]['inventory_hostname_short'] }}:role=worker:workergroup={{ sap_hana_install_workergroup }}:group={{ sap_hana_install_group }},
{%- endfor -%}
{{ hostvars[(groups['hana_primary'][-1])]['inventory_hostname_short'] }}:role=standby:workergroup={{ sap_hana_install_workergroup }}:group={{ sap_hana_install_group }}
{%- elif sap_hana_scaleout_standby == 0 -%}
{%- elif sap_vm_provision_calculate_sap_hana_scaleout_standby == 0 -%}
{%- for host in (groups['hana_primary'] | reject('search', '0') | list) -%}
{{ hostvars[host]['inventory_hostname_short'] }}:role=worker:workergroup={{ sap_hana_install_workergroup }}:group={{ sap_hana_install_group }}
{%- endfor -%}
Expand Down
6 changes: 3 additions & 3 deletions deploy_scenarios/sap_hana_scaleout/ansible_extravars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,9 @@ sap_hana_install_update_etchosts: 'false'
# Mandatory parameters : Infrastructure provisioning definitions - SAP HANA scale-out
####

sap_hana_scaleout_active_coordinator: 1
sap_hana_scaleout_active_worker: 2
sap_hana_scaleout_standby: 1 # Only 0 or 1
sap_vm_provision_calculate_sap_hana_scaleout_active_coordinator: 1
sap_vm_provision_calculate_sap_hana_scaleout_active_worker: 2
sap_vm_provision_calculate_sap_hana_scaleout_standby: 1 # Only 0 or 1


####
Expand Down
18 changes: 9 additions & 9 deletions deploy_scenarios/sap_hana_scaleout/ansible_playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,38 +56,38 @@
ansible.builtin.set_fact:
"{{ sap_vm_provision_iac_platform + '_host_specifications_dictionary_scaleout' }}": "{{ {} | combine({sap_vm_provision_host_specification_plan: {}}) }}"
when:
- sap_hana_scaleout_active_coordinator is defined
- sap_vm_provision_calculate_sap_hana_scaleout_active_coordinator is defined
# - sap_vm_provision_iac_type == "ansible"

- name: Input construct - VM provisioning via Ansible - SAP HANA Scale-Out - dynamically build new Ansible Dictionary
ansible.builtin.set_fact:
"scaleout_build": "{{ scaleout_build | default({}) | combine({(lookup('ansible.builtin.vars', 'sap_vm_provision_' + sap_vm_provision_iac_platform + '_host_specifications_dictionary')[sap_vm_provision_host_specification_plan].keys() | first + host_scaleout_node | string): lookup('ansible.builtin.vars', 'sap_vm_provision_' + sap_vm_provision_iac_platform + '_host_specifications_dictionary')[sap_vm_provision_host_specification_plan][lookup('ansible.builtin.vars', 'sap_vm_provision_' + sap_vm_provision_iac_platform + '_host_specifications_dictionary')[sap_vm_provision_host_specification_plan].keys() | first]}) }}"
loop: "{{ range(0, (sap_hana_scaleout_active_coordinator | int + sap_hana_scaleout_active_worker | int + sap_hana_scaleout_standby | int), 1) | list }}"
loop: "{{ range(0, (sap_vm_provision_calculate_sap_hana_scaleout_active_coordinator | int + sap_vm_provision_calculate_sap_hana_scaleout_active_worker | int + sap_vm_provision_calculate_sap_hana_scaleout_standby | int), 1) | list }}"
loop_control:
loop_var: host_scaleout_node
when:
- sap_hana_scaleout_active_coordinator is defined
- sap_vm_provision_calculate_sap_hana_scaleout_active_coordinator is defined
# - sap_vm_provision_iac_type == "ansible"

- name: Input construct - VM provisioning via Ansible - SAP HANA Scale-Out - SAP NetWeaver hosts dynamically build new Ansible Dictionary
ansible.builtin.set_fact:
"other_host_spec_hosts": "{{ lookup('ansible.builtin.vars', 'sap_vm_provision_' + sap_vm_provision_iac_platform + '_host_specifications_dictionary')[sap_vm_provision_host_specification_plan] | combine({lookup('ansible.builtin.vars', 'sap_vm_provision_' + sap_vm_provision_iac_platform + '_host_specifications_dictionary')[sap_vm_provision_host_specification_plan].keys() | first: omit}) }}"
when:
- sap_hana_scaleout_active_coordinator is defined
- sap_vm_provision_calculate_sap_hana_scaleout_active_coordinator is defined
# - sap_vm_provision_iac_type == "ansible"

- name: Input construct - VM provisioning via Ansible - SAP HANA Scale-Out - Merge dynamically built new Ansible Dictionary keys
ansible.builtin.set_fact:
all_host_specs: "{{ {} | combine(scaleout_build, other_host_spec_hosts) }}"
when:
- sap_hana_scaleout_active_coordinator is defined
- sap_vm_provision_calculate_sap_hana_scaleout_active_coordinator is defined
# - sap_vm_provision_iac_type == "ansible"

- name: Input construct - VM provisioning via Ansible - SAP HANA Scale-Out - populate new Ansible Dictionary
ansible.builtin.set_fact:
"{{ sap_vm_provision_iac_platform + '_host_specifications_dictionary_scaleout' }}": "{{ lookup('ansible.builtin.vars', sap_vm_provision_iac_platform + '_host_specifications_dictionary_scaleout') | combine({sap_vm_provision_host_specification_plan: all_host_specs}) }}"
when:
- sap_hana_scaleout_active_coordinator is defined
- sap_vm_provision_calculate_sap_hana_scaleout_active_coordinator is defined
# - sap_vm_provision_iac_type == "ansible"


Expand All @@ -104,7 +104,7 @@
group: sap_vm_provision_target_inventory_group
loop: "{{ lookup('ansible.builtin.vars', sap_vm_provision_iac_platform + '_host_specifications_dictionary_scaleout')[sap_vm_provision_host_specification_plan].keys() | default(lookup('ansible.builtin.vars', 'sap_vm_provision_' + sap_vm_provision_iac_platform + '_host_specifications_dictionary')[sap_vm_provision_host_specification_plan].keys()) }}"
when:
- sap_hana_scaleout_active_coordinator is defined
- sap_vm_provision_calculate_sap_hana_scaleout_active_coordinator is defined
- sap_vm_provision_iac_type == "ansible" or sap_vm_provision_iac_type == "ansible_to_terraform"

- name: Ansible Play to provision hosts for SAP
Expand Down Expand Up @@ -339,12 +339,12 @@
- name: Ansible Vars extravars file check if non-interactive (no var prompts) requested by end user
ansible.builtin.set_fact:
sap_hana_install_addhosts: |
{%- if sap_hana_scaleout_standby > 0 -%}
{%- if sap_vm_provision_calculate_sap_hana_scaleout_standby > 0 -%}
{%- for host in (groups['hana_primary'] | reject('search', '0') | list)[:-1] -%}
{{ hostvars[host]['inventory_hostname_short'] }}:role=worker:workergroup={{ sap_hana_install_workergroup }}:group={{ sap_hana_install_group }},
{%- endfor -%}
{{ hostvars[(groups['hana_primary'][-1])]['inventory_hostname_short'] }}:role=standby:workergroup={{ sap_hana_install_workergroup }}:group={{ sap_hana_install_group }}
{%- elif sap_hana_scaleout_standby == 0 -%}
{%- elif sap_vm_provision_calculate_sap_hana_scaleout_standby == 0 -%}
{%- for host in (groups['hana_primary'] | reject('search', '0') | list) -%}
{{ hostvars[host]['inventory_hostname_short'] }}:role=worker:workergroup={{ sap_hana_install_workergroup }}:group={{ sap_hana_install_group }}
{%- endfor -%}
Expand Down

0 comments on commit 55dbb4c

Please sign in to comment.