NETWAYS / NETWAYS/ansible-collection-elasticstack

[Bug]: A missing inventory group for the Beats output fails with an unreadable error

Open
#552 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug component:beats
Dominant language
Jinja
Stars
14
Forks
11
Avg merge
1d 47m
Merged PRs (30d)
6

Description

beats_filebeat_output defaults to logstash, and the templates resolve the output hosts straight from the inventory group. Without that group the run dies while rendering the config:

TASK [beats : Configure Filebeat]
AnsibleUndefinedVariable: 'dict object' has no attribute 'logstash'

The message names neither the variable nor the group, and it arrives after the packages are installed and the certificates are distributed. #102 was this error and took a maintainer to explain.

Not about the default: elasticsearch behaves the same way. Nine group lookups across the three templates are unguarded, while the Kibana reference in the same files already checks | default([]) | length > 0 and skips its block.

Want

A preflight assert in roles/beats/tasks/main.yml, before the three import_tasks, for every enabled beat whose output is logstash or elasticsearch, saying which variable is set to what and which group is missing.

Only under elasticstack_full_stack, standalone resolves hosts from beats_target_hosts. No fallback: logstash and kibana fall back to localhost because those services sit next to Elasticsearch, a Beat doing that would ship data nowhere.

Read the output as beats_<beat>_output.type | default(beats_<beat>_output) so it keeps working after #522 turns the variable into a dict, and skip types that resolve no group.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with roles/beats/tasks/main.yml and the three Beats templates; trace the nine output-host group lookups and the existing Kibana guard. Exercise a run with a missing logstash or elasticsearch inventory group under elasticstack_full_stack. Done when preflight stops before the imports with an actionable variable and group message, while valid groups continue normally.

Written by the indexing model from the issue text.

Assessment

Tech stack
ansible, elasticsearch
Domain
devops, infrastructure
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.