---

# moved to configure-etc-hosts.yml:
#- name: Verify that the DNS domain is set
#  assert:
#    that:
#      not( (sap_domain is undefined) or (sap_domain is none) or (sap_domain | trim == '') )
#    msg: "You need to define the variable 'sap_domain' in defaults/main.yml."

### DNS is not that necessary and as such the errors are ignored
### for production it is strongly recommended to have proper DNS setup
# - name: Ensure dig command is installed
#   package:
#     name: bind-utils
#     state: present

- name: Check dns forwarding settings
  shell: test "$(dig {{ sap_hostname }}.{{ sap_domain }} +short)" = "{{ sap_ip }}"
  changed_when: false
  ignore_errors: true

### BUG: dig does not use search path in resolv.con on PPCle
- name: Check resolv.conf settings
  shell: test "$(dig {{ sap_hostname }} +search +short)" = "{{ sap_ip }}"
  changed_when: false
  ignore_errors: true

- name: Check dns reverse settings
  shell: test "$(dig -x {{ sap_ip }} +short)" = "{{ sap_hostname }}.{{ sap_domain }}."
  changed_when: false
  ignore_errors: true
