diff --git a/infra/ansible/roles/etcd_io_priority/tasks/main.yml b/infra/ansible/roles/etcd_io_priority/tasks/main.yml index c684a6f..1faea78 100644 --- a/infra/ansible/roles/etcd_io_priority/tasks/main.yml +++ b/infra/ansible/roles/etcd_io_priority/tasks/main.yml @@ -197,7 +197,7 @@ playbooks/etcd-io-priority.yml once k3s is up. when: - _eio_scheduler | length > 0 - - not _eio_k3s_cgroup.stat.exists + - not (_eio_k3s_cgroup.stat.exists | default(false)) - name: Read back the live cgroup I/O weights ansible.builtin.command: @@ -206,9 +206,13 @@ changed_when: false check_mode: false failed_when: false + # `| default(false)`: Ansible templates `loop:` BEFORE evaluating `when:`, so on an NVMe + # node — where the stat task above is skipped and _eio_k3s_cgroup has no `.stat` at all — + # a bare `_eio_k3s_cgroup.stat.exists` raises even though this task will not run. loop: >- {{ ['system.slice'] - + (['system.slice/k3s.service'] if _eio_k3s_cgroup.stat.exists else []) }} + + (['system.slice/k3s.service'] + if (_eio_k3s_cgroup.stat.exists | default(false)) else []) }} when: _eio_scheduler | length > 0 - name: VERIFY every live cgroup weight actually carries the boost