5
This datasource finds metadata and user-data from the Azure cloud platform.
9
The azure cloud-platform provides initial data to an instance via an attached
10
CD formated in UDF. That CD contains a 'ovf-env.xml' file that provides some
11
information. Additional information is obtained via interaction with the
12
"endpoint". The ip address of the endpoint is advertised to the instance
13
inside of dhcp option 245. On ubuntu, that can be seen in
14
/var/lib/dhcp/dhclient.eth0.leases as a colon delimited hex value (example:
15
``option unknown-245 64:41:60:82;`` is 100.65.96.130)
19
In order to operate correctly, cloud-init needs walinuxagent to provide much
20
of the interaction with azure. In addition to "provisioning" code, walinux
21
does the following on the agent is a long running daemon that handles the
23
- generate a x509 certificate and send that to the endpoint
27
in order to use waagent.conf with cloud-init, the following settings are recommended. Other values can be changed or set to the defaults.
31
# disabling provisioning turns off all 'Provisioning.*' function
32
Provisioning.Enabled=n
33
# this is currently not handled by cloud-init, so let walinuxagent do it.
35
ResourceDisk.MountPoint=/mnt
40
Userdata is provided to cloud-init inside the ovf-env.xml file. Cloud-init
41
expects that user-data will be provided as base64 encoded value inside the
42
text child of a element named ``UserData`` or ``CustomData`` which is a direct
43
child of the ``LinuxProvisioningConfigurationSet`` (a sibling to ``UserName``)
44
If both ``UserData`` and ``CustomData`` are provided behavior is undefined on
45
which will be selected.
47
In the example below, user-data provided is 'this is my userdata', and the
48
datasource config provided is ``{"agent_command": ["start", "walinuxagent"]}``.
49
That agent command will take affect as if it were specified in system config.
55
<wa:ProvisioningSection>
56
<wa:Version>1.0</wa:Version>
57
<LinuxProvisioningConfigurationSet
58
xmlns="http://schemas.microsoft.com/windowsazure"
59
xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
60
<ConfigurationSetType>LinuxProvisioningConfiguration</ConfigurationSetType>
61
<HostName>myHost</HostName>
62
<UserName>myuser</UserName>
64
<CustomData>dGhpcyBpcyBteSB1c2VyZGF0YQ===</CustomData>
65
<dscfg>eyJhZ2VudF9jb21tYW5kIjogWyJzdGFydCIsICJ3YWxpbnV4YWdlbnQiXX0=</dscfg>
66
<DisableSshPasswordAuthentication>true</DisableSshPasswordAuthentication>
70
<Fingerprint>6BE7A7C3C8A8F4B123CCA5D0C2F1BE4CA7B63ED7</Fingerprint>
71
<Path>this-value-unused</Path>
75
</LinuxProvisioningConfigurationSet>
76
</wa:ProvisioningSection>
80
Configuration for the datasource can be read from the system config's or set
81
via the `dscfg` entry in the `LinuxProvisioningConfigurationSet`. Content in
82
dscfg node is expected to be base64 encoded yaml content, and it will be
83
merged into the 'datasource: Azure' entry.
85
The '``hostname_bounce: command``' entry can be either the literal string
86
'builtin' or a command to execute. The command will be invoked after the
87
hostname is set, and will have the 'interface' in its environment. If
88
``set_hostname`` is not true, then ``hostname_bounce`` will be ignored.
91
command: ["sh", "-c", "killall dhclient; dhclient $interface"]
98
agent_command: [service, walinuxagent, start]
101
# the name of the interface to bounce
103
# policy can be 'on', 'off' or 'force'
105
# the method 'bounce' command.
107
hostname_command: "hostname"
112
When the user launches an instance, they provide a hostname for that instance.
113
The hostname is provided to the instance in the ovf-env.xml file as
116
Whatever value the instance provides in its dhcp request will resolve in the
117
domain returned in the 'search' request.
119
The interesting issue is that a generic image will already have a hostname
120
configured. The ubuntu cloud images have 'ubuntu' as the hostname of the
121
system, and the initial dhcp request on eth0 is not guaranteed to occur after
122
the datasource code has been run. So, on first boot, that initial value will
123
be sent in the dhcp request and *that* value will resolve.
125
In order to make the ``HostName`` provided in the ovf-env.xml resolve, a
126
dhcp request must be made with the new value. Walinuxagent (in its current
127
version) handles this by polling the state of hostname and bouncing ('``ifdown
128
eth0; ifup eth0``' the network interface if it sees that a change has been
131
cloud-init handles this by setting the hostname in the DataSource's 'get_data'
132
method via '``hostname $HostName``', and then bouncing the interface. This
133
behavior can be configured or disabled in the datasource config. See
134
'Configuration' above.