fix: add verbosity-based no_log to facts modules#619
Merged
Conversation
- Add no_log: "{{ ansible_verbosity < 2 }}" to service_facts
This hides verbose facts output unless ansible_verbosity >= 2,
reducing log clutter during normal operation while allowing
full output when debugging with -vv or higher.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Reviewer's guide (collapsed on small PRs)Reviewer's GuideAdds verbosity-based no_log handling to the service_facts task in the blivet role to reduce log noise at normal verbosity while still allowing detailed facts output at higher verbosity levels. Sequence diagram for verbosity-based no_log handling in service_facts tasksequenceDiagram
actor AnsibleUser
participant AnsibleController
participant BlivetRole
participant AnsibleFacts
AnsibleUser->>AnsibleController: Run playbook with verbosity flag
AnsibleController->>BlivetRole: Execute tasks in main_blivet
BlivetRole->>AnsibleFacts: Check existing ansible_facts
AnsibleFacts-->>BlivetRole: services and cryptsetup_services presence
BlivetRole->>BlivetRole: Evaluate conditions
Note over BlivetRole: when not services in ansible_facts
Note over BlivetRole: and not cryptsetup_services in storage_skip_checks
BlivetRole->>BlivetRole: Evaluate ansible_verbosity < 2
alt ansible_verbosity < 2
BlivetRole->>AnsibleFacts: Call service_facts with no_log true
AnsibleFacts-->>BlivetRole: Gather service facts (hidden in logs)
else ansible_verbosity >= 2
BlivetRole->>AnsibleFacts: Call service_facts with no_log false
AnsibleFacts-->>BlivetRole: Gather service facts (visible in logs)
end
BlivetRole-->>AnsibleController: Updated ansible_facts
AnsibleController-->>AnsibleUser: Play recap with logs based on verbosity
Flow diagram for ansible_verbosity-based logging in service_facts taskflowchart TD
A[Start blivet role tasks] --> B[Check if services in ansible_facts]
B -->|yes| C[Skip Get service facts task]
B -->|no| D[Check if cryptsetup_services in storage_skip_checks]
D -->|yes| C
D -->|no| E[Evaluate ansible_verbosity < 2]
E -->|true| F[Run service_facts
no_log set to true]
E -->|false| G[Run service_facts
no_log set to false]
F --> H[Update ansible_facts]
G --> H
C --> I[Continue remaining tasks]
H --> I
I --> J[End blivet role tasks]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Codecov Report✅ All modified and coverable lines are covered by tests.
Additional details and impacted files@@ Coverage Diff @@
## main #619 +/- ##
==========================================
- Coverage 16.54% 10.16% -6.39%
==========================================
Files 2 9 +7
Lines 284 2056 +1772
Branches 79 0 -79
==========================================
+ Hits 47 209 +162
- Misses 237 1847 +1610
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
richm
approved these changes
May 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Feature: Add verbosity-based no_log to facts modules.
Reason: Facts modules like service_facts produce verbose output that clutters logs during normal operation, making it difficult to review playbook execution.
Result:
🤖 Generated with Claude Code
Summary by Sourcery
Enhancements: