-
Notifications
You must be signed in to change notification settings - Fork 0
/
integration.tf
43 lines (39 loc) · 1.7 KB
/
integration.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#### Ansible inventory.
resource "local_file" "ansible_inventory" {
content = <<-DOC
all:
hosts:
db_host_primary:
ansible_host: "${local.ip_primary}"
db_host_dr:
ansible_host: "${local.ip_dr}"
DOC
filename = "ansible/inventory.yml"
count = (data.ibm_is_instance.db-vsi != [] || data.ibm_is_bare_metal_server.db-bms != []) ? 1 : 0
}
# Export Terraform variable values to an Ansible var_file
resource "local_file" "ansible_saphana-vars" {
content = <<-DOC
---
# Ansible vars_file containing variable values passed from Terraform.
# Generated by "terraform plan&apply" command.
hana_profile: "${var.DB_PROFILE}"
# HANA DB configuration for PRIMARY and DR
hana_main_password: "${trimspace(var.HANA_MAIN_PASSWORD)}"
hdb_host_dr: "${local.ip_dr}"
hdb_hostname_dr: "${trimspace(var.DB_HOSTNAME_DR)}"
hdb_host_primary: "${local.ip_primary}"
hdb_hostname_primary: "${trimspace(var.DB_HOSTNAME_PRIMARY)}"
# SAP HANA Installation kit path
kit_saphana_file: "${trimspace(var.KIT_SAPHANA_FILE)}"
...
DOC
filename = "ansible/saphana-vars.yml"
count = (data.ibm_is_instance.db-vsi != [] || data.ibm_is_bare_metal_server.db-bms != []) ? 1 : 0
}
# Export Terraform variable values to an Ansible var_file
resource "local_file" "tf_ansible_vars_generated_file" {
source = "${lower(trimspace(var.HANA_SERVER_TYPE)) == "virtual" ? "${path.root}/modules/db-vsi/files/hana_vm_volume_layout.json" : "${path.root}/modules/db-bms/files/hana_bm_volume_layout.json"}"
filename = "${lower(trimspace(var.HANA_SERVER_TYPE)) == "virtual" ? "ansible/hana_vm_volume_layout.json": "ansible/hana_bm_volume_layout.json"}"
count = (data.ibm_is_instance.db-vsi != [] || data.ibm_is_bare_metal_server.db-bms != []) ? 1 : 0
}