Skip to content

Add user-defined elastic password and LogsDB support#91

Merged
Oddly merged 2 commits intomainfrom
feature/elastic-password-and-logsdb
Mar 9, 2026
Merged

Add user-defined elastic password and LogsDB support#91
Oddly merged 2 commits intomainfrom
feature/elastic-password-and-logsdb

Conversation

@Oddly
Copy link
Owner

@Oddly Oddly commented Mar 9, 2026

Summary

  • Add elasticsearch_elastic_password for setting the elastic superuser password to a user-defined value after initial security setup. When set, the role changes the auto-generated password via the _security/user/elastic/_password API and uses the new password for all subsequent API calls. The initial_passwords file is kept for other built-in users (kibana_system, beats_system, etc.)
  • Add elasticsearch_logsdb (default true for 9.x, false for 8.x) that enables LogsDB index mode via cluster.logsdb.enabled persistent cluster setting. Matches upstream 9.x fresh-install behavior on upgrade clusters
  • Fix pre-commit ansible-lint hook to respect exclude_paths from .ansible-lint (was passing filenames directly, bypassing excludes for molecule/shared/)

Test plan

  • elasticsearch_default — verifies user-defined password works for API calls, old auto-generated password returns 401, LogsDB cluster setting is applied
  • Other ES scenarios — verify they still work with file-based passwords (no elasticsearch_elastic_password set)
  • Lint passes

Closes #89, closes #71.

Oddly added 2 commits March 9, 2026 20:29
Add elasticsearch_elastic_password variable that changes the auto-generated elastic
superuser password after initial security setup and uses the user-defined value for all
subsequent API calls. The initial_passwords file is preserved for other built-in users
(kibana_system, beats_system, etc.). The elasticstack-passwords.yml shared task checks
for the user-defined password first, falling back to the file when unset.

Add elasticsearch_logsdb variable (default true for 9.x, false for 8.x) that enables
the LogsDB index mode via cluster.logsdb.enabled persistent cluster setting. LogsDB
uses synthetic _source and optimized compression for up to 4x storage savings. Fresh
9.x installs enable this by default but 8.x→9.x upgrades do not — this matches the
upstream 9.x default behavior.

Fix pre-commit ansible-lint hook to not pass filenames directly, so that exclude_paths
in .ansible-lint is respected for molecule/shared/ task files.

Closes #89, closes #71.
When elasticsearch_logsdb defaults to true on 9.x, the effective cluster
settings dict is non-empty and the "Apply persistent cluster settings"
block fires. In scenarios that don't include the elasticstack role (like
elasticsearch_test_modules), elasticstack_password is never set outside
of elasticsearch-security.yml, causing an undefined variable error.

Skip the block when security is enabled but no password is available yet.
When security is disabled, the block runs unconditionally since no auth
is needed.
@Oddly Oddly merged commit 3369246 into main Mar 9, 2026
45 checks passed
@Oddly Oddly deleted the feature/elastic-password-and-logsdb branch March 9, 2026 20:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support user-defined elastic password Enable LogsDB index mode for logs data streams

1 participant