sap_ha_install_hana_hsr: review and improve PKI sync logic
As per Kirill's request: https://github.com/sap-linuxlab/community.sap_install/pull/161#discussion_r909593209
[kksat](https://github.com/kksat) [Jun 29, 2022](https://github.com/sap-linuxlab/community.sap_install/pull/161#discussion_r909593209)
I think PKI files should be compared first before any copy, because this might not run first time and file might be the same. And this is also good for indempotency.
PKI files are very sensitive and this is not good practice to put them into /tmp/ directory.
there is ansible.posix.sinchronize module that can sync files from one host to another. See https://stackoverflow.com/questions/25505146/how-to-copy-files-between-two-nodes-using-ansible
Here is an example from that link
- hosts: ServerB
tasks:
- name: Transfer file from ServerA to ServerB
synchronize:
src: /path/on/server_a
dest: /path/on/server_b
delegate_to: ServerA
This uses the default mode: push, so the file gets transferred from the delegate (ServerA) to the current remote (ServerB).
There might be problem with syncronize module if it is not supported. We have to check that.
I comment here just for documenting: https://docs.ansible.com/ansible/latest/collections/ansible/posix/synchronize_module.html
I comment here just for documenting: https://docs.ansible.com/ansible/latest/collections/ansible/posix/synchronize_module.html
Note that this is a non-ansible-core module, which we should try to avoid whenever possible. So we can reduce dependencies.
https://github.com/sap-linuxlab/community.sap_install/blob/7720d7a025a8cca1c7dde23b46df8174e2fdf0fc/roles/sap_hana_install/tasks/pre_install.yml#L122 and https://github.com/sap-linuxlab/community.sap_install/blob/7720d7a025a8cca1c7dde23b46df8174e2fdf0fc/roles/sap_hana_install/tasks/pre_install/hdblcm_prepare.yml#L33 may be worth a look.