installation - Ansible setup "Magic Variables" -
i new ansible (1 2 months) , ready have majority of configuration / setup tasks migrated ansible. seeing inconsistencies ansible_domain variable on servers. can tell me setting(s) on client machine used populate ansible_domain variable can rectify it.
the domain gathered python snippet:
'.'.join(socket.getfqdn().split('.')[1:])
or in words, string behind last .
or in case there no .
, whole string.
from docs of socket.getfqdn():
return qualified domain name name. if name omitted or empty, interpreted local host. find qualified name, hostname returned gethostbyaddr() checked, followed aliases host, if available. first name includes period selected. in case no qualified domain name available, hostname returned gethostname() returned.
the full code here https://github.com/ansible/ansible/blob/d49b11e9962df4bde4b8f3d61029305af4115748/lib/ansible/module_utils/facts.py#l183
Comments
Post a Comment