Skip to content

prepare for 1.1.0 #48

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

Merged
merged 11 commits into from
Jun 15, 2025
Merged
508 changes: 254 additions & 254 deletions .github/workflows/terraform_ansible_software_availability.yml

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion .github/workflows/terraform_validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ jobs:
fail-fast: false
max-parallel: 10
matrix:
terraform_ver: [~1.0.0, ~1.1.0, ~1.2.0, ~1.3.0, ~1.4.0, =1.5.5]
# terraform_ver: [~1.0.0, ~1.1.0, ~1.2.0, ~1.3.0, ~1.4.0, =1.5.5]
terraform_ver: [=1.5.5]
terraform_module_parent: [all, aws_ec2_instance, gcp_ce_vm, ibmcloud_vs, ibmcloud_powervs, ibmpowervc, msazure_vm, vmware_vm]
steps:
- name: Checkout
Expand Down
42 changes: 42 additions & 0 deletions all/ansible_playbooks_for_sap/create_ansible_extravars.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@

# Use path object to store key files temporarily in module of execution - https://www.terraform.io/docs/language/expressions/references.html#filesystem-and-workspace-info
resource "local_file" "ansible_extravars" {
filename = "${path.root}/tmp/ansible_extravars_generated.yml"
file_permission = "0755"
content = <<EOF

#### Instructions for using existing_hosts ####

# When existing_hosts are used, execution of provisioning role sap_vm_provision will be skipped.
# This results in the need to define additional variables below, e.g. sap_general_preconfigure_domain.

# Ansible Role sap_storage_setup will be searching for block devices based on their definition in storage_definition
# under sap_vm_provision_existing_hosts_host_specifications_dictionary. These devices must not be partitioned!

####

# Existing Hosts - ensure Domain is set
sap_general_preconfigure_modify_etc_hosts: true
sap_general_preconfigure_domain: "${var.module_var_dns_root_domain}"

# Import host specification dictionary from Terraform Template
# Convert 'disk_count' key (logical name for provisioning X disks) to 'lvm_lv_stripes' expected by sap_storage_setup Ansible Role
# Remove 'disk_type' key (for provisioning disks) which is not expected by sap_storage_setup Ansible Role
# Then convert JSON payload from Terraform to Python Dictionary type using from_json built-in function
sap_vm_provision_existing_hosts_host_specifications_dictionary: "{{ '${ local.generate_host_specifications }' | from_json }}"

# Ansible Role sap_storage_setup variable assignment per host
sap_storage_setup_definition:
"{{ sap_vm_provision_existing_hosts_host_specifications_dictionary[sap_vm_provision_host_specification_plan]
[inventory_hostname_short].storage_definition }}"
${ strcontains(var.module_var_ansible_sap_scenario_selection, "sandbox") ? "# Ansible Role sap_storage_setup variable assignment if Sandbox. Override any System ID (SID) value stored in the host specifications dictionary" : "" }
${ strcontains(var.module_var_ansible_sap_scenario_selection, "sandbox") ? format("sap_storage_setup_sid: \"%s\"",var.module_var_ansible_sap_system_sid) : "" }

# Ansible Playbooks for SAP - multiple hosts
sap_vm_provision_ssh_host_private_key_file_path: "${abspath(path.root)}/tmp/hosts_rsa"

${ strcontains(var.module_var_ansible_sap_scenario_selection, "hana") ? "# Ansible Playbooks for SAP - SAP HANA variables when multiple hosts (HA or Scale-Out)" : "" }
${ strcontains(var.module_var_ansible_sap_scenario_selection, "hana") ? "sap_hana_install_update_firewall: true" : "" }

EOF
}
34 changes: 34 additions & 0 deletions all/ansible_playbooks_for_sap/create_ansible_inventory.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@

# Use path object to store key files temporarily in module of execution - https://www.terraform.io/docs/language/expressions/references.html#filesystem-and-workspace-info
resource "local_file" "ansible_inventory" {
filename = "${path.root}/tmp/ansible_inventory.ini"
file_permission = "0755"
content = <<EOF
# Ansible Inventory Group names must match Ansible Playbooks for SAP - hana_primary, hana_secondary, anydb_primary, anydb_secondary, nwas_ascs, nwas_ers, nwas_pas, nwas_aas

[hana_primary]
${ join(", ", [ for k1 in [for k2,v2 in var.module_var_host_specifications[var.module_var_host_specification_plan] : k2 if v2.sap_host_type == "hana_primary"] : format("%s ansible_host=%s ansible_connection=ssh ansible_user=root",k1,var.module_var_host_provision_outputs[k1].output_host_private_ip) ] ) }

[hana_secondary]
${ join(", ", [ for k1 in [for k2,v2 in var.module_var_host_specifications[var.module_var_host_specification_plan] : k2 if v2.sap_host_type == "hana_secondary"] : format("%s ansible_host=%s ansible_connection=ssh ansible_user=root",k1,var.module_var_host_provision_outputs[k1].output_host_private_ip) ] ) }

[nwas_ascs]
${ join(", ", [ for k1 in [for k2,v2 in var.module_var_host_specifications[var.module_var_host_specification_plan] : k2 if v2.sap_host_type == "nwas_ascs"] : format("%s ansible_host=%s ansible_connection=ssh ansible_user=root",k1,var.module_var_host_provision_outputs[k1].output_host_private_ip) ] ) }

[nwas_ers]
${ join(", ", [ for k1 in [for k2,v2 in var.module_var_host_specifications[var.module_var_host_specification_plan] : k2 if v2.sap_host_type == "nwas_ers"] : format("%s ansible_host=%s ansible_connection=ssh ansible_user=root",k1,var.module_var_host_provision_outputs[k1].output_host_private_ip) ] ) }

[nwas_pas]
${ join(", ", [ for k1 in [for k2,v2 in var.module_var_host_specifications[var.module_var_host_specification_plan] : k2 if v2.sap_host_type == "nwas_pas"] : format("%s ansible_host=%s ansible_connection=ssh ansible_user=root",k1,var.module_var_host_provision_outputs[k1].output_host_private_ip) ] ) }

[nwas_aas]
${ join(", ", [ for k1 in [for k2,v2 in var.module_var_host_specifications[var.module_var_host_specification_plan] : k2 if v2.sap_host_type == "nwas_aas"] : format("%s ansible_host=%s ansible_connection=ssh ansible_user=root",k1,var.module_var_host_provision_outputs[k1].output_host_private_ip) ] ) }

[anydb_primary]
${ join(", ", [ for k1 in [for k2,v2 in var.module_var_host_specifications[var.module_var_host_specification_plan] : k2 if v2.sap_host_type == "anydb_primary"] : format("%s ansible_host=%s ansible_connection=ssh ansible_user=root",k1,var.module_var_host_provision_outputs[k1].output_host_private_ip) ] ) }

[anydb_secondary]
${ join(", ", [ for k1 in [for k2,v2 in var.module_var_host_specifications[var.module_var_host_specification_plan] : k2 if v2.sap_host_type == "anydb_secondary"] : format("%s ansible_host=%s ansible_connection=ssh ansible_user=root",k1,var.module_var_host_provision_outputs[k1].output_host_private_ip) ] ) }

EOF
}
Loading