Skip to content

Conversation

@marcelmamula
Copy link
Contributor

@marcelmamula marcelmamula commented Nov 27, 2025

Changes

This has started as small PR to add variable for HOME folder path, but it turned out into complete rework of this role to catch it up with conventions that are followed on project level, as well as resolving ansible-core 2.20 warnings.

  • Add new stateful variable with associated code that can remove replication configuration.
    • Extra validation to ensure that removal is executed only for correctly defined nodes variable, not blindly.
  • Add full suite of validations of variables including internal variables that allow for backwards compatibility.
  • Remove all assignments using "global" variables, but mention them in comment and keep them implemented as backwards compatibility.
  • Rename some variables where value did not represent its name (FQDN != domain).
  • Use FLAG variables to identify primary and secondary nodes for simpler conditionals
  • Fix typos in Readme and examples.
  • Remove confusing optional key comments, since none of them were optional, but mandatory.
  • Renaming ansible facts to align with ansible 2.20 changes.
  • Add HOME variable to solve sap_ha_install_hana_hsr: fixed home directory sourcing #988
  • Asserts that paths to hdbuserstore, executables and HOME are present

Tests

This was tested on SLES 15 SP7 on AWS with creating and removing configuration, as well as running idempotent reruns.
Tested with ansible-core 2.18 and 2.20.

Example output:

Enable replication with `sap_ha_install_hana_hsr_state: present`
TASK [community.sap_install.sap_ha_install_hana_hsr : SAP HSR - Show final message and current replication status] ***********************
 [started TASK: community.sap_install.sap_ha_install_hana_hsr : SAP HSR - Show final message and current replication status on h02hana0]
 [started TASK: community.sap_install.sap_ha_install_hana_hsr : SAP HSR - Show final message and current replication status on h02hana1]
ok: [h02hana0] =>
    msg: |-
        HANA System Replication is enabled and verified on this node.

        Current System Replication status:

        System Replication State
        ~~~~~~~~~~~~~~~~~~~~~~~~

        online: true

        mode: primary
        operation mode: primary
        site id: 1
        site name: DC01

        is source system: true
        is secondary/consumer system: false
        has secondaries/consumers attached: true
        is a takeover active: false
        is primary suspended: false

        Host Mappings:
        ~~~~~~~~~~~~~~

        h02hana0 -> [DC02] h02hana1
        h02hana0 -> [DC01] h02hana0


        Site Mappings:
        ~~~~~~~~~~~~~~
        DC01 (primary/primary)
            |---DC02 (sync/logreplay)

        Tier of DC01: 1
        Tier of DC02: 2

        Replication mode of DC01: primary
        Replication mode of DC02: sync

        Operation mode of DC01: primary
        Operation mode of DC02: logreplay

        Mapping: DC01 -> DC02

        Hint based routing site:
        done.
ok: [h02hana1] =>
    msg: |-
        HANA System Replication is enabled and verified on this node.

        Current System Replication status:

        System Replication State
        ~~~~~~~~~~~~~~~~~~~~~~~~

        online: true

        mode: sync
        operation mode: logreplay
        site id: 2
        site name: DC02

        is source system: false
        is secondary/consumer system: true
        has secondaries/consumers attached: false
        is a takeover active: false
        is primary suspended: false
        is timetravel enabled: false
        replay mode: auto
        active primary site: 1

        primary masters: h02hana0

        Host Mappings:
        ~~~~~~~~~~~~~~

        h02hana1 -> [DC02] h02hana1
        h02hana1 -> [DC01] h02hana0


        Site Mappings:
        ~~~~~~~~~~~~~~
        DC01 (primary/primary)
            |---DC02 (sync/logreplay)

        Tier of DC01: 1
        Tier of DC02: 2

        Replication mode of DC01: primary
        Replication mode of DC02: sync

        Operation mode of DC01: primary
        Operation mode of DC02: logreplay

        Mapping: DC01 -> DC02

        Hint based routing site:
        done.
Remove replication with `sap_ha_install_hana_hsr_state: absent`
TASK [community.sap_install.sap_ha_install_hana_hsr : SAP HSR - Show final message and current replication status] ***********************
 [started TASK: community.sap_install.sap_ha_install_hana_hsr : SAP HSR - Show final message and current replication status on h02hana0]
 [started TASK: community.sap_install.sap_ha_install_hana_hsr : SAP HSR - Show final message and current replication status on h02hana1]
ok: [h02hana0] =>
    msg: |-
        HANA System Replication is disabled on this node.

        Current System Replication status:

        System Replication State
        ~~~~~~~~~~~~~~~~~~~~~~~~

        online: true

        mode: none
        done.
ok: [h02hana1] =>
    msg: |-
        HANA System Replication is disabled on this node.

        Current System Replication status:

        System Replication State
        ~~~~~~~~~~~~~~~~~~~~~~~~

        online: true

        mode: none
        done.

@marcelmamula marcelmamula self-assigned this Nov 27, 2025
@marcelmamula marcelmamula added the enhancement New feature or request label Nov 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant