← Back to team overview

cloud-init team mailing list archive

Re: Few questions about cloud-init...


On Fri, Aug 17, 2018 at 4:08 PM Mike Gerdts <mike.gerdts@xxxxxxxxxx> wrote:

> On Mon, Jul 30, 2018 at 7:03 AM, Shyam Prasad N <nspmangalore@xxxxxxxxx>
> wrote:
>> Hi all,
>> I've been going through the documentation for cloud-init for the past few
>> days, and experimenting with VMs.
>> I still do not understand a few things. I'd appreciate if someone could
>> clarify this for me.
>> 1. How does cloud-init select a datasource? Does it go through all the
>> available datasources till it gets a valid meta-data and user-data?
> I believe so.  However, this can be tweaked, as seems to be on
> debian-derived distros.
> $ cat /etc/cloud/cloud.cfg.d/90_dpkg.cfg
> # to update this file, run dpkg-reconfigure cloud-init
> datasource_list: [ SmartOS ]

This is in fact what cloud-init reads.  If that is not declared in any
cloud.cfg file it will use the builtin full list.  That is intended to
always be safe.

> 2. Is there a way to verify a cloud-config yaml file, before I go for the
>> actual run with the file?
> I'll leave that to someone else.
A few options
a.) first verify '#cloud-config' files are valid yaml.  I have a program
'yaml-dump' that I run to verify yaml:
http://paste.ubuntu.com/p/sMgNsgMZn4/ . If it is not valid yaml, then
cloud-init is not going to load it.
b.) there is a 'cloud-init devel schema' command that can help you.  Some
of the cloudinit 'config modules' have a schema builtin now and they will
check the config.  We're working to improve that over time.
c.) launch quickly-ish in a container rather than on another platform.  lxd
makes this quite easy.  Install lxd on just about any platform.
https://linuxcontainers.org/lxd/getting-started-cli/ .  Then you can do:
   $ lxc launch ubuntu-daily:xenial mytest "--config=user.meta-data=$(cat