Write config first, apply in controlled batches¶
Impact Writes config Restarts on drift
How to write the configuration first and apply it batch by batch, with Nova as the example. genconfig, a review of the
diff, then deploy-containers --limit <batch> is the only built-in way to separate "write the config" from "apply it"
(Execution flow §4). The page
also covers a rolling run with -e kolla_serial, which in 2025.1 works only with deploy and the other commands that
do not set kolla_serial, and how to make it stop on failures with max_fail_percentage.
The page uses the definition of drift of the Operations hub.
Note
Key answers
- Compute changes in controlled batches:
genconfig -t nova-cell, thendeploy-containers --limitbatch by batch (§1.1). - Changed in 2025.1: a rolling
reconfigureis no longer possible.ANSIBLE_SERIALis gone, andreconfigureandupgradealways passkolla_serial=0after your-e. Usedeploy -e kolla_serial=N, which runs the same tasks (§1.2). - Stop a rolling run on failures: lower
kolla_max_fail_percentage(or<service>_max_fail_percentage); the default 100 never stops a play early (§1.3). - What else changed since 2024.1:
deploy-containersrestarts only the containers that changed (no more loop-notify); a change ofcommandinconfig.jsonis now detected;genconfigrestarts nothing for Nova and no longer pulls the fluentd image. The pattern itself still holds.
1. Commands¶
1.1 Compute changes in controlled batches (recommended pattern)¶
# 1. write the config everywhere, restart nothing
kolla-ansible genconfig -i multinode -t nova-cell
# 2. review: diff /etc/kolla/nova-compute/nova.conf on a sample of hosts
# 3. apply batch by batch (only check-containers + handlers run)
kolla-ansible deploy-containers -i multinode -t nova-cell --limit 'compute[0:9]'
kolla-ansible deploy-containers -i multinode -t nova-cell --limit 'compute[10:19]'
The action now comes first (kolla-ansible <action> <options>); see Conventions.
genconfigruns the playbooks withkolla_action=config(kolla_ansible/cli/commands.py:113-125), anddeploy-containerswithkolla_action=deploy-containers(kolla_ansible/cli/commands.py:245-256). Neither setskolla_serial.-
deploy-containersruns onlycheck-containers.ymland the handlers it notifies CODE (roles/nova-cell/tasks/deploy-containers.yml:2). Changed in 2025.1: these restart only the containers with drift. The nova-cellcheck-containers.ymlimports the sharedservice-check-containersrole (roles/nova-cell/tasks/check-containers.yml:2-3), which compares every container in one loop and then notifies a list built from the changed results only (roles/service-check-containers/tasks/main.yml:4-29, :34-41) CODE (Tags §2.4). In 2024.1, one changed container restarted every nova-cell container of the host.Drift is found by
compare_container: the container is missing, its parameters differ,kolla_set_configs --checkreports a change, or the systemd unit text differs (module_utils/kolla_container_worker.py:58-65). Throughkolla_set_configs --checkit sees drift in the files listed inconfig.json'sconfig_files(existence, content, perm, owner) CODE (kolladocker/base/set_configs.py:178-211, :233-255) and, new in 2025.1, two more cases (kolladocker/base/set_configs.py:580-586, :589-636, :655-657):- the
commandofconfig.jsondiffers from the one the container started with (ConfigFileCommandDiffers). So a memcached setting change, which lives in thatcommand(roles/memcached/templates/memcached.json.j2:1-4), is now applied bydeploy-containers; - a file that an earlier
config.jsonlisted is no longer listed (StateMismatch).
A change confined to the
permissionslist ofconfig.jsonis still not seen: the check path does not runhandle_permissions(set_configs.py:347, :655-657); it takes effect at the next restart for another reason (Kolla images §3).A newly rendered
optionalfile whose destination is not yet in the container (e.g. nova-compute'srelease) counts as drift:--checkexits 1 and the restart copies the new file (kolladocker/base/set_configs.py:180-182, :237-252,roles/nova-cell/templates/nova-compute.json.j2:59-64). Exit 1 means "changed" for both container engines (Dockermodule_utils/kolla_docker_worker.py:164-172, Podmanmodule_utils/kolla_podman_worker.py:540-547). - the
-
Each batch restarts only its hosts. No bootstrap containers and no Keystone registration run: the two bootstrap plays of
nova.ymlact only fordeployandreconfigure(nova.yml:53-55,nova.yml:89-91), and the role runsdeploy-containers.ymlinstead ofdeploy.yml(roles/nova-cell/tasks/main.yml:2). The new libvirt version check is part ofdeploy.yml, so it does not run either (roles/nova-cell/tasks/deploy.yml:5). The service includes of theloadbalancerplay and its final check are skipped too (site.yml:325-327). - Caveat:
genconfig -t nova-cellalso renders the conductor and console config on controllers, because the nova-cell play targetsnova-conductor,nova-novncproxy,nova-serialproxyandnova-spicehtml5proxyas well ascompute(nova.yml:125-134). Include them in a batch too, or the drift stays pending there. - New in 2025.1, first run after the code update: whatever you changed, the first check after the upgrade from
2024.1 can report drift on every container, because the systemd unit now carries
PartOf=kolla.targetand, with Docker on hosts outside the Red Hat family, the defaultulimitschanged (Repository architecture §6). Run that first apply as its own controlled batch sequence, or after the upgrade itself, not together with a config change. - The
compute[0:9]slice syntax is standard Ansible host-pattern slicing.
1.2 Rolling runs with kolla_serial (not with reconfigure)¶
# batches of 10 hosts per play; deploy runs the same tasks as reconfigure
kolla-ansible deploy -i multinode -t nova -e kolla_serial=10
- Changed in 2025.1:
ANSIBLE_SERIALis no longer read.ANSIBLE_SERIAL = 0is a constant of the CLI (kolla_ansible/cli/commands.py:20-22), andreconfigureandupgradealways addkolla_serial=0(kolla_ansible/cli/commands.py:136, :278). That value comes after your own-eoptions (kolla_ansible/ansible.py:261-266), and ansible-core keeps the last value of a repeated extra var (lib/ansible/utils/vars.py:94-105, :198-224), soreconfigure -e kolla_serial=10runs with 0 CODE (to be confirmed by the community).deploy,deploy-containers,pull,genconfig,stopandcheckset nokolla_serial, so your-e kolla_serial=10reaches their plays. deployinstead ofreconfigure. For a given tag both run the same tasks: every role'sreconfigure.ymlbut bifrost's imports or includesdeploy.yml(Repository architecture §4.2), the nova bootstrap plays act for both (nova.yml:53-55,nova.yml:89-91), and no task underansible/testskolla_action == "deploy"or== "reconfigure"on its own (a search of the tree finds the two values only together, in lists) CODE.- Plays that set
serial: '{{ kolla_serial|default("0") }}'run in batches of 10 hosts: gather-facts, common, theloadbalancerplay, all nova plays and almost every service play (gather-facts.yml:11,gather-facts.yml:40,site.yml:95,site.yml:110,nova.yml:140). - Not batched by it:
- mariadb and rabbitmq, separate playbooks (imported at
site.yml:415andsite.yml:483) whose role plays have noserial(mariadb.yml:3-16,rabbitmq.yml:3-28). Their handlers only add hosts to restart groups, and the restart plays use a fixedserial: "33%"(mariadb.yml:24,mariadb.yml:42,rabbitmq.yml:36). ansible-core rounds the percentage down with a minimum of one host (lib/ansible/utils/helpers.py:28-30): with three nodes, one node per batch. - etcd, whose play has no
serialkey (site.yml:485-496). Its handlers stage the restarts instead: look up the leader, restart the non-leaders (outsideupgrade, looping over the four values ofgroups.etcd.index(host) % 4), then the leader, whose handler is defined after them (roles/etcd/handlers/main.yml:9-15,roles/etcd/handlers/main.yml:38-52,roles/etcd/handlers/main.yml:54-61). Onupgradea separate handler loops overgroups.etcdfor the non-leaders (roles/etcd/handlers/main.yml:27-34). Each restart waits for the client port and foretcdctl endpoint health(roles/etcd/tasks/restart_services.yml:16-41). NOT AVAILABLE How ansible-core orders, across hosts, the files included by one looped handler, so whether the% 4groups really restart one after another (Execution flow §7). - cyborg, whose play reads
serialinstead ofkolla_serialand so ignores it (site.yml:874). Still holds in 2025.1. - the helper plays (group-by, prechecks), which change nothing (
site.yml:7-75,site.yml:77-86).
- mariadb and rabbitmq, separate playbooks (imported at
- A
run_oncetask runs once per batch of its own play: the linear strategy sends it to the first host of the current batch only (lib/ansible/plugins/strategy/linear.py:178,lib/ansible/plugins/strategy/linear.py:205-206). For-t nova, the API DB sync (nova_api_bootstrap,roles/nova/tasks/bootstrap_service.yml:21),map_cell0(roles/nova/tasks/map_cell0.yml:63-64) and the Keystone registration (roles/service-ks-register/tasks/main.yml:129) arerun_oncein plays that target only controller groups (nova-api, nova-scheduler, nova-super-conductor:nova.yml:29-39,nova.yml:103-115), so they repeat only if those groups are larger than the batch. The cell DB sync (nova_cell_bootstrap) is notrun_once: it is gated on the first nova-conductor and runs once at any serial value (roles/nova-cell/tasks/bootstrap_service.yml:21). Compute discovery runs on the first compute of each nova-cell batch, so it repeats once per batch that contains computes (roles/nova-cell/tasks/deploy.yml:21-39,roles/nova-cell/tasks/wait_discover_computes.yml:87-90). The new libvirt version check isrun_oncetoo, so it runs once per nova-cell batch (roles/nova-cell/tasks/version-check.yml:20-21). Withkolla_serial=1and the threemultinodecontrollers (inventory/multinode:3-6;nova-apiandnova-conductorare children ofnova,inventory/multinode:226-230):nova_api_bootstrap×3,nova_cell_bootstrap×1, discovery once per compute CODE (Tags §2.5). - Batches apply per play: the whole fleet passes the nova-cell play before the next play starts. ansible-core 2.18.20
loops over the plays (
lib/ansible/executor/playbook_executor.py:124) and, inside each play, over its batches, restricting the inventory to one batch per run (lib/ansible/executor/playbook_executor.py:183-191) CODE (Execution flow §5).
1.3 Stop a rolling run on failures (max_fail_percentage)¶
# stop the run as soon as one host of a batch fails
kolla-ansible deploy -i multinode -t nova -e kolla_serial=10 -e kolla_max_fail_percentage=0
CODE:
- Every play of
site.yml,gather-facts.yml,mariadb.ymlandrabbitmq.yml, and the nova plays except the cell bootstrap and the two online-migration plays, setmax_fail_percentagefrom<service>_max_fail_percentage, thenkolla_max_fail_percentage, then 100 (e.g.site.yml:96-99,gather-facts.yml:7-10,mariadb.yml:25-28,nova.yml:141-144). The nova-cell plays readnova_cell_max_fail_percentage, the nova API playsnova_max_fail_percentage(nova.yml:40-43). The cell bootstrap play keepsany_errors_fatal: trueinstead (nova.yml:78-79).kolla_max_fail_percentageis unset by default, andglobals.ymlsays that 100 is equivalent to not setting it (etc/kolla/globals.yml:27-31). - ansible-core 2.18.20 compares the hosts failed in the current batch with the batch size: the play breaks when
failed / batch_sizeis greater than the percentage (lib/ansible/plugins/strategy/linear.py:336-347), and the failed-host list is cleared at the start of each batch (lib/ansible/executor/task_queue_manager.py:334). With 100 that never happens. A broken play stops the whole run (lib/ansible/executor/playbook_executor.py:194-196,lib/ansible/executor/playbook_executor.py:214-215). The value may be a string such as"0"or"10%": it is converted to a number (lib/ansible/playbook/base.py:455-460). - Whatever the value, a batch in which every host failed ends the run
(
lib/ansible/executor/playbook_executor.py:199-204). Hosts that failed in an earlier batch or play are marked failed again at the start of each later run of the task queue (lib/ansible/executor/task_queue_manager.py:323-329). - So, with the default 100 and
kolla_serial=10, a failed compute drops out and the next batches carry on. With0, the first failed host of a batch stops the run before the next batch; hosts of the current batch that had not failed are marked failed too and stop where they are (lib/ansible/plugins/strategy/linear.py:339-344), so check their state before you resume. - The restart plays of mariadb and rabbitmq read the same variables (
mariadb.yml:25-28,rabbitmq.yml:37-40): with one node per batch, any value below 100 stops the run when that node fails. - The same applies to the new
checkcommand: a container that is missing, stopped or unhealthy fails its host (roles/service-check/tasks/main.yml:12-40), so with a value below 100 acheckrun can stop early.
2. Separate "write config" from "apply" (recommended pattern)¶
CODE
kolla-ansible genconfig -t novawrites the newnova.confon all hosts. No restart. Changed in 2025.1: the reason is new. The nova and nova-cell config steps notify no handler any more (in 2025.1 only Placement's WSGI file and Cinder's Huawei XML files still notify from a config step, Conventions, rowwrites-config), andgenconfigdoes not run the container check, so nothing notifies the restart handlers. Most handlers therefore no longer carry thekolla_action != "config"guard of 2024.1 (roles/nova-cell/handlers/main.yml:70-159has none on its restart handlers; the guard is left only onReload libvirtd,:135-141). An untaggedgenconfigalso runs the common play, which no longer pulls the fluentd image (2025.1roles/common/tasks/config.ymlhas noensure_imagetask).kolla-ansible deploy-containers -t nova --limit compute001restarts only the nova containers of compute001 that changed. Drift is detected bykolla_set_configs --checkinsidecompare_container(module_utils/kolla_container_worker.py:58-65). On compute001, with the defaultnova_compute_virt_type: "kvm"(group_vars/all.yml:1253,group_vars/all.yml:945), its tasks make 4 remote module invocations (setupand 3compare_container: nova-libvirt, nova-ssh, nova-compute) plus the delegated fact loop and the one notify task (gather-facts.yml:19-25,gather-facts.yml:49-61;roles/service-check-containers/tasks/main.yml:4-41). Roles have nometadependency and common runs only in its own play, taggedcommon(site.yml:88-103) (Compute scaling §2). No bootstrap, no Keystone registration and no haproxy work run (roles/nova-cell/tasks/deploy-containers.yml:2,nova.yml:53-55,site.yml:325-327).- Repeat per batch. Controllers (API, metadata, scheduler, conductor) are applied with their own
--limitbatch.
Caveats:
- HAProxy frontends are not applied by this pattern.
genconfigalso re-renders/etc/kolla/haproxy/services.d/(the loadbalancer block runs forconfig,site.yml:325-327), but the loadbalancer play's check step is skipped forconfig(site.yml:319-324), anddeploy-containersruns no haproxy work. A frontend change written this way reaches HAProxy only throughreconfigure -t haproxy(orloadbalancer) or a run without tags CODE; in 2025.1 a-t novarun does not apply it either (Tags §2.2). Copyservices.dbeforegenconfigif you want to diff it. - Between steps 1 and 3, any other Kolla run that reaches the nova-cell check on those hosts applies the pending
drift: an untagged run,
-t novaor-t nova-cell(the tags of the nova-cell play,nova.yml:135-139). Unrelated tags do not do it through common: common runs only for an untagged run or-t common(site.yml:100-101). - A change confined to the
permissionslist ofconfig.jsonis never detected (§1.1). No Kolla run restarts the container for it, step 2 included. It takes effect only at the next restart for another reason. - Containers that start again for any other reason (a container engine restart, a reboot) also pick up the new
config, because
COPY_ALWAYScopies the files and rewrites/run_commandat container start (kolladocker/base/set_configs.py:315-330,docker/base/set_configs.py:559-565). Keep the window short.
Related¶
- Execution flow §4 — the action
matrix: what
genconfiganddeploy-containersrun and skip - Execution flow §5 —
batching with
serial, andmax_fail_percentage: a batch runs the complete play before the next batch starts - Execution flow §7 — the staged etcd handlers
- Tags §2.5 — what
run_oncetasks repeat whenserialis set - Kolla images §3 — what
kolla_set_configs --checkcompares and what it never compares - Predict and inspect a run — the
kolla_set_configs --checkcommand, to see what will restart aftergenconfig - Reconfigure Nova — what
-t nova reconfigureruns and restarts - R1 — the risk whose precautions name this pattern
To remember
Lumo: if you keep only 5 things from this page, keep these.
genconfig(no restart for Nova), a review of the diff, thendeploy-containers --limit <batch>: each batch restarts only the changed containers of its hosts.genconfig -t nova-cellalso renders the conductor and console config on controllers: give them a batch too. CODE- Until all batches are applied, any untagged,
-t novaor-t nova-cellrun, a container restart or a reboot applies the pending drift: keep the window short. CODE - Changed in 2025.1:
reconfigureandupgradealways run withkolla_serial=0, andANSIBLE_SERIALis gone. For a rolling run, usedeploy -e kolla_serial=N, which runs the same tasks asreconfigure. CODE - Changed in 2025.1: a change of
commandinconfig.jsonis now detected and applied bydeploy-containers; a change ofpermissionsstill is not. CODE - Every play has
max_fail_percentage, default 100, which never stops a play early: setkolla_max_fail_percentage(or<service>_max_fail_percentage) lower to stop a rolling run when a batch has failures. CODE
What would you do?
Lumo: a situation you could meet on a real platform, and three ways to react. Pick the one you would choose: I will tell you what this page says about it. Nothing is recorded.
Check yourself
Lumo: 5 quick questions to check the main ideas of this page. Choose an answer to see the explanation and the section that gives the evidence. Your score counts your first choices and stays in this browser only.
Lumo: ready for the next step? Take your time: you can come back to this page whenever you need it.
Lumo: nicely done! One more page on your journey.