cloud-init team mailing list archive
-
cloud-init team
-
Mailing list archive
-
Message #00149
Re: Customize cloudinit to process a single yaml file
Thanks for the tips.
On 3/30/18, 1:11 PM, "Ryan Harper" <ryan.harper@xxxxxxxxxxxxx> wrote:
On Fri, Mar 30, 2018 at 1:13 PM, Ravi Parimi (parimi) <parimi@xxxxxxxxx> wrote:
>
> I would like to leverage cloud-init to configure networking etc. on my Centos VM running on VMware. My understanding is that cloud-init configuration
> for VM's running VMware should be packaged into an ISO or floppy that is attached to the VM (from slide 26 in https://people.redhat.com/mskinner/rhug/q3.2014/cloud-init.pdf)
>
> My environment doesn't allow access to either the cdrom or floppy device and hence I'd like to explore alternate ways of applying cloudinit config to my VM. Instead of enabling the cloud-init systemd service to run on boot, I want to simply call cloud-init manually to apply a pre-cooked config file that resides on the filesystem.
My understanding is that VMware instances use the DatasourceOVF which
does support reading ovf configuration from a file inside the image:
/var/lib/cloud/seed/ovf/ovf-env.xml
Alternatively, you can also use the NoCloud datasource[1] which uses
/var/lib/cloud/seed/nocloud-net/
>
> My specific question is this:
>
> If I save a cloud-config .yaml file on the filesystem, is there a way to ask cloud-init to process and apply it? From a cursory look of the command-line options and documentation, I don't see how this can be achieved.
There are a couple ways, it depends on what sort of config you want to apply.
For config modules, one way is:
cloud-init --file /path/to/cloud-config.yaml single --name
cc_<modulename> --frequency always
How do I get a list of the module names?
[root@localhost ~]# cat misc.yaml
#cloud-config
# Test nocloud
run_cmd:
- [ls, -l, /]
[root@localhost ~]# cloud-init --file ./misc.yaml single
usage: cloud-init single [-h] --name NAME [--frequency {instance,once,always}]
[--report]
[argument [argument ...]]
cloud-init single: error: argument --name/-n is required
thanks
Follow ups
References