1
In order to allow an ephemeral, or otherwise pristine image to
2
receive some configuration, cloud-init will read a url directed by
3
the kernel command line and proceed as if its data had previously existed.
5
This allows for configuring a meta-data service, or some other data.
7
Note, that usage of the kernel command line is somewhat of a last resort,
8
as it requires knowing in advance the correct command line or modifying
9
the boot loader to append data.
11
For example, when 'cloud-init start' runs, it will check to
12
see if if one of 'cloud-config-url' or 'url' appear in key/value fashion
13
in the kernel command line as in:
14
root=/dev/sda ro url=http://foo.bar.zee/abcde
16
Cloud-init will then read the contents of the given url.
17
If the content starts with '#cloud-config', it will store
18
that data to the local filesystem in a static filename
19
'/etc/cloud/cloud.cfg.d/91_kernel_cmdline_url.cfg', and consider it as
20
part of the config from that point forward.
22
If that file exists already, it will not be overwritten, and the url parameters
25
Then, when the DataSource runs, it will find that config already available.
27
So, in able to configure the MAAS DataSource by controlling the kernel
28
command line from outside the image, you can append:
29
url=http://your.url.here/abcdefg
31
cloud-config-url=http://your.url.here/abcdefg
33
Then, have the following content at that url:
37
metadata_url: http://mass-host.localdomain/source
38
consumer_key: Xh234sdkljf
40
token_secret: 24uysdfx1w4
43
* Because 'url=' is so very generic, in order to avoid false positives,
44
cloud-init requires the content to start with '#cloud-config' in order
45
for it to be considered.
46
* The url= is un-authed http GET, and contains credentials
47
It could be set up to be randomly generated and also check source
48
address in order to be more secure