fix(elasticsearch): gate remaining tasks on check mode#154
Conversation
Two paths in the elasticsearch role still attempted runtime operations under --check: The no-security cluster setup block hit the cluster health API with ignore_errors set to ansible_check_mode. The retry loop (30 × 10s) still ran, so a check-mode pass wasted up to five minutes waiting on an endpoint that cannot be reached without a running service. Moved the check-mode guard to the block-level when so the whole branch is skipped instead. The handler that restarts Kibana after an Elasticsearch certificate change had no check-mode guard, so it would attempt service restarts and HTTP probes against a Kibana that isn't necessarily up. Added the same not ansible_check_mode condition the other restart handlers in this file already use. Closes #25.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR improves check mode support for the Elasticsearch Ansible role by adding guards to prevent operations that require a live Elasticsearch instance. The Kibana restart handler and cluster health check task now skip execution during ChangesCheck Mode Guards
🎯 1 (Trivial) | ⏱️ ~5 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Two paths in the elasticsearch role still ran (or wasted time) under `--check`.
The no-security cluster setup block in `tasks/main.yml` hit the cluster health API with `ignore_errors: ansible_check_mode`. The `until` loop (30 × 10s) still executed, so a check-mode pass burnt up to five minutes waiting on an endpoint that cannot respond without a running service. Moved the check-mode guard up to the block-level `when` so the whole branch is skipped, and dropped the now-redundant `ignore_errors`.
The handler that restarts Kibana after an Elasticsearch certificate change in `handlers/main.yml` had no check-mode guard, so it would attempt a service restart and HTTP probe against a Kibana that may not even be running. Added the same `not ansible_check_mode` condition the four neighbouring Elasticsearch restart handlers in this file already use.
No molecule scenario currently runs the role under `--check`, so I haven't added a verify-side test — adding a check-mode converge would be more invasive than the fix. The change has no behavioural impact on normal (non-check-mode) runs.
Closes #25.
Summary by CodeRabbit