Skip to content

Fix: "controller_hosts" role ignores "enabled: false" and enables host unconditionally.#1346

Open
nikhjain14 wants to merge 1 commit intoredhat-cop:develfrom
nikhjain14:fix/controller-hosts-bug
Open

Fix: "controller_hosts" role ignores "enabled: false" and enables host unconditionally.#1346
nikhjain14 wants to merge 1 commit intoredhat-cop:develfrom
nikhjain14:fix/controller-hosts-bug

Conversation

@nikhjain14
Copy link
Copy Markdown

Summary

The controller_hosts role ignores the enabled: false parameter and always adds the host in an enabled state to the Controller inventory.

Issue Type

  • Bug Report

Problem

When defining a host with enabled: false in the controller_hosts variable list, the host is successfully created in the controller inventory but is always enabled, ignoring the explicitly set value.

Example configuration that triggers the bug:

controller_hosts:
  - name: "my-execution-node"
    description: "Execution node"
    inventory: "Demo Inventory"
    enabled: false
    variables:
      ansible_host: "192.168.1.10"
    state: present

Expected behavior:
Host my-execution-node should be added to Demo Inventory with enabled set to false (disabled state).

Actual behavior:
Host my-execution-node is added to Demo Inventory with enabled set to true regardless of the value passed.

Solution

Changed default(omit, true) to default(omit) in the enabled parameter definition. Removing the second true argument ensures the filter only omits the parameter when it is truly undefined/not set, and correctly passes false to the module when enabled: false is explicitly specified by
the user.

Related Issue

Fixes #1345

…t unconditionally.

When "enabled: false" is set for a host in "controller_hosts", the host is still being added to the inventory in an enabled state. The value of enabled is being overridden or misinterpreted during task execution in "roles/controller_hosts/tasks/main.yml".

Expected: Host should be added to the controller with "enabled: false".

Actual: Host is added, but always set to "enabled: true" regardless of input.
@nikhjain14 nikhjain14 requested a review from a team as a code owner April 27, 2026 11:19
@nikhjain14 nikhjain14 deployed to requires-approval April 27, 2026 11:19 — with GitHub Actions Active
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.

Bug: "controller_hosts" role ignores "enabled: false" and always enables host in inventory.

1 participant