File tree Expand file tree Collapse file tree 5 files changed +35
-2
lines changed
roles/edpm_nodes_validation Expand file tree Collapse file tree 5 files changed +35
-2
lines changed Original file line number Diff line number Diff line change @@ -22,5 +22,7 @@ edpm_nodes_validation_hide_sensitive_logs: true
2222edpm_nodes_validation_ping_test_ips : []
2323edpm_nodes_validation_validate_controllers_icmp : true
2424edpm_nodes_validation_validate_fqdn : false
25+ edpm_nodes_validation_validate_fqdn_hosts_file : /etc/hosts
26+ edpm_nodes_validation_check_for_fqdn : true
2527edpm_nodes_validation_validate_gateway_icmp : true
2628edpm_nodes_validation_ping_test_gateway_ips : []
Original file line number Diff line number Diff line change @@ -16,10 +16,18 @@ argument_specs:
1616 description : Attempt to reach controllers with ping.
1717 type : bool
1818 default : true
19+ edpm_nodes_validation_check_for_fqdn :
20+ description : Verify if an FQDN is set. Typically required for TLS-e.
21+ type : bool
22+ default : true
1923 edpm_nodes_validation_validate_fqdn :
2024 description : Verify if hostname matches FQDN from /etc/hosts
2125 type : bool
2226 default : false
27+ edpm_nodes_validation_validate_fqdn_hosts_file :
28+ description : Hosts file to check for verifying that hostname matches FQDN
29+ type : str
30+ default : /etc/hosts
2331 edpm_nodes_validation_validate_gateway_icmp :
2432 description : Attempt to reach gateway with ping.
2533 type : bool
Original file line number Diff line number Diff line change 2626 ansible.builtin.dnf :
2727 name : hostname
2828 state : present
29+ - name : Set a FQDN
30+ command : hostname instance.localdomain
31+ - name : Add FQDN to /tmp/hosts
32+ lineinfile :
33+ path : /tmp/hosts
34+ line : 127.0.0.1 instance.localdomain instance
35+ create : true
2936 roles :
3037 - role : osp.edpm.env_data
Original file line number Diff line number Diff line change 11edpm_nodes_validation_validate_fqdn : true
2+ edpm_nodes_validation_validate_fqdn_hosts_file : /tmp/hosts
Original file line number Diff line number Diff line change 6464 - edpm_nodes_validation_validate_controllers_icmp|bool
6565 - edpm_nodes_validation_ping_test_ips | length > 0
6666
67- - name : Verify the configured FQDN vs /etc/hosts
67+ - name : Verify a FQDN is set block
68+ when :
69+ - edpm_nodes_validation_check_for_fqdn|bool
70+ block :
71+ - name : Run hostname -f
72+ ansible.builtin.command : hostname -f
73+ register : hostname
74+ changed_when : false
75+
76+ - name : Verify a FQDN is set
77+ ansible.builtin.assert :
78+ that : hostname.stdout.find(".") != -1
79+ fail_msg : " {{ hostname.stdout }} does not contain . and does not appear to be an FQDN."
80+ success_msg : " {{ hostname.stdout }} contains . and appears to be an FQDN."
81+
82+ - name : Verify the configured FQDN vs {{ edpm_nodes_validation_validate_fqdn_hosts_file }}
6883 ansible.builtin.shell : |
6984 HOSTNAME=$(hostname)
7085 SHORT_NAME=$(hostname -s)
71- FQDN_FROM_HOSTS=$(awk '$1 !~ /#/ && $3 == "'${SHORT_NAME}'"{print $2}' /etc/hosts )
86+ FQDN_FROM_HOSTS=$(awk '$1 !~ /#/ && $3 == "'${SHORT_NAME}'"{print $2}' {{ edpm_nodes_validation_validate_fqdn_hosts_file }} )
7287 if [[ $HOSTNAME != $FQDN_FROM_HOSTS ]]; then
7388 echo "FAILURE"
7489 echo -e "System hostname: ${HOSTNAME}\nEntry from /etc/hosts: ${FQDN_FROM_HOSTS}\n"
You can’t perform that action at this time.
0 commit comments