I use /etc/cloud/templates/hosts.debian.tmpl file to have permanent /etc/hosts/ rules for my Ubuntu server (ver 22).
Today I updated the server but I had troubles with Nginx Proxy setup on my server, after a couple of hours to find the problem with Nginx( I was thinking the problem was with Nginx as I added simple auth to one of the sites on the server), later I figured out my settings at /etc/hosts (and /etc/cloud/templates/hosts.debian.tmpl) are deleted.
Is there a way to not to delete/broke/reset /etc/hosts (and /etc/cloud/templates/hosts.debian.tmpl) file content on OS updates on Ubuntu?