This will fail if ansible runs through a didicated admin interface instead of the public interface where the system is accessed through or some other reason.
sap-preconfigure uses sap_hostname for it and it should be used here as well and just default to ansible_hostname in all other cases.
change template to sth like {{ sap_hostname | default(ansible_hostname) }}
This will fail if ansible runs through a didicated admin interface instead of the public interface where the system is accessed through or some other reason. sap-preconfigure uses sap_hostname for it and it should be used here as well and just default to ansible_hostname in all other cases. change template to sth like {{ sap_hostname | default(ansible_hostname) }}