# SPDX-License-Identifier: MIT
---
- name: Configure utilizations for node {{ node_options.node_name }}
  command:
    # Multiple sets of utilization per node are not supported by pcs (and
    # therefore the role) as of yet
    cmd: >
      pcs -f {{ __ha_cluster_tempfile_cib_xml.path | quote }}
      -- node utilization {{ node_options.node_name | quote }}
      {% for attr in node_options.utilization[0].attrs | d([]) %}
        {{ attr.name | quote }}={{ attr.value | quote }}
      {% endfor %}
  # We always need to create CIB to see whether it's the same as what is
  # already present in the cluster. However, we don't want to report it as a
  # change since the only thing which matters is pushing the resulting CIB to
  # the cluster.
  check_mode: false
  changed_when: not ansible_check_mode
