How to pass cloud init yaml via API as config?


(Silentphantom62) #1

I am looking for the API equivalent of doing the below.

lxc launch ubuntu1804 test --config=user.network-config="$(cat network-config.yaml)"

I am using pylxd client and while creating a container I can pass a config dictionary.
How do I pass a yaml as a value to the user.network-config in config object?

Yaml looks like:

version: 1
config:
  - type: physical
    name: eth0
    subnets:
      - type: static
        address: <ip-address>
        gateway: <ip-address>
        dns_nameservers:
          - <ip-address>
          - <ip-address>