There are many requests for pre-configuration functionality (during deployment), including complex configs, not only basic IP addresses and credentials, available via Cloud-init now.
One of the most universal and flexible way for this could be using User-Data for Cloud-init, as it allows to add almost any kind of data into the system during deployment, even self-handled scripts, and has support for almost all platforms out of the box, so we do not need to worry about fetching data, only for processing.
Description
Description
Details
Details
- Version
- -
- Is it a breaking change?
- Perfectly compatible
- Issue type
- Feature (new functionality)
Related Objects
Related Objects
Event Timeline
Comment Actions
After the testing with a standalone User-Data handler, this feature was ported to the main cloud-init package in https://github.com/vyos/vyos-cloud-init/pull/27.
Currently, supported only set and delete commands processing. They must be provided as a list in the vyos_config_commands option.
Commands requirements:
- one command per line
- if command ending by value, it must be inside single quotes: set some option 'value', delete some option 'value'
- a single-quote symbol is not allowed inside command or value
The commands list produced by the show configuration commands command on a VyOS router should comply with all the requirements, so it is easy to get a proper commands list by copying it from another router.
Usage example (User-Data content):
#cloud-config vyos_config_commands: - set system host-name 'demo123' - set system ntp server 1.pool.ntp.org - set system ntp server 2.pool.ntp.org - delete interfaces ethernet eth2 address - set interfaces ethernet eth2 address '192.0.2.1/24'