Report this

What is the reason for this report?

CentOS 7 /etc/hosts vs /etc/cloud/templates/hosts.*.tmpl?

Posted on August 26, 2015

If I create a CentOS 7 droplet using the default DO-supplied image, I note when going to /etc/hosts to add private IP aliases for my other droplets that there’s this:

# Your system has configured 'manage_etc_hosts' as True.
# As a result, if you wish for changes to this file to persist
# then you will need to either
# a.) make changes to the master file in /etc/cloud/templates/hosts.redhat.tmpl
# b.) change or remove the value of 'manage_etc_hosts' in
#     /etc/cloud/cloud.cfg or cloud-config from user-data

If I look at /etc/cloud/templates/ I see three hosts.OSflaver.tmpl files: debian, redhat, and suse. I tried adding my aliases to all three not knowing/caring which is being sourced and rebooted the droplet. Nothing.

I add the entries directly to /etc/hosts and reboot, they stick despite the warning.

Inspecting /etc/cloud/cloud.cfg reveals some DigitalOcean configuration? Not sure if I need to or should attempt to disable manage_etc_hosts as suggested in the hosts comments, figure out how to use the templates, or what?

Anyone have any advice? For now I’m just using /etc/hosts and ignoring the warning comments. So far it seems okay but it’s likely not.



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Looks like this is a duplicate of this question

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.