Ubuntu 18.04 Cloud-init Support

When I create a droplet on DigitalOcean from a snapshot that utilizes Ubuntu 18.04 none of my cloud-config settings seem to come across.

The snapshot was created using Packer and Ansible which complicates the install somewhat. I have narrowed down the problem with the snapshot to the following Ansible role:

  • name: Download Virtualmin Install Script
    tags: webmin
    get_url: >
    url=http://software.virtualmin.com/gpl/scripts/install.sh
    dest=/root/install.sh
    mode=0755
  • name: Virtualmin Install
    shell: ~/install.sh --yes chdir=/root

    There are several modifications I have made to the default Virtualmin templates and configuration files. I think the issue of the cloud-config userdata not coming across might be related to a misconfiguration in one of these files.

The droplet get’s created and from what I can tell functions normally, however any userdata I provide during creation through my cloud-config script does not come across to the final built server. It does not matter what I put in the cloud-config script but for testing it looks like this:

#cloud-config
write_files:

  • content: |
    This is a test file
    path: /root/test
    runcmd:
  • touch /root/foo
  • echo “THIS IS THE TEST DATA”

The virtualmin-install.log did not have any errors and it reported a successful install.

The only few items of note were:

[2019/01/20 00:17:46] [INFO] - Code: 256 Result: modprobe: FATAL: Module quota_v2 not found in directory /lib/modules/4.15.0-42-generic
[2019/01/20 00:17:46] [INFO] - Code: 0 Result: quotacheck: Your kernel probably supports journaled quota but you are not using it. Consider switching to journaled quota to avoid running quotacheck after an unclean shutdown.

and…

WARNING: /etc/aliases exists, but does not have a root alias.

and…

Warning: The home dir /run/proftpd you specified can’t be accessed: No such file or directory

and…

Warning: The home dir /var/lib/postgrey you specified can’t be accessed: No such file or directory

None of which seem to be an issue.

By typing in the following command from within my droplet:
curl http://169.254.169.254/metadata/v1/user-data
I can see the user-data that I pasted into the cloud-config text box when creating the droplet on DigitalOcean.

This tells me that my droplet is able to communicate with DigitalOcean’s metadata service. However, if I examine the the log file cloud-init-output.log there is no sign of my user-data.

The only thing of note is this single warning:

1-20 00:51:46,013 - util.py[WARNING]: Running module ssh-authkey-fingerprints (<module ‘cloudinit.config.cc_ssh_authkey_fingerprints’ from ‘/usr/lib/python3/dist-packages/cloudinit/config/cc_ssh_authkey_fingerprints.py’>) failed

So if I modify my Virtualmin role to run the installer with the –minimal flag like so:

  • name: download virtualmin install script
    tags: webmin
    get_url: >
    url=http://software.virtualmin.com/gpl/scripts/install.sh
    dest=/root/install.sh
    mode=0755
  • name: virtualmin install
    shell: ~/install.sh --minimal --yes chdir=/root

Then all of the userdata comes across and the cloud-config script works as expected.

Does anybody have some ideas as to what could be effecting Cloud-Init between the standard install and the minimal install?

I guess Virtualmin is not quite ready for Ubuntu 18.04

I’ll check back in once it is listed under the officially supported OS.