On Mon, Apr 2, 2018 at 4:19 PM, Ravi Parimi (parimi) <[email protected]> wrote:
> Thanks for the tips.
>
>
> On 3/30/18, 1:11 PM, "Ryan Harper" <[email protected]> wrote:
>
>     On Fri, Mar 30, 2018 at 1:13 PM, Ravi Parimi (parimi) <[email protected]> 
> 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?

Two places:

http://cloudinit.readthedocs.io/en/latest/topics/modules.html

or


ls -al /usr/lib/python3/dist-packages/cloudinit/config/cc*.py

>
> [root@localhost ~]# cat misc.yaml
> #cloud-config
>
> # Test nocloud
>
> run_cmd:
>  - [ls, -l, /]

runcmd:
  - [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

cloud-init --file ./misc.yaml single --name cc_runcmd --frequency=always

>
>
> thanks
>

-- 
Mailing list: https://launchpad.net/~cloud-init
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~cloud-init
More help   : https://help.launchpad.net/ListHelp

Reply via email to