Skip to content

Commit

Permalink
Merge pull request #785 from berndfinger/issue-784-revert-to-dns-warning
Browse files Browse the repository at this point in the history
sap_general_preconfigure: Revert to ignoring DNS failures
  • Loading branch information
berndfinger authored Jul 1, 2024
2 parents 6694da4 + b402fd2 commit 36a5525
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
4 changes: 4 additions & 0 deletions roles/sap_general_preconfigure/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
@@ -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) }}"

0 comments on commit 36a5525

Please sign in to comment.