---

- name: Display the role path
  debug:
    var: role_path

- name: Print deprecation notice
  pause:
    prompt: |
      ""
      "*** NOTE: This role is deprecated. ***"
      ""
      "Role sap_hana_preconfigure provides all the features of this role, and more."
      "You can find the role in repository https://www.github.com/sap-linuxlab/community.sap_install ."
      ""
      "Press RETURN to continue anyway, or <ctrl>c, a, to abort:"

- name: Include OS specific vars
  include_vars: '{{ item }}'
  with_first_found:
    - '{{ ansible_distribution }}_{{ ansible_distribution_version }}.yml'
    - '{{ ansible_distribution }}_{{ ansible_distribution_major_version }}.yml'
    - '{{ ansible_os_family }}.yml'

- name: Set filename prefix to empty string if role is run in normal mode
  set_fact:
    assert_prefix: ""
  when: not sap_hana_preconfigure_assert|d(false)

- name: Prepend filename with assert string if role is run in assert mode
  set_fact:
    assert_prefix: "assert-"
  when: sap_hana_preconfigure_assert|d(false)

- name: Examine the OS minor version
  set_fact:
    __sap_hana_preconfigure_fact_ansible_distribution_minor_version: '{{ ansible_distribution_version.split(".")[1] }}'

# required for installation and configuration tasks:
- name: Gather package facts
  package_facts:

- include_tasks: '{{ ansible_distribution }}/{{ assert_prefix }}installation.yml'
  when: sap_hana_preconfigure_config_all|d(true) or sap_hana_preconfigure_installation|d(false)

- include_tasks: '{{ ansible_distribution }}/{{ assert_prefix }}configuration.yml'
  when: sap_hana_preconfigure_config_all|d(true) or sap_hana_preconfigure_configuration|d(false)
