diff --git a/roles/sap_general_preconfigure/defaults/main.yml b/roles/sap_general_preconfigure/defaults/main.yml index 6824bcd15..5cef8b737 100644 --- a/roles/sap_general_preconfigure/defaults/main.yml +++ b/roles/sap_general_preconfigure/defaults/main.yml @@ -146,6 +146,10 @@ sap_general_preconfigure_kernel_parameters: "{{ __sap_general_preconfigure_kerne sap_general_preconfigure_max_hostname_length: '13' # The maximum length of the hostname. See SAP note 611361. +sap_general_preconfigure_ignore_dns_failures: true +# Set to `false` for failing the role if one of the DNS name resolution check fails. The default is to +# report such errors and continue running the role. + # If "global" variables are set, use those. If not, default to the values from gather_facts: sap_general_preconfigure_ip: "{{ sap_ip | d(ansible_default_ipv4.address) }}" # The IPV4 address to be used for updating or checking `/etc/hosts` entries. diff --git a/roles/sap_general_preconfigure/tasks/RedHat/generic/check-dns-name-resolution.yml b/roles/sap_general_preconfigure/tasks/RedHat/generic/check-dns-name-resolution.yml index 8c6106e9f..8abf1fc55 100644 --- a/roles/sap_general_preconfigure/tasks/RedHat/generic/check-dns-name-resolution.yml +++ b/roles/sap_general_preconfigure/tasks/RedHat/generic/check-dns-name-resolution.yml @@ -1,21 +1,24 @@ # SPDX-License-Identifier: Apache-2.0 --- -- name: "Verify the correct DNS hostname to IP address resolution (A record) for {{ sap_general_preconfigure_hostname }}.{{ sap_general_preconfigure_domain }}" +- name: "Verify the correct DNS hostname to IP address resolution (A record)" ansible.builtin.shell: test "$(dig {{ sap_general_preconfigure_hostname }}.{{ sap_general_preconfigure_domain }} +short)" = "{{ sap_general_preconfigure_ip }}" changed_when: false register: __sap_general_preconfigure_register_dns_test_a failed_when: __sap_general_preconfigure_register_dns_test_a.rc != 0 + ignore_errors: "{{ sap_general_preconfigure_ignore_dns_failures | d(true) }}" ### BUG: dig does not use search path in resolv.conf on PPCle -- name: "Verify the correct DNS hostname to IP address resolution (A record) using the hostname and the search list for {{ sap_general_preconfigure_hostname }}.{{ sap_general_preconfigure_domain }}" +- name: "Verify the correct DNS hostname to IP address resolution (A record) using hostname and search list" ansible.builtin.shell: test "$(dig {{ sap_general_preconfigure_hostname }} +search +short)" = "{{ sap_general_preconfigure_ip }}" changed_when: false register: __sap_general_preconfigure_register_dns_test_searchlist failed_when: __sap_general_preconfigure_register_dns_test_searchlist.rc != 0 + ignore_errors: "{{ sap_general_preconfigure_ignore_dns_failures | d(true) }}" -- name: "Verify the correct DNS IP address to FQDN resolution (PTR record) for {{ sap_general_preconfigure_ip }}" +- name: "Verify the correct DNS IP address to FQDN resolution (PTR record)" ansible.builtin.shell: test "$(dig -x {{ sap_general_preconfigure_ip }} +short)" = "{{ sap_general_preconfigure_hostname }}.{{ sap_general_preconfigure_domain }}." changed_when: false register: __sap_general_preconfigure_register_dns_test_ptr failed_when: __sap_general_preconfigure_register_dns_test_ptr.rc != 0 + ignore_errors: "{{ sap_general_preconfigure_ignore_dns_failures | d(true) }}"