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

[FEATURE] Add ability to force overwrite entries if old names are already present #42

Open
mdschmitt opened this issue Jun 30, 2022 · 0 comments

Comments

@mdschmitt
Copy link

Is your feature request related to a problem?

If there's an existing minion that's replaced with another minion of the same name but different IP (and the original minion is renamed) the hostsfile formula will simply add an entry for the new node, and add the new name for the old node to the old node's entry. This means that the original name gets two entries in /etc/hosts. Visual example:
Original node (the "before" state):

10.0.0.2  prometheus.my.domain.com

< Rename prometheus.my.domain.com minion_id to "prometheus-old.my.domain.com" >
< Spin up new node and call it "prometheus.my.domain.com" >

Now when running hostsfile on any minions that already had the old entry, they grab both new and old node entries from the Mine, and their /etc/hosts looks like:

10.0.0.2  prometheus.my.domain.com prometheus-old.my.domain.com
10.0.0.3  prometheus.my.domain.com

Describe the solution you'd like

Add a "purge existing entries" behavior to the formula. Probably an if condition to add the clean flag to host.present in init.sls?

The intent would be to update minions' /etc/hosts to point prometheus.my.domain.com to the new minion and set the old entry to "prometheus-old.my.domain.com" only. Like so:

10.0.0.2  prometheus-old.my.domain.com
10.0.0.3  prometheus.my.domain.com

Describe alternatives you've considered

n/a

Additional context

n/a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant