Page MenuHomeVyOS Platform

Cloud Init Ordering Incorrect
Open, NormalPublicBUG

Description

I've been trying unsuccessfully to get cloud-init working on DigitalOcean for a little while now and finally had some time to re-tackle the problem. I think I've found an issue with the way that the cloud-init config files are ordered.

Basically, I'm building a custom VyOS image with the vyos-vm-image repo and using the following option for datasources:
cloud_init_ds=NoCloud,ConfigDrive,None

What was happening was that the cloud-init user-data was getting written to disk, but not applied using the vyos_config_commands module.

After many hours of digging, I realized that is because if you look here on the vyos cloud-init repo that the VyOS config file is named 10_vyos.cfg but that the readme for that folder explicitly states

# All files with the '.cfg' extension in this directory will be read by
# cloud-init. They are read in lexical order. Later files overwrite values in
# earlier files.

And when the image is generated with those options, the DigitalOcean provider config file starts with a higher number meaning it will be processed after the VyOS one.

Because of this, anything set by the DigitalOcean provider takes over the settings of the VyOS one meaning the VyOS specific modules never actually run after the user-data and other info is grabbed by the DigitalOcean provider.

I've fixed this in my custom image by adding this task to the end of the install-cloud-init role in the vyos-vm-images repo:

- name: Fix number of vyos file
  become: true
  command: cp {{ vyos_install_root }}/etc/cloud/cloud.cfg.d/10_vyos.cfg {{ vyos_install_root }}/etc/cloud/cloud.cfg.d/99_vyos.cfg

It's a hacky solution, but does work and the commands are executed as expected at boot.

Details

Difficulty level
Unknown (require assessment)
Version
1.4-epa (custom build)
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Unspecified (possibly destroys the router)
Issue type
Bug (incorrect behavior)

Related Objects

StatusSubtypeAssignedTask
OpenBUGzsdc
OpenBUGNone