Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The controller hostname recorded by ara for the controller can be something like 1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa (on OS X?) #472

Open
dmsimard opened this issue Dec 21, 2022 · 1 comment
Labels
enhancement help wanted plugins Related to the Ansible plugins

Comments

@dmsimard
Copy link
Contributor

What is the issue ?

Using ara under Mac OS X, the hostname that python picks up on my machine is 1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa which isn't particularly useful when the hostname and hostname -f commands both return a proper hostname like laptop.example.org.

Screenshot from 2022-12-21 17-45-08

We rely on python's socket.getfqdn() and socket.gethostname() to retrieve the hostname:

if self.localhost_as_hostname_format.startswith("fqdn"):
hostname = socket.getfqdn()
if self.localhost_as_hostname_format.startswith("hostname"):
hostname = socket.gethostname()

On OS X (at least on my machine, I'm an OS X noob), getfqdn returns the ipv6 arpa mentioned previously and gethostname returns the actual hostname.

What should be happening ?

There's settings that determine which format is used:
Screenshot from 2022-12-21 18-04-11

In this particular case, hostname would probably be a better default than fqdn. Is this generally true for all distros ?

Changing it could result in playbooks being associated to a "new" controller if the fqdn and hostname are not the same.

Happy to hear what you think.

@dmsimard dmsimard added enhancement help wanted plugins Related to the Ansible plugins labels Dec 21, 2022
@alexander-haller
Copy link

alexander-haller commented Dec 22, 2022

In this particular case, hostname would probably be a better default than fqdn. Is this generally true for all distros ?

on Debian 11 here:

socket.getfqdn() -> laptop.example.org
socket.gethostname() -> laptop

I prefer getfqdn much more since gethostname could not be unique.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement help wanted plugins Related to the Ansible plugins
Projects
None yet
Development

No branches or pull requests

2 participants