-
Notifications
You must be signed in to change notification settings - Fork 31
Hosts file can generate duplicate entry weirdness #13
Comments
andymcc: I'm not sure we can fix this in a sensible way since some hosts will have the same IP (nova-compute and a physical host, for example) - I think we are better off investigating how to prevent "unmanaged" nodes (nodes not in the inventory) from existing. So guarding against having 2 different inventory files (different sets of containers on the same IPs etc). |
apsu: It might help to provide another bit of context to consider here. Ansible used to ship a "host" module which would attempt to manage your /etc/hosts file for you. Our own dear claco pointed out an issue with how it handled aliases -- exactly as you're seeing even with just lineinfile -- and the module got pulled from Ansible and hasn't yet been replaced. The usual solution I see in playbooks for dealing with /etc/hosts is to use a template and render it with exactly the contents that host should have, rather than lineinfile. That said... if you Want the old host module to poke at, I actually have it stashed away in my ansible fork I use with my dockerlab/virtlab repos, since I find it useful for most /etc/hosts tasks. It's located here: https://github.com/Apsu/ansible/blob/dockerlab/library/system/host |
claco: Some people who have simple needs, use the 'line in file' module with regex/replace. |
andymcc: PR'd against this on new repo #1 |
andymcc: Fixed in local branch: Fixed in local branch: https://github.com/andymcc/ansible-lxc-rpc/tree/hosts_duplicate |
Can this issue be closed? |
Adds to tasks in the updatehostsfile play that will do the following to the /etc/hosts file: * Removes any entries that match the IP of current host, but with a different hostname * Removes any entries that match the hostname of the current host but with a different IP This will prevent duplicate entries and other /etc/hosts file related strangeness. Fixes rcbops#13
Adds to tasks in the updatehostsfile play that will do the following to the /etc/hosts file: * Removes any entries that match the IP of current host, but with a different hostname * Removes any entries that match the hostname of the current host but with a different IP This will prevent duplicate entries and other /etc/hosts file related strangeness. Fixes rcbops#13
Adds to tasks in the updatehostsfile play that will do the following to the /etc/hosts file: * Removes any entries that match the IP of current host, but with a different hostname * Removes any entries that match the hostname of the current host but with a different IP This will prevent duplicate entries and other /etc/hosts file related strangeness. Fixes rcbops#13
Adds to tasks in the updatehostsfile play that will do the following to the /etc/hosts file: * Removes any entries that match the IP of current host, but with a different hostname * Removes any entries that match the hostname of the current host but with a different IP This will prevent duplicate entries and other /etc/hosts file related strangeness. Fixes rcbops#13
If you remove containers/re-run ansible duplicate hosts will be creating leading to very inconsistent and weird results:
The text was updated successfully, but these errors were encountered: