Compare commits

...

5 commits

Author SHA1 Message Date
Marty Winkler
443d268e99
Merge 79335896de into 0847977d12 2024-01-11 16:42:50 +00:00
Marty Winkler
79335896de
profile_roles callback: add parameter to show only summary 2024-01-11 17:42:43 +01:00
Marty Winkler
9725f04a4e
profile_tasks callback: add parameter to show only summary 2024-01-11 17:42:43 +01:00
Michael
0847977d12
Warn only when zones were ignored in firewalld_info (#504)
* warn only when zones were ignored

* add changelog 504-firewalld_info-warning
2024-01-09 16:07:58 -06:00
Christer Warén
2a1fb334ee
mount: edit boot parameters warning condition (#523)
the CI failures are unrelated and shouldn't even be showing up ... I'm going to sort that out separately but that doesn't need to prevent this merge, all relevant CI tests passed
2024-01-09 16:06:26 -06:00
6 changed files with 60 additions and 9 deletions

View file

@ -0,0 +1,2 @@
minor_changes:
- firewalld_info - Only warn about ignored zones, when there are zones ignored.

View file

@ -0,0 +1,3 @@
---
minor_changes:
- "Add summary_only parameter to profile_roles and profile_tasks callbacks."

View file

@ -14,6 +14,19 @@ DOCUMENTATION = '''
- This callback module provides profiling for ansible roles. - This callback module provides profiling for ansible roles.
requirements: requirements:
- whitelisting in configuration - whitelisting in configuration
options:
summary_only:
description:
- Only show summary, not individual task profiles.
Especially usefull in combination with C(DISPLAY_SKIPPED_HOSTS=false) and/or C(ANSIBLE_DISPLAY_OK_HOSTS=false).
type: bool
default: False
env:
- name: PROFILE_ROLES_SUMMARY_ONLY
ini:
- section: callback_profile_roles
key: summary_only
version_added: 1.5.0
''' '''
import collections import collections
@ -76,13 +89,26 @@ class CallbackModule(CallbackBase):
self.stats = collections.Counter() self.stats = collections.Counter()
self.totals = collections.Counter() self.totals = collections.Counter()
self.current = None self.current = None
self.summary_only = None
super(CallbackModule, self).__init__() super(CallbackModule, self).__init__()
def set_options(self, task_keys=None, var_options=None, direct=None):
super(CallbackModule, self).set_options(task_keys=task_keys, var_options=var_options, direct=direct)
self.summary_only = self.get_option('summary_only')
def _display_tasktime(self):
if not self.summary_only:
self._display.display(tasktime())
def _record_task(self, task): def _record_task(self, task):
""" """
Logs the start of each task Logs the start of each task
""" """
self._display.display(tasktime()) self._display_tasktime()
timestamp(self) timestamp(self)
if task._role: if task._role:
@ -99,10 +125,10 @@ class CallbackModule(CallbackBase):
self._record_task(task) self._record_task(task)
def playbook_on_setup(self): def playbook_on_setup(self):
self._display.display(tasktime()) self._display_tasktime()
def playbook_on_stats(self, stats): def playbook_on_stats(self, stats):
self._display.display(tasktime()) self._display_tasktime()
self._display.display(filled("", fchar="=")) self._display.display(filled("", fchar="="))
timestamp(self) timestamp(self)

View file

@ -40,6 +40,18 @@ DOCUMENTATION = '''
ini: ini:
- section: callback_profile_tasks - section: callback_profile_tasks
key: sort_order key: sort_order
summary_only:
description:
- Only show summary, not individual task profiles.
Especially usefull in combination with C(DISPLAY_SKIPPED_HOSTS=false) and/or C(ANSIBLE_DISPLAY_OK_HOSTS=false).
type: bool
default: False
env:
- name: PROFILE_TASKS_SUMMARY_ONLY
ini:
- section: callback_profile_tasks
key: summary_only
version_added: 1.5.0
''' '''
EXAMPLES = ''' EXAMPLES = '''
@ -120,6 +132,7 @@ class CallbackModule(CallbackBase):
self.current = None self.current = None
self.sort_order = None self.sort_order = None
self.summary_only = None
self.task_output_limit = None self.task_output_limit = None
super(CallbackModule, self).__init__() super(CallbackModule, self).__init__()
@ -137,6 +150,8 @@ class CallbackModule(CallbackBase):
elif self.sort_order == 'none': elif self.sort_order == 'none':
self.sort_order = None self.sort_order = None
self.summary_only = self.get_option('summary_only')
self.task_output_limit = self.get_option('output_limit') self.task_output_limit = self.get_option('output_limit')
if self.task_output_limit is not None: if self.task_output_limit is not None:
if self.task_output_limit == 'all': if self.task_output_limit == 'all':
@ -144,11 +159,15 @@ class CallbackModule(CallbackBase):
else: else:
self.task_output_limit = int(self.task_output_limit) self.task_output_limit = int(self.task_output_limit)
def _display_tasktime(self):
if not self.summary_only:
self._display.display(tasktime())
def _record_task(self, task): def _record_task(self, task):
""" """
Logs the start of each task Logs the start of each task
""" """
self._display.display(tasktime()) self._display_tasktime()
timestamp(self) timestamp(self)
# Record the start time of the current task # Record the start time of the current task
@ -171,10 +190,10 @@ class CallbackModule(CallbackBase):
self._record_task(task) self._record_task(task)
def playbook_on_setup(self): def playbook_on_setup(self):
self._display.display(tasktime()) self._display_tasktime()
def playbook_on_stats(self, stats): def playbook_on_stats(self, stats):
self._display.display(tasktime()) self._display_tasktime()
self._display.display(filled("", fchar="=")) self._display.display(filled("", fchar="="))
timestamp(self) timestamp(self)

View file

@ -356,6 +356,7 @@ def main():
specified_zones = module.params['zones'] specified_zones = module.params['zones']
collect_zones = list(set(specified_zones) & set(all_zones)) collect_zones = list(set(specified_zones) & set(all_zones))
ignore_zones = list(set(specified_zones) - set(collect_zones)) ignore_zones = list(set(specified_zones) - set(collect_zones))
if ignore_zones:
warn.append( warn.append(
'Please note: zone:(%s) have been ignored in the gathering process.' % ','.join(ignore_zones)) 'Please note: zone:(%s) have been ignored in the gathering process.' % ','.join(ignore_zones))
else: else:

View file

@ -831,7 +831,7 @@ def main():
# handle mount on boot. To avoid mount option conflicts, if 'noauto' # handle mount on boot. To avoid mount option conflicts, if 'noauto'
# specified in 'opts', mount module will ignore 'boot'. # specified in 'opts', mount module will ignore 'boot'.
opts = args['opts'].split(',') opts = args['opts'].split(',')
if 'noauto' in opts: if module.params['boot'] and 'noauto' in opts:
args['warnings'].append("Ignore the 'boot' due to 'opts' contains 'noauto'.") args['warnings'].append("Ignore the 'boot' due to 'opts' contains 'noauto'.")
elif not module.params['boot']: elif not module.params['boot']:
args['boot'] = 'no' args['boot'] = 'no'