NETWAYS / NETWAYS/ansible-collection-elasticstack

[Feature]: Data-driven generic template for Metricbeat modules (replace beats_metricbeat_modules)

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

Nobody has claimed this yet.

breaking-change component:metricbeat feature
Dominant language
Jinja
Stars
14
Forks
11
Avg merge
1d 47m
Merged PRs (30d)
6

Description

Mirror of #510 for Metricbeat. Today beats_metricbeat_modules is a flat list of module names; the role only runs metricbeat modules enable, so a module's config can't be set — hosts, xpack.enabled, credentials, ssl (i.e. targeting).

Replace the flat beats_metricbeat_modules name-list with a data-driven variable (a list of modules with their config), rendered inline into metricbeat.yml (metricbeat.modules:) by the shared template/macro. This one list is the declarative desired state (in the list = enabled+configured; removed = gone; no separate disable list, no enabled: false). Render inline, not modules.d/*.yml (inline re-rendered wholesale → clean removal; modules.d orphans files and its settings take precedence). Drop metricbeat modules enable; leave modules.d/ untouched. Re-adapt the setup task here too (supersedes #508's current-architecture fix): run metricbeat setup on this template's change (register/is changed, run_once); inline means no --modules needed.

This also covers Stack Monitoring via the xpack.enabled field:

  • xpack.enabled: false (current) → metrics land in the normal metricbeat-* indices; the user builds their own dashboards.
  • xpack.enabled: true → data is written to .monitoring-*, usable by the ready-made Kibana "Stack Monitoring" app.

In a full stack the targeting defaults to the known hosts/CA/monitoring user. On 8.x there is no Stack Monitoring out of the box (legacy xpack.monitoring push is 7-only).

Docs: shared roles/beats/docs/beats-modules.md (common model + a Metricbeat section incl. an xpack.enabled example), linked from the beats_metricbeat_modules description; README table shows only a short default + the pointer.

Breaking: beats_metricbeat_modules changes from a name list to a data structure. Shares the macro + docs page with #510 and the Auditbeat modules issue. Related: #77 (Elastic Agent); legacy monitoring removed with #446.


Depends on: #393 (shared plugin-as-data macro).

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 the shared plugin-as-data macro from dependency #393 and the Metricbeat role's metricbeat.yml template and setup task. Read roles/beats/docs/beats-modules.md for the common model and Metricbeat section. Done means the data-driven list renders inline, setup runs when that template changes, modules.d remains untouched, and the README and variable description point to the documentation.

Written by the indexing model from the issue text.

Assessment

Tech stack
ansible
Domain
devops, observability-sre
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.