--- Begin Message ---
Package: cloud.debian.org
I setup an EC2 in AWS using the Debian 9 AMI.
I pass along this user-data:
cat /var/lib/cloud/instance/user-data.txt
#cloud-config
fqdn: foo.bar.cloud
timezone: Europe/Stockholm
manage_etc_hosts: false
ssh_authorized_keys:
- ssh-rsa AAAA...
Sure enough, /etc/hosts is not managed. But...
1)
The created /etc/hosts file give confusing and conflicting information.
It says:
# 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.tmpl
# b.) change or remove the value of 'manage_etc_hosts' in
# /etc/cloud/cloud.cfg or cloud-config from user-data
This is wrong. I have configured it as 'false'.
I guess this erroneous information come from some default /etc/hosts
template in your AMI.
Action 1:
Please make the header state "Your system has configured
'manage_etc_hosts' as False.
Therefore this file is not managed by cloud-init." or something similar.
2)
The created /etc/hosts file contain wrong IP information.
It says:
127.0.1.1 ip-10-0-3-4.ec2.internal ip-10-0-3-4
This is wrong. My EC2 don't have this IP. In case I do use the subnet
10.0.3.0/24, this line would confuse me since I'm not the one who
added it.
Again, I guess this is left-overs from some default /etc/hosts
template in your AMI (you probably used IP 10.0.3.4 when creating the
AMI).
Action 2:
Please remove this line. Or actually, see 3) below.
3)
Even if I set 'manage_etc_hosts: false' I would still like the
installed Debian EC2 machine to get an /etc/hosts similar to
a manually installed Debian machine, using netinst or CD1.
That is, I don't want /etc/hosts to be *managed* over time (after
reboots), but I *do* want the initial /etc/hosts to get the line
127.0.0.1 <fqdn> <hostname>
127.0.0.1 localhost
...just like the normal debian-installer would do.
Action 3:
If 'manage_etc_hosts' is set to "false", do a one-time write to
/etc/hosts, setting the fqdn and hostname to 127.0.0.1.
Only do this the first time the EC2 is booted. After that, the file is
managed manually.
--- End Message ---
--- Begin Message ---
On 1/24/20 11:51 AM, Martin Olsson wrote:
> Action 1:
> Please make the header state "Your system has configured
> 'manage_etc_hosts' as False.
> Therefore this file is not managed by cloud-init." or something similar.
>
> Action 2:
> Please remove this line. Or actually, see 3) below.
>
> Action 3:
> If 'manage_etc_hosts' is set to "false", do a one-time write to
> /etc/hosts, setting the fqdn and hostname to 127.0.0.1.
> Only do this the first time the EC2 is booted. After that, the file is
> managed manually.
Hi,
So, basically, you're complaining that when you set manage_etc_hosts:
false, you're getting a /etc/hosts that doesn't match your expectation.
Well, that is exactly what the feature is about... I guess then, you're
suppose to edit /etc/hosts by hand, and fix it the way it pleases you.
Then you're talking about is features to add to cloud-init upstream.
Feel free to get in touch with them, or contribute the code. As it
stands, I don't think anyone from the Debian cloud team feels like
patching cloud-init to do what you're suggesting.
Usually, the normal way to use the cloud is to *not* set
manage_etc_hosts and let cloud-init do it, then maybe after the first
boot, change the value.
I'm closing this bug, because I really don't see how we should address
it in a reasonable way.
Cheers,
Thomas Goirand
--- End Message ---