Missing default value for "elasticsearch_agent" causes "performancecopilot_metrics_elasticsearch" role to fail
kurik opened this issue · comments
Field elasticsearch_agent
in roles/performancecopilot_metrics_elasticsearch/tasks/main.yml
file does not have defined a default value. This is causing fail of the role when metrics_from_elasticsearch: yes
is set in a playbook.
Here is an example playbook:
# SPDX-License-Identifier: MIT
---
- name: Ensure that the role runs
hosts: all
roles:
- role: linux-system-roles.metrics
vars:
metrics_from_elasticsearch: yes
Here is the error message as reported by Ansible:
RUNNING HANDLER [performancecopilot_metrics_pcp : restart pmlogger] ***********************
fatal: [10.0.139.221]: FAILED! => {"msg": "The conditional check 'elasticsearch_agent | bool' failed. The error was: error while evaluating conditional (elasticsearch_agent | bool): 'elasticsearch_agent' is undefined\n\nThe error appears to be in '/usr/share/ansible/roles/metrics/roles/performancecopilot_metrics_pcp/handlers/main.yml': line 19, 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: restart pmlogger\n ^ here\n"}