Skip to content

fix: various fixes#927

Open
dupremathieu wants to merge 3 commits into
seapath:mainfrom
dupremathieu:fix/boolean-and-delegate_to-errors
Open

fix: various fixes#927
dupremathieu wants to merge 3 commits into
seapath:mainfrom
dupremathieu:fix/boolean-and-delegate_to-errors

Conversation

@dupremathieu
Copy link
Copy Markdown
Member

@dupremathieu dupremathieu commented May 11, 2026

Summary

  • Fix string-to-boolean conditional error in configure_libvirt_rdb_secret by adding | bool filter
  • Fix delegate_to crash in configure_ha when valid_machine group doesn't exist
  • Fix an error with Ansible 2.20

Details

configure_libvirt_rdb_secret

The Jinja2 template in the set_fact task produces a string "true" instead of a boolean. Adding | bool to the when conditions fixes the "Conditional result (True) was derived from value of type 'str'" error.

configure_ha

The delegate_to: "{{ groups['valid_machine'][0] }}" expression fails with "object of type 'dict' has no attribute 'valid_machine'" when no hosts were added to that group. Using groups.get() with a fallback avoids the crash. The when condition still prevents the task from actually running.

@dupremathieu dupremathieu force-pushed the fix/boolean-and-delegate_to-errors branch from f967224 to 5992293 Compare May 11, 2026 16:33
@dupremathieu dupremathieu changed the title fix: boolean condition and delegate_to group errors fix: boolean condition, delegate_to group errors and cephadm missing variable May 11, 2026
@dupremathieu dupremathieu marked this pull request as ready for review May 11, 2026 16:35
@dupremathieu dupremathieu requested review from insatomcat and removed request for insatomcat May 11, 2026 16:35
@dupremathieu dupremathieu marked this pull request as draft May 11, 2026 16:36
- configure_libvirt_rdb_secret: add | bool filter to when conditions
  since the Jinja2 template produces a string 'true' not a boolean
- configure_ha: use safe groups.get() in delegate_to to avoid crash
  when valid_machine group doesn't exist

Signed-off-by: Mathieu Dupré <mathieu.dupre@savoirfairelinux.com>
Ansible 2.20 mishandles the '#!/usr/bin/env python3' shebang
when constructing the remote command for custom modules. Because
the shebang contains a space (/usr/bin/env + python3), Ansible
wraps the interpreter path in extra single quotes, causing the
remote shell to look for a literally-quoted string as a binary
name.

Example of the broken SSH command:
  /bin/sh -c ''\''/usr/bin/env python3'\'' ...'

Changing to '#!/usr/bin/python3' avoids the quoting issue and
matches the ansible_python_interpreter already configured in the
inventory.

Signed-off-by: Mathieu Dupré <mathieu.dupre@savoirfairelinux.com>
Add a vm_domain_type variable to the guest XML template (defaults
to 'kvm'). This is intentionally undocumented — it exists only to
allow running VMs in a virtual sandbox where nested KVM is
unavailable, by setting vm_domain_type: qemu in the host vars.

Signed-off-by: Mathieu Dupré <mathieu.dupre@savoirfairelinux.com>
@dupremathieu dupremathieu force-pushed the fix/boolean-and-delegate_to-errors branch from d90532c to ef543a7 Compare May 13, 2026 18:17
@dupremathieu dupremathieu marked this pull request as ready for review May 13, 2026 18:19
@dupremathieu dupremathieu changed the title fix: boolean condition, delegate_to group errors and cephadm missing variable fix: various fixes May 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant