redhat-sap / sap-hana-deployment

Deploys SAP HANA on the given hosts
Apache License 2.0
13 stars 20 forks source link

Unarchive of zip file is skipping #27

Closed balaguduru closed 4 years ago

balaguduru commented 4 years ago

Unarchive step is skipping even after giving the right variables as required by the task.

playbook.yml

- hosts: 127.0.0.1
  connection: local
  tasks:
  - name: Extract ZIP archive
    block:
      - name: Use unarchive to extract the SAP HANA Bundle ZIP file
        unarchive:
          src: "{{ sap_hana_deployment_zip_path }}/{{ sap_hana_deployment_zip_file_name }}"
          dest: "{{ sap_hana_deployment_zip_path }}"
        register: sap_hana_deployment_register_extractzip
        args:
          creates: "{{ sap_hana_deployment_zip_path }}"
          chdir: "{{ sap_hana_deployment_zip_path }}"
      - name: Setting fact for HANA installer path
        set_fact:
          sap_hana_installdir: "{{ sap_hana_deployment_zip_path }}/DATA_UNITS/HDB_SERVER_LINUX_X86_64"
    when:
      - not(( sap_hana_deployment_zip_path is none ) or ( sap_hana_deployment_zip_path | trim == ''))
      - not(( sap_hana_deployment_zip_file_name is none ) or (sap_hana_deployment_zip_file_name | trim == ''))

vars.yml

sap_hana_deployment_zip_path: /software/HANA_installation
sap_hana_deployment_zip_file_name: 51053787.ZIP

output of ansible-playbook --connection=local --inventory 127.0.0.1, playbook.yml --extra-vars '@vars.yml'

PLAY [127.0.0.1] **********************************************************************************************************

TASK [Gathering Facts] ****************************************************************************************************
ok: [127.0.0.1]

TASK [Use unarchive to extract the SAP HANA Bundle ZIP file] **************************************************************
skipping: [127.0.0.1]

TASK [Setting fact for HANA installer path] *******************************************************************************
ok: [127.0.0.1]

PLAY RECAP ****************************************************************************************************************
127.0.0.1                  : ok=2    changed=0    unreachable=0    failed=0    skipped=1    rescued=0    ignored=0   
balaguduru commented 4 years ago

I verified the directory exists and the filename are accurate

rhmk commented 4 years ago

Hi, this is exactly why it skipped, creates: "{{ sap_hana_deployment_zip_path }}" is wrong -- It need to test e.g. for the unpacked manifestfile or similar

rhmk commented 4 years ago

creates: .{{ sap_hana_deployment_zip_path }} checks if the file sap_hana_deployment_zip_path exists and does not do anything, if it already exists. It is used as a marker that unarchive was successful. Hence you need to specify a particular file (if possible the last file that is unpacked) and if it is there remove it. for now I suggest checking for the hdblcm binary or the manifest file ...

balaguduru commented 4 years ago

Got it. That makes sense. Thank you for the clarification.