Repository navigation
Adding per node incus config options - #103
Conversation
|
Happy to discuss if there are other ideas for per node configuration :) |
| - `standalone` | ||
| - `cluster` | ||
| - `ui`: Whether to serve the Incus UI | ||
| - `incus_init_config_per_node`: Per node configuration data (type: dict) |
There was a problem hiding this comment.
Wouldn't it make more sense to have it be under the incus_init?
Say local_config under incus_init with config being for the global config.
There was a problem hiding this comment.
I was also thinking about that, but having both incus_init in the group vars as well as incus_init in the host wars would make the host vars win and therefore overwrite the group vars. There is an option to set ansible to merge those dicts, but this would apply to everything, which is most likely not desired.
There was a problem hiding this comment.
But I agree, I also do not like my solution either. Either way, it feels kind of wrong.
There was a problem hiding this comment.
We could maybe use something like this:
- name: Merge host-specific config into incus_init
ansible.builtin.set_fact:
incus_init: "{{ incus_init | combine( {'local_config': local_config | default({}) } ) }}"in the tasks to combine variables, but it would still require the individual host vars to have local_config, while the group vars keep incus_init['config']
There was a problem hiding this comment.
In most cases your local_config would still be templated so would be fine in a group section. If it needs specific host variables, you can have it defined in the group with a template that picks up the local host var.
There was a problem hiding this comment.
Got it, pushed a new version. Still need a good example though for the normal cluster config section, or should I just leave out the example changes entirely?
There was a problem hiding this comment.
I think the example you've put in place looks good.
1b7f6cd to
19fe8ee
Compare
|
|
||
| incus_init: | ||
| config: | ||
| acme.domain: "incus.example.com" |
There was a problem hiding this comment.
Ah right, that would be bad as an example, maybe set user.ui.title instead?
There was a problem hiding this comment.
user.ui.title: "My cluster" would be a safe global example to use.
The normal "incus config set" was only executed on one node when in cluster mode. This works for nearly all settings, except some like: - core.bgp_address - core.bgp_routerid - core.https_address and so on. These need to be set for each node individually. The logic allows you to use a new variable per host called "incus_init_config_per_node" to specify those. Unfortunately, the executing needs to be done after the initial handler for the cluster wide config options is executed, therefore the hacky use of 'ansible.builtin.command: /bin/true'. Handler registers are stored in an ordered list. Signed-off-by: Tim Beermann <tibeer@berryit.de>
19fe8ee to
fcbe175
Compare
The normal "incus config set" was only executed on one node when in cluster mode.
This works for nearly all settings, except some like:
and so on. These need to be set for each node individually.
The logic allows you to use a new variable per host called "incus_init_config_per_node" to specify those.
Unfortunately, the executing needs to be done after the initial handler for the cluster wide config options
is executed, therefore the hacky use of 'ansible.builtin.command: /bin/true'. Handler registers are stored in
an ordered list.
Signed-off-by: Tim Beermann tibeer@berryit.de