How to run cloud-config script manually?

Asked by Andy on 2016-08-29


Does cloud-init have a mode to run cloud-config data manually?

To better describe the scenario, I'm working with cloud servers that have been pre-configured (OS/network/SSH/etc). The OS used is a mix of Ubuntu/CentOS. The cloud-init packages have not be pre-installed. I'd like to upload a stable cloud-init snapshot to the servers and do some basic provisioning with cloud-config ( using the examples: ). For example:

1. Upload cloud-init 0.7.7 to /opt/cloud-init/
2. Upload my cloud-config script to /root/provision.txt
3. Run /opt/cloud-init/some-command some-arg /root/provision.txt

I'd like to avoid the deep OS integration with cloud-init, if possible.

Thanks for reading.

Question information

English Edit question
Ubuntu cloud-init Edit question
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Scott Moser (smoser) said :

Generally speaking, cloud-init has 4 stages:
 a.) cloud-init local
      command: cloud-init init --local
      search for local datasources (config drive or NoCloud).
      this writes networking configuration either that it found from the datasource or "fallback" networking config.
  b.) cloud-init network
       command: cloud-init init
       search for data sources that require network
  c.) cloud-init config
        command: cloud-init modules --mode=config
   d.) cloud-init final
         command: cloud-init modules --mode=final

you can run those one after another, and probably come out with much of what you want, but networking is not likely to be brought up. cloud-init does not attempt to manually bring up networking, rather it writes configuration to the system and lets normal boot process bring the network up.

Can you help with this problem?

Provide an answer of your own, or ask Andy for more information if necessary.

To post a message you must log in.