diff --git a/ansible/playbooks/sap-hana-cluster_role.yaml b/ansible/playbooks/sap-hana-cluster_role.yaml new file mode 100644 index 00000000..8efdaff6 --- /dev/null +++ b/ansible/playbooks/sap-hana-cluster_role.yaml @@ -0,0 +1,32 @@ +--- +- name: Use the cluster role + hosts: hana # ensure only two hosts! + remote_user: cloudadmin + become: true + # become_user: root + any_errors_fatal: true # any_errors_fatal strongly recommended! + + pre_tasks: + - name: Load SAP HANA variables + ansible.builtin.include_vars: ./vars/hana_vars.yaml + + - name: Ensure ClusterTools2 is installed + community.general.zypper: + name: ClusterTools2 + state: present + + vars: + platform: 'aws' + stonith: 'native' + primary: "{{ ansible_play_hosts[0] }}" + virtual_ip: "{{ aws_cluster_ip }}" # the Virtual IP address that the cluster will use. + hacluster_password: 'Example_poor_passwo0rd!' + aws_access_key_id: '{{ lookup("env", "AWS_ACCESS_KEY_ID") }}' # access key id of the account to be used to perform stonith actions + aws_secret_access_key: '{{ lookup("env", "AWS_SECRET_ACCESS_KEY") }}' # secret access key of the account to be used to perform stonith actions + + hana_sid: "{{ sap_hana_install_sid }}" + hana_instance_number: "{{ sap_hana_install_instance_number }}" + #dual_corosync_rings: true + #enable_hawk: true + roles: + - role: cluster diff --git a/terraform/aws/inventory.tmpl b/terraform/aws/inventory.tmpl index e79bff76..5d536a73 100644 --- a/terraform/aws/inventory.tmpl +++ b/terraform/aws/inventory.tmpl @@ -1,9 +1,10 @@ all: vars: use_sbd: ${use_sbd} - aws_route_table: ${routetable_id} + aws_route_table_id: ${routetable_id} aws_cluster_ip: ${virtual_ip} aws_stonith_tag: ${stonith_tag} + aws_region: ${region} children: hana: hosts: diff --git a/terraform/aws/outputs.tf b/terraform/aws/outputs.tf index 51310a20..437201d3 100644 --- a/terraform/aws/outputs.tf +++ b/terraform/aws/outputs.tf @@ -109,6 +109,7 @@ resource "local_file" "ansible_inventory" { routetable_id = aws_route_table.route-table.id, virtual_ip = local.hana_cluster_vip, stonith_tag = module.hana_node.stonith_tag + region = var.aws_region }) filename = "inventory.yaml" }