Skip to content

fix(certs): make *_cert_will_expire_soon overridable from playbooks - #171

Open
Oddly wants to merge 1 commit into
mainfrom
fix/cert-expiry-flags-overridable
Open

fix(certs): make *_cert_will_expire_soon overridable from playbooks#171
Oddly wants to merge 1 commit into
mainfrom
fix/cert-expiry-flags-overridable

Conversation

@Oddly

@Oddly Oddly commented Aug 4, 2026

Copy link
Copy Markdown
Owner

Closes #157.

The five *_cert_will_expire_soon flags — one per role plus the CA one on elasticstack — sat in vars/main.yml, which sits above play vars in the Ansible precedence hierarchy. That meant a playbook doing vars: elasticsearch_cert_will_expire_soon: true had no effect: as soon as the role was included, the value got reverted to false from vars/main.yml, and renewal never fired. I ran into this myself writing the cert-renewal molecule scenario for #155 and had to work around it by manipulating _cert_expiration_buffer instead.

Moving each flag to defaults/main.yml with an @var docblock puts them in the precedence tier every other tunable lives in, so play vars, inventory vars, and command-line -e all win as expected. Runtime mutation from cert_check_expiry still wins on top of both because it goes through set_fact (host fact, higher precedence than either).

Documented that these are normally flipped automatically and only need to be set manually to force renewal outside the buffer window. No behaviour change for callers that never set them.

@Oddly Oddly added the ci:run Trigger gated pull request CI label Aug 4, 2026
@Oddly
Oddly enabled auto-merge (squash) August 4, 2026 07:16
@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@Oddly, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 25 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 70b2ffbb-1d24-4ab7-a696-e0df62fb1273

📥 Commits

Reviewing files that changed from the base of the PR and between b0cbfa6 and 038e163.

📒 Files selected for processing (10)
  • roles/beats/defaults/main.yml
  • roles/beats/vars/main.yml
  • roles/elasticsearch/defaults/main.yml
  • roles/elasticsearch/vars/main.yml
  • roles/elasticstack/defaults/main.yml
  • roles/elasticstack/vars/main.yml
  • roles/kibana/defaults/main.yml
  • roles/kibana/vars/main.yml
  • roles/logstash/defaults/main.yml
  • roles/logstash/vars/main.yml

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot removed the ci:run Trigger gated pull request CI label Aug 4, 2026
@Oddly
Oddly force-pushed the fix/cert-expiry-flags-overridable branch from f580639 to 3d9ab78 Compare August 4, 2026 08:45
@Oddly Oddly added the ci:run Trigger gated pull request CI label Aug 4, 2026
@github-actions github-actions Bot removed the ci:run Trigger gated pull request CI label Aug 4, 2026
Closes #157.

The five cert-renewal trigger flags (elasticsearch_cert_will_expire_soon,
beats_cert_will_expire_soon, kibana_cert_will_expire_soon,
logstash_cert_will_expire_soon, elasticstack_ca_will_expire_soon) lived
in each role's vars/main.yml, which outranks play vars, so a playbook
that did 'vars: elasticsearch_cert_will_expire_soon: true' saw its
value silently reverted when the role re-imported vars/main.yml.

Move each flag to the corresponding defaults/main.yml with an @var
docblock explaining that it is normally flipped automatically by
cert_check_expiry and only needs to be set from a playbook to force
renewal without touching the buffer. Runtime mutation via set_fact
still wins (set_fact produces a host fact, which beats a role default),
so cert_check_expiry keeps working.
@Oddly
Oddly force-pushed the fix/cert-expiry-flags-overridable branch from 3d9ab78 to 038e163 Compare August 4, 2026 09:18
@Oddly Oddly added the ci:run Trigger gated pull request CI label Aug 4, 2026
@github-actions github-actions Bot removed the ci:run Trigger gated pull request CI label Aug 4, 2026
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.

*_cert_will_expire_soon flags in vars/main.yml are not overridable from playbooks

1 participant