use ansible_hostname to construct canonical_hostname in /etc/hosts
inventory_hostname is ansible alias of the host. It may be equal to hostname in most cases, but also can be short alias for convenience. ansible_hostname is discovered hostname, i.e. real hostname. It make more sense to use real hostname to construct fqdn and use inventory_hostname as an alias. Change-Id: If980f67da27035aa81b554ef59dedaf5a34357f4
This commit is contained in:
parent
09c05c690e
commit
5b9cf44498
@ -24,13 +24,13 @@ function host_update {
|
||||
DOMAINNAME=$5
|
||||
|
||||
if [[ "${ANSHOSTNAME}" != "${RFCHOSTNAME}" ]] && [[ "${RFCHOSTNAME}" != "${INVHOSTNAME}" ]]; then
|
||||
insert_host_entry "${IPADDR} ${RFCHOSTNAME}.${DOMAINNAME} ${RFCHOSTNAME} ${INVHOSTNAME} ${ANSHOSTNAME}" "${IPADDR}"
|
||||
insert_host_entry "${IPADDR} ${ANSHOSTNAME}.${DOMAINNAME} ${RFCHOSTNAME} ${INVHOSTNAME} ${ANSHOSTNAME}" "${IPADDR}"
|
||||
elif [[ "${ANSHOSTNAME}" != "${RFCHOSTNAME}" ]] && [[ "${RFCHOSTNAME}" == "${INVHOSTNAME}" ]]; then
|
||||
insert_host_entry "${IPADDR} ${RFCHOSTNAME}.${DOMAINNAME} ${RFCHOSTNAME} ${ANSHOSTNAME}" "${IPADDR}"
|
||||
insert_host_entry "${IPADDR} ${ANSHOSTNAME}.${DOMAINNAME} ${RFCHOSTNAME} ${ANSHOSTNAME}" "${IPADDR}"
|
||||
elif [[ "${ANSHOSTNAME}" == "${RFCHOSTNAME}" ]] && [[ "${RFCHOSTNAME}" == "${INVHOSTNAME}" ]]; then
|
||||
insert_host_entry "${IPADDR} ${RFCHOSTNAME}.${DOMAINNAME} ${RFCHOSTNAME}" "${IPADDR}"
|
||||
insert_host_entry "${IPADDR} ${ANSHOSTNAME}.${DOMAINNAME} ${RFCHOSTNAME}" "${IPADDR}"
|
||||
else
|
||||
insert_host_entry "${IPADDR} ${RFCHOSTNAME}.${DOMAINNAME} ${RFCHOSTNAME} ${INVHOSTNAME}" "${IPADDR}"
|
||||
insert_host_entry "${IPADDR} ${ANSHOSTNAME}.${DOMAINNAME} ${RFCHOSTNAME} ${INVHOSTNAME}" "${IPADDR}"
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -89,11 +89,12 @@
|
||||
- "'dm_multipath' in modules_content"
|
||||
- "'ebtables' in modules_content"
|
||||
- "'vm.swappiness' in sysctl_content"
|
||||
- "'127.111.111.101 test1.openstack.local test1' in hosts_content"
|
||||
- "'127.111.111.102 test2.openstack.local test2' in hosts_content"
|
||||
- "'127.111.111.103 test3.openstack.local test3' in hosts_content"
|
||||
- "'127.0.0.1 {{ ansible_hostname }}.openstack.local localhost {{ ansible_hostname }}' in hosts_content"
|
||||
- "'127.0.1.1 {{ ansible_hostname }}.openstack.local localhost {{ ansible_hostname }}' in hosts_content"
|
||||
- "'127.111.111.101 {{ ansible_hostname }}.openstack.local test1 {{ ansible_hostname }}' in hosts_content"
|
||||
- "'127.111.111.102 {{ ansible_hostname }}.openstack.local test2 {{ ansible_hostname }}' in hosts_content"
|
||||
- "'127.111.111.103 {{ ansible_hostname }}.openstack.local test3 {{ ansible_hostname }}' in hosts_content"
|
||||
- "'127.111.111.103 test3.additional' not in hosts_content"
|
||||
- "'127.0.1.1 localhost.openstack.local localhost' in hosts_content"
|
||||
- "release_file.stat.exists"
|
||||
- "systat_file.stat.exists"
|
||||
- "'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' in environment_content"
|
||||
|
Loading…
Reference in New Issue
Block a user