title: Pass IP-address to cloud-init metadata
body: <p>I am searching for a way to pass a ip-address to cloud-init metadata. So when my qcow boots, it does not have to wait for 120 - 180 seconds to boot. </p>
  
  <p>Currently I've created a workaround by adding IP-address information to the userdata part of cloud-init. The con is, it does take some time because cloud-init userdata is only executed after booting the VM.</p>
  
  <pre><code>echo -e "
  # This file describes the network interfaces available on your system
  # and how to activate them. For more information, see interfaces(5).
  source /etc/network/interfaces.d/*
  # The loopback network interface
  auto lo
  iface lo inet loopback
  # The primary network interface
  auto eth0
  iface eth0 inet static
  \taddress $address
  \tnetmask $netmask
  \tgateway $gateway
  \tdns-nameservers $dnsnameservers
  " &gt; /etc/network/interfaces
  
  ifdown eth0; ifup eth0
  </code></pre>
  
  <p>Currently to set the hostname in cloud-init metadata, I've already obtained this part:</p>
  
  <pre><code>cat &gt; $config_dir/meta-data &lt;&lt;-EOF
  instance-id: $uuid
  hostname: $hostname
  local-hostname: $hostname
  EOF
  </code></pre>
  
  <p>But I need something more solid, more concrete because the cloud-init documentation is very vague </p>
  
  <p><strong>EDIT:</strong> I've seen that it is possible because Openstack can do it.</p>