Enhancing cloud-init documentation for command execution

I would like to continue contributing to cloud-init documentation by including the steps needed to run
linux and VyOs operational commands. I am unclear how to run commands from cloud-init. Can this be achieved with standard cloud-init runcmd or is a VyOS-specific mechanism used?

Hi, @jeffbrl!
If you mean native Linux commands (normal one shell scripts - bash, etc.), then at this moment this is not recommended and not supported, and we advise avoiding such actions.
The idea of the whole VyOS is that you do not need normally access to a regular shell and use CLI commands for everything. Also, because of the order of startup and configuring, VyOS will be fully configured only after all Cloud-init actions will be done. Because of this, the runcmd module is disabled by default.
Despite this, we clearly understand the fact that not everything is possible to do with available tools. Therefore, running custom scripts is still possible, but there is nothing Cloud-init specific in this.
So, to run any custom command, you just need to put what you want into predefined scripts locations (Command Scripting — VyOS 1.3.x (equuleus) documentation) using the write_files module. This gives the full compatibility with all types of deployments, instead of adding something Cloud-init specific.
This may be not so obvious, so we would be happy if you will extend the documentation.

P.S. For such kind of questions, could be faster to get answers in our Slack.

zsdc,

Thank you for the info. I will experiment with writing files with write_files to /config/scripts/vyos-preconfig-bootup.script.

I will use slack in the future for questions like this one.

Just in case. Since the /config/ can be not mounted at the moment when write_files is executed, better to use the /opt/vyatta/etc/config/scripts/ directory instead.