refactor: replace verbose flag with Ansible verbosity (-v) flag
- Remove custom 'verbose' parameter from module - Use Ansible's built-in verbosity setting (module._verbosity) - Verbose output now shown with -v, -vv, -vvv flags - Add notes to DOCUMENTATION explaining -v flag usage - Update all examples to remove verbose: true parameter - Update all documentation to mention -v flag instead - Simplifies module interface by leveraging Ansible conventions
This commit is contained in:
@@ -157,12 +157,10 @@ options:
|
||||
- Can be an IPv4/IPv6 address or FQDN.
|
||||
- If specified, zones do not need O(zones[].dns_server).
|
||||
type: str
|
||||
verbose:
|
||||
description:
|
||||
- Enable verbose output showing per-record actions.
|
||||
- When enabled, includes details about which records were added, removed, changed, or skipped.
|
||||
type: bool
|
||||
default: false
|
||||
notes:
|
||||
- Verbose output showing per-record actions is available with C(-v) flag.
|
||||
- Use C(-v) to see which records were Added, Removed, Changed, or Skipped.
|
||||
- Use C(--diff) flag to see before/after state of DNS records.
|
||||
"""
|
||||
|
||||
EXAMPLES = r"""
|
||||
@@ -221,7 +219,7 @@ EXAMPLES = r"""
|
||||
ignore_record_patterns:
|
||||
- '^_acme-challenge\..*'
|
||||
- '^_dnsauth\..*'
|
||||
verbose: true # Show per-record actions
|
||||
# Use -v flag for per-record action details
|
||||
zones:
|
||||
- name: example.com
|
||||
dns_server: 10.1.1.1
|
||||
@@ -842,7 +840,7 @@ class DNSZoneManager:
|
||||
|
||||
if total_changes == 0:
|
||||
result['changed'] = False
|
||||
if self.module.params['verbose']:
|
||||
if self.module._verbosity >= 1:
|
||||
# Include verbose output even if no changes
|
||||
result['changes']['verbose'] = changes.get('verbose_actions', [])
|
||||
return result
|
||||
@@ -852,8 +850,8 @@ class DNSZoneManager:
|
||||
result['changes']['deletes'] = len(changes['deletes'])
|
||||
result['changes']['updates'] = len(changes['updates'])
|
||||
|
||||
# Add verbose output if enabled
|
||||
if self.module.params['verbose']:
|
||||
# Add verbose output if verbosity enabled
|
||||
if self.module._verbosity >= 1:
|
||||
result['changes']['verbose'] = changes.get('verbose_actions', [])
|
||||
|
||||
# Add diff output if enabled
|
||||
@@ -951,8 +949,7 @@ def main():
|
||||
ignore_dnssec_records=dict(type='bool', default=True),
|
||||
ignore_soa_records=dict(type='bool', default=True),
|
||||
validate_records=dict(type='bool', default=True),
|
||||
dns_server=dict(type='str'),
|
||||
verbose=dict(type='bool', default=False)
|
||||
dns_server=dict(type='str')
|
||||
),
|
||||
supports_check_mode=True,
|
||||
supports_diff_mode=True,
|
||||
|
||||
Reference in New Issue
Block a user