forked from sap-linuxlab/community.sap_install
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathassert-dns-name-resolution.yml
More file actions
76 lines (66 loc) · 4.5 KB
/
Copy pathassert-dns-name-resolution.yml
File metadata and controls
76 lines (66 loc) · 4.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# SPDX-License-Identifier: Apache-2.0
---
- name: Assert that the DNS domain is set
ansible.builtin.assert:
that: not( (ansible_facts['domain'] is undefined) or (ansible_facts['domain'] is none) or (ansible_facts['domain'] | trim == '') )
fail_msg: "FAIL: The DNS domain is not configured! So variable 'sap_general_preconfigure_domain' needs to be configured!"
success_msg: "PASS: The DNS domain is configured."
# ignore_errors: "{{ sap_general_preconfigure_assert_ignore_errors | d(false) }}"
ignore_errors: true
- name: Assert that variable sap_general_preconfigure_domain is set
ansible.builtin.assert:
that: not( (sap_general_preconfigure_domain is undefined) or (sap_general_preconfigure_domain is none) or (sap_general_preconfigure_domain | trim == '') )
fail_msg: "FAIL: The variable 'sap_general_preconfigure_domain' is not set!"
success_msg: "PASS: The variable 'sap_general_preconfigure_domain' is set."
ignore_errors: "{{ sap_general_preconfigure_assert_ignore_errors | d(false) }}"
- name: Check if the bind-utils package, which contains the dig command, is available
ansible.builtin.assert:
that: "'bind-utils' in ansible_facts.packages"
fail_msg: "FAIL: The package 'bind-utils' is not installed! DNS checking not possible!"
ignore_errors: "{{ sap_general_preconfigure_assert_ignore_errors | d(false) }}"
- name: Check if IP address for sap_general_preconfigure_hostname.sap_general_preconfigure_domain is resolved correctly
ansible.builtin.command: dig {{ sap_general_preconfigure_hostname }}.{{ sap_general_preconfigure_domain }} +short
register: __sap_general_preconfigure_register_dig_short_assert
ignore_errors: true
changed_when: false
when: "'bind-utils' in ansible_facts.packages"
- name: Assert that ansible_facts['default_ipv4'].address is set
ansible.builtin.assert:
that: not( (ansible_facts['default_ipv4'].address is undefined) or (ansible_facts['default_ipv4'].address is none) or (ansible_facts['default_ipv4'].address | trim == '') )
fail_msg: "FAIL: The variable 'ansible_facts['default_ipv4'].address' is not defined!"
success_msg: "PASS: The variable 'ansible_facts['default_ipv4'].address' is defined."
ignore_errors: "{{ sap_general_preconfigure_assert_ignore_errors | d(false) }}"
- name: Assert that sap_general_preconfigure_ip is set
ansible.builtin.assert:
that: __sap_general_preconfigure_register_dig_short_assert.stdout == sap_general_preconfigure_ip
fail_msg: "FAIL: The variable 'sap_general_preconfigure_ip' is not set!"
success_msg: "PASS: The variable 'sap_general_preconfigure_ip' is set."
ignore_errors: "{{ sap_general_preconfigure_assert_ignore_errors | d(false) }}"
when: "'bind-utils' in ansible_facts.packages"
### BUG: dig does not use search path in resolv.con on PPCle
- name: Check if IP address for sap_general_preconfigure_hostname with search path is resolved correctly
ansible.builtin.command: dig {{ sap_general_preconfigure_hostname }} +search +short
register: __sap_general_preconfigure_register_dig_search_short_assert
changed_when: false
ignore_errors: true
when: "'bind-utils' in ansible_facts.packages"
- name: Assert that the IP address for sap_general_preconfigure_hostname is resolved correctly
ansible.builtin.assert:
that: __sap_general_preconfigure_register_dig_search_short_assert.stdout == sap_general_preconfigure_ip
fail_msg: "FAIL: The IP address for 'sap_general_preconfigure_hostname' could not be resolved!"
success_msg: "PASS: The IP address for 'sap_general_preconfigure_hostname' was resolved."
ignore_errors: "{{ sap_general_preconfigure_assert_ignore_errors | d(true) }}"
when: "'bind-utils' in ansible_facts.packages"
- name: Check if the reverse name resolution is correct
ansible.builtin.command: dig -x {{ sap_general_preconfigure_ip }} +short
register: __sap_general_preconfigure_register_dig_reverse_assert
changed_when: false
ignore_errors: true
when: "'bind-utils' in ansible_facts.packages"
- name: Assert that the reverse name resolution is correct
ansible.builtin.assert:
that: __sap_general_preconfigure_register_dig_reverse_assert.stdout == (sap_general_preconfigure_hostname + '.' + sap_general_preconfigure_domain + '.')
fail_msg: "FAIL: The reverse name resolution of 'sap_general_preconfigure_ip' was not successful!"
success_msg: "PASS: The reverse name resolution of 'sap_general_preconfigure_ip' was successful."
ignore_errors: "{{ sap_general_preconfigure_assert_ignore_errors | d(true) }}"
when: "'bind-utils' in ansible_facts.packages"