Documentation of the Configuration Tree?

I want to set up a new Incus server and configure it with a YAML file. But I have a hard time figuring out how to construct that YAML file. Trawling the docs and the forum, I got something like

---

config: {}
description: Default Incus profile
devices:
  br0:
    name: br0
    network: enp1s0
    type: bridge
  root:
    path: /path/to/empty/dir
    pool: default
    type: disk

But when trying to load this, it fails:

$ incus admin init --preseed incus-preseed.yaml
Error: Failed to parse the preseed: yaml: unmarshal errors:
  line 4: field description not found in type api.InitPreseed
  line 5: field devices not found in type api.InitPreseed

Somehow, I haven’t found documentation about how to put all the things together, so I could write a YAML file that contains all networks, storage, backups, monitoring, certificates, DNS, routing etc. (so far, I’m only trying to set network and storage, but completeness would be great) in one, possibly omitting keys that I don’t want to change, and possibly having an option to delete keys, too. I also haven’t found out how to create a skeleton YAML file as an export from an existing server, even though I found messages indicating that this is possible. Is it possible, and where should I look, please?

The format of yaml is right, but not the contain. You need to read doc again.

It should be this, so instances will auto config network:

  eth0:
    nictype: bridged
    parent: br0
    type: nic

And root is always /, and root is always in a pool. So:

  root:
    path: /
    pool: default
    type: disk

That’s all for default profile. If you need to know more about network and storage, you can ask for more specific questions.

OK, I understand why you wrote path: /path/to/empty/dir, you want to use a path in your filesystem, you need to create a dir pool, so:

incus storage create poolname dir source=/path/to/empty/dir

Thank you, but my problem is that incus already freaks out at the ‘devices:’ entry, which I got from the documentation. It’s not even reaching the individual devices. I also thought that I somehow need to tell incus about the network first, before I can attach any devices to it?

You’re passing a profile config as a server pressed, that’s not going to work very well.

How to initialize Incus - Incus documentation has a more concrete example of a preseed.

1 Like

I guess you want something like this:

# Daemon settings
config: 
  core.https_address: [::]:8443

# Storage pools
storage_pools:
- name: poolname
  driver: dir
  config:
    source: /path/to/empty/dir

# Network devices
networks: 
- name: incusbr0
  type: bridge
  config:
    ipv4.address: auto
    ipv6.address: none

# Profiles
profiles:
- name: default
  devices:
    root:
      path: /
      pool: poolname
      type: disk
    eth0:
      nictype: bridged
      parent: br0
      type: nic

I’ve never written this before. I just use incus admin init. Every thing in this config can be edited later.

Thank you! I’m still trying to figure things out, but I also want to automate things, and issuing a sequence of commands later does sound like trouble to me. It’s error prone, hard to reason about, and inefficient as well. Creating a configuration file from a template and then feeding that to incus sounds like a much saner option to me.

I will try to put it politely as possible as I can, English is not my first language.

It seems to me, you are not very familiar with incus’s configuration. It’s better to take step by step. I recommend you install incus in a VM and use incus admin init to create a demo server to mess up with anything. After done, I think you will be good at automatically create a incus server.

Best regard.

1 Like

Don’t worry. English is not my first language, either, and yes, I am not very familiar with incus, yet. I’ve been playing with it on my laptop for a while now, but am still exploring the capabilities and trying to understand how everything fits together.