Skip to content

rabbitmq: honour the console_interface fallback - #2579

Draft
ideaship wants to merge 1 commit into
stack/4-template-internal-interfacefrom
stack/5-console-interface-fallback
Draft

rabbitmq: honour the console_interface fallback#2579
ideaship wants to merge 1 commit into
stack/4-template-internal-interfacefrom
stack/5-console-interface-fallback

Conversation

@ideaship

@ideaship ideaship commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

osism/defaults resolves a node's internal address as

{{ hostvars[inventory_hostname]['ansible_' +
   internal_interface|default(console_interface)]['ipv4']['address'] }}

(defaults/manager/000-defaults.yml). The expression used here left the fallback out and referenced internal_interface directly, so a host that sets console_interface explicitly and leaves internal_interface unset — a configuration that resolves in the deployment — did not resolve here.

This adds the fallback so the two agree.

Where neither variable is set it still fails, and loudly: defaults/all/099-interfaces.yml defines console_interface: "{{ internal_interface|default(loopback0) }}", and loopback0 is not defined as a variable anywhere in osism/defaults (the name occurs only as an interface key in netplan and cloud-init files), so the lookup raises 'loopback0' is undefined rather than returning an address that was never configured.

Verification. On ansible-core 2.19.11, both the case this fixes (console_interface set to a real interface, internal_interface absent → resolves to that interface's address) and the case it must not paper over (neither set → raises).

Note this widens what resolves rather than narrowing it: the code preceding this stack required internal_interface outright and skipped the host without it.

Separable — this is not needed to fix osism/issues#1425, and can be deferred or dropped without affecting the rest of the stack.

🤖 Generated with Claude Code

osism/defaults resolves a node's internal address as

  {{ hostvars[inventory_hostname]['ansible_' +
     internal_interface|default(console_interface)]['ipv4']['address'] }}

(defaults/manager/000-defaults.yml). The expression used here left the
fallback out and referenced internal_interface directly, so a host that
sets console_interface explicitly and leaves internal_interface unset --
a configuration that resolves in the deployment -- did not resolve here.

Add the fallback so the two agree.

Where neither variable is set this still fails, and loudly:
defaults/all/099-interfaces.yml defines

  console_interface: "{{ internal_interface|default(loopback0) }}"

and "loopback0" is not defined as a variable anywhere in osism/defaults
(the name occurs only as an interface key in netplan and cloud-init
files), so the lookup raises "'loopback0' is undefined" rather than
returning an address that was never configured. Verified on ansible-core
2.19.11, together with the case this commit fixes: console_interface set
to a real interface and internal_interface absent now resolves to that
interface's address.

The integration suite gains the case: a host with console_interface set and
internal_interface absent, resolved against real Ansible.

Note this widens what resolves rather than narrowing it. The code that
preceded this series required internal_interface outright and skipped the
host without it.

Assisted-by: Claude:claude-opus-5
Signed-off-by: Roger Luethi <luethi@osism.tech>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: New

Development

Successfully merging this pull request may close these issues.

Jinja2 variables not rendered by rabbitmq3to4

2 participants