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

Add localhost binding in /etc/hosts #35

Closed
k-c-p opened this issue Feb 8, 2017 · 2 comments
Closed

Add localhost binding in /etc/hosts #35

k-c-p opened this issue Feb 8, 2017 · 2 comments

Comments

@k-c-p
Copy link

k-c-p commented Feb 8, 2017

The roles adds an entry in /etc/hosts that links 127.0.0.1 to the hostname and server-FQDN. Something like:

127.0.0.1    server.fqdn    server.hostname

As a consequence there is no entry for localhost in /etc/hosts which may affect services that rely on this. Suggestion is to adopt the role that the entry in /etc/hosts includes localhost and looks like this:

127.0.0.1    server.fqdn    server.hostname    localhost
@xenithorb
Copy link
Collaborator

xenithorb commented Feb 8, 2017

Indeed you are correct, and I've had the fix here for a little while. I've been extremely busy, and I need to be more diligent about pushing code to master:

fb315af#diff-2444ad0870f91f17ca6c2a5e96b26823R118

There are quite a few updates contained in that branch. You're welcomed to test it (that branch) if you want. I'll make sure to add a "Fixes" fo the commit message before I marge it

@jautz
Copy link

jautz commented Feb 8, 2017

Allow me to add a few suggestions from our code base that currently has this as a workaround:

  • the regexp could be a bit more precise, i.e. escape the literal dots and require any kind of whitespace after the final digit -- otherwise it would match 127.0.0.123 as well.
  • if missing, insert on top of the hosts file because on many systems it is IPv4 on top and IPv6 below.
- lineinfile:
    dest: /etc/hosts
    line:  "127.0.0.1\tlocalhost\t{{ ansible_fqdn }}\t{{ ansible_nodename }}\t{{ ansible_hostname }}"
    regexp: '^127\.0\.0\.1\s+'
    insertbefore: BOF

xenithorb added a commit that referenced this issue Oct 22, 2017
  - Adds localhost back
  - Improves regexp to escape periods properly
  - Inserts to the beginning of file if not present

Closes #35, thanks @jautz!
xenithorb added a commit that referenced this issue Oct 22, 2017
- Adds localhost back
  - Improves regexp to escape periods properly
  - Inserts to the beginning of file if not present

Closes #35, thanks @jautz!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants