deploy/ansible/roles-db/windows/4.4.0-mssql-install/tasks/4.4.0.1-mssql-main.yaml [65:126]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - name:                                 "WIN-SQL: Install SQL4SAP on {{ ansible_hostname }}"
      ansible.windows.win_shell: |
                                            {{ download_directory_windows }}\{{ mssserver_version }}\SQL4SAP.bat -d
      args:
        creates:                            '{{ sap_deployment_automation }}\{{ sap_sid | upper }}\sap_deployment_sqldb.txt'
      vars:
        ansible_become:                     true
        ansible_become_method:              ansible.builtin.runas
        ansible_become_user:                '{{ sap_sid }}adm@{{ domain_name }}'
        ansible_become_password:            "{{ domain_user_password }}"
      register:                             sql_install_output
      failed_when:                          sql_install_output.rc != 0

    - name:                                 "WIN-SQL: Installation results"
      ansible.builtin.debug:
        msg:                                "SQL4SAP Installation succeeded"
      changed_when:                         true
      when:
        - sql_install_output.rc is defined
        - sql_install_output.rc == 0
        - sql_install_output.stdout | length > 0
        - sql_install_output.stdout is search("Execution successful")
      notify:                               "WIN-SQL: Restart SQL Server VM"

    - name:                                 "Force all notified handlers to run now"
      ansible.builtin.meta:                 flush_handlers

    - name:                                 "WIN-SQL: Installation results"
      ansible.builtin.debug:
        msg:                                "WIN-SQL: A reboot is pending. We will restart the machine, so please start SQL4SAP installation again."
      changed_when:                         true
      when:
        - sql_install_output.rc is defined
        - sql_install_output.rc == 0
        - sql_install_output.stdout | length > 0
        - sql_install_output.stdout is search("A reboot is pending.")
      notify:                               "WIN-SQL: Restart SQL Server VM"

    - name:                                 "Force all notified handlers to run now"
      ansible.builtin.meta:                 flush_handlers

    - name:                                 "WIN-SQL: Installation results"
      ansible.builtin.debug:
        msg:
          - "SQL4SAP Installation failed, another installation might be already exist"
          - "SQL4SAP output: {{ sql_install_output }}"
      when:
        - sql_install_output.rc is defined
        - sql_install_output.rc == 0
        - sql_install_output.stdout | length > 0
        - sql_install_output.stdout is search("Error during execution")

    - name:                                 "WIN-SQL: SQL4SAP Install || Flag File"
      ansible.windows.win_file:
        path:                               '{{ sap_deployment_automation }}\{{ sap_sid | upper }}\sap_deployment_sqldb.txt'
        state:                              touch
      when:
        - sql_install_output.stdout | length > 0
        - sql_install_output.stdout is not search("A reboot is pending.")

  when:
    - not sql_installed.stat.exists
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



deploy/ansible/roles-db/windows/4.4.0-mssql-install/tasks/4.4.0.1-mssql-main.yaml [132:193]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - name:                                 "WIN-SQL: Install SQL4SAP on {{ ansible_hostname }}"
      ansible.windows.win_shell: |
                                            {{ download_directory_windows }}\{{ mssserver_version }}\SQL4SAP.bat -d
      args:
        creates:                            '{{ sap_deployment_automation }}\{{ sap_sid | upper }}\sap_deployment_sqldb.txt'
      vars:
        ansible_become:                     true
        ansible_become_method:              ansible.builtin.runas
        ansible_become_user:                '{{ sap_sid }}adm@{{ domain_name }}'
        ansible_become_password:            "{{ domain_user_password }}"
      register:                             sql_install_output
      failed_when:                          sql_install_output.rc != 0

    - name:                                 "WIN-SQL: Installation results"
      ansible.builtin.debug:
        msg:                                "SQL4SAP Installation succeeded"
      changed_when:                         true
      when:
        - sql_install_output.rc is defined
        - sql_install_output.rc == 0
        - sql_install_output.stdout | length > 0
        - sql_install_output.stdout is search("Execution successful")
      notify:                               "WIN-SQL: Restart SQL Server VM"

    - name:                                 "Force all notified handlers to run now"
      ansible.builtin.meta:                                 flush_handlers

    - name:                                 "WIN-SQL: Installation results"
      ansible.builtin.debug:
        msg:                                "WIN-SQL: A reboot is pending. We will restart the machine, so please start SQL4SAP installation again."
      changed_when:                         true
      when:
        - sql_install_output.rc is defined
        - sql_install_output.rc == 0
        - sql_install_output.stdout | length > 0
        - sql_install_output.stdout is search("A reboot is pending.")
      notify:                               "WIN-SQL: Restart SQL Server VM"

    - name:                                 "Force all notified handlers to run now"
      ansible.builtin.meta:                 flush_handlers

    - name:                                 "WIN-SQL: Installation results"
      ansible.builtin.debug:
        msg:
          - "SQL4SAP Installation failed, another installation might be already exist"
          - "SQL4SAP output: {{ sql_install_output }}"
      when:
        - sql_install_output.rc is defined
        - sql_install_output.rc == 0
        - sql_install_output.stdout | length > 0
        - sql_install_output.stdout is search("Error during execution")

    - name:                                 "WIN-SQL: SQL4SAP Install || Flag File"
      ansible.windows.win_file:
        path:                               '{{ sap_deployment_automation }}\{{ sap_sid | upper }}\sap_deployment_sqldb.txt'
        state:                              touch
      when:
        - sql_install_output.stdout | length > 0
        - sql_install_output.stdout is not search("A reboot is pending.")

  when:
    - not sql_installed.stat.exists
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



