[PATCH v3 1/2] kconfig: add KDEVOPS_ANSIBLE_VERBOSE option for persistent verbosity

Daniel Gomez <[email protected]> Mon, 01 Dec 2025 23:06:31 +0100
Newsgroups dev.linux.lists.kdevops
Message-ID <[email protected]>
From: Daniel Gomez <[email protected]>

Add a new Kconfig option to set the default Ansible verbosity level
for all playbook runs. This promotes Ansible verbosity from a
command-line-only option (AV=N) to a first-class configuration
setting, similar to KDEVOPS_MAKE_VERBOSE for make output.

The option accepts values 0-6 corresponding to Ansible's verbosity
levels. Level 1 is particularly useful for CI environments using the
coming lucid callback plugin, as it shows all tasks including ok and
skipped, plus executed commands and full stdout/stderr output.

Command line override support maintains proper priority where CLI
AV=N takes precedence over the Kconfig setting, which in turn takes
precedence over the default of 0.

Generated-by: Claude AI
Signed-off-by: Daniel Gomez <[email protected]>
---
 kconfigs/Kconfig.kdevops | 25 +++++++++++++++++++++++++
 scripts/ansible.Makefile | 10 ++++++++++
 2 files changed, 35 insertions(+)

diff --git a/kconfigs/Kconfig.kdevops b/kconfigs/Kconfig.kdevops
index 68e91193..e5963f45 100644
--- a/kconfigs/Kconfig.kdevops
+++ b/kconfigs/Kconfig.kdevops
@@ -95,6 +95,31 @@ config KDEVOPS_MAKE_VERBOSE
 
 	  If unsure, say N.
 
+config KDEVOPS_ANSIBLE_VERBOSE
+	int "Ansible verbosity level (AV=0-6)"
+	range 0 6
+	default 0
+	help
+	  Set the default Ansible verbosity level for all playbook runs.
+	  This is equivalent to running 'make AV=N' where N is the level.
+
+	  Verbosity levels:
+	  - 0: Normal output (default)
+	  - 1: Verbose (-v) - shows task results and commands
+	  - 2: More verbose (-vv) - adds task configuration
+	  - 3: Debug (-vvv) - adds connection debugging
+	  - 4-6: Increasingly detailed connection debugging
+
+	  For the lucid callback plugin, level 1 shows all tasks including
+	  ok and skipped, plus executed commands and full stdout/stderr.
+	  This is recommended for CI environments where console output
+	  serves as the primary log.
+
+	  You can still override this setting on the command line with
+	  'make AV=N' for any specific invocation.
+
+	  If unsure, leave at 0.
+
 config KDEVOPS_BASELINE_AND_DEV_SET_BY_CLI
 	bool
 	output yaml
diff --git a/scripts/ansible.Makefile b/scripts/ansible.Makefile
index 0ce8168f..c8cbaf3a 100644
--- a/scripts/ansible.Makefile
+++ b/scripts/ansible.Makefile
@@ -1,5 +1,15 @@
 # SPDX-License-Identifier: copyleft-next-0.3.1
 
+# Parse kconfig ansible verbosity setting, allow CLI to override
+# Priority: CLI AV=N > Kconfig CONFIG_KDEVOPS_ANSIBLE_VERBOSE > default 0
+ifneq (,$(wildcard .config))
+ifneq ($(CONFIG_KDEVOPS_ANSIBLE_VERBOSE),)
+ifneq ($(CONFIG_KDEVOPS_ANSIBLE_VERBOSE),0)
+AV ?= $(CONFIG_KDEVOPS_ANSIBLE_VERBOSE)
+endif
+endif
+endif
+
 AV ?= 0
 export ANSIBLE_VERBOSE := $(shell scripts/validate_av.py --av "$(AV)")
 

-- 
2.52.0