Skip to content

Cluster config update : error on enable maintenance mode task #115

@oaitmoulid

Description

@oaitmoulid

When adding a custom cluster configuration like this :

redpanda:
  cluster:
    auto_create_topics_enabled: true
    data_transforms_enabled: true
    default_topic_replications: 3

playbook fails at enabling the maintenance mode :

TASK [redpanda.cluster.redpanda_broker : Enable Maintenance Mode] ***********************************************************************************************************************************************
task path: /opt/ansible_core/add-ons/collections/ansible_collections/redpanda/cluster/roles/redpanda_broker/tasks/safe-restart.yml:6
fatal: [vm-redpanda-dif-prod-pau-01]: FAILED! => {"msg": "The conditional check 'ansible_play_hosts > 1' failed. The error was: Unexpected templating type error occurred on ({% if ansible_play_hosts > 1 %} True {% else %} False {% endif %}): '>' not supported between instances of 'list' and 'int'. '>' not supported between instances of 'list' and 'int'\n\nThe error appears to be in '/opt/ansible_core/add-ons/collections/ansible_collections/redpanda/cluster/roles/redpanda_broker/tasks/safe-restart.yml': line 6, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n#\n- name: Enable Maintenance Mode\n  ^ here\n"}

Suggested correction : just add " | length " to get the correct value of number of nodes, for example :

- name: Enable Maintenance Mode
  ansible.builtin.command:
    cmd: rpk cluster maintenance enable {{ node_id }} --wait {{ redpanda_rpk_opts }}
  no_log: "{{ redpanda_broker_no_log }}"
  when:
    - restart_required
    - inventory_hostname == cluster_host
    - ansible_play_hosts | length > 1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions