@@ -67,6 +67,14 @@ Maintainers List
first. When adding to this list, please keep the entries in
alphabetical order.
+ANSIBLE WRAPPER
+M: Daniel Gomez <da.gomez@samsung.com>
+L: kdevops@lists.linux.dev
+S: Maintained
+T: git https://github.com/linux-kdevops/kdevops.git
+F: scripts/ansible_av.py
+F: scripts/ansible.Makefile
+
GITREF
M: Daniel Gomez <da.gomez@samsung.com>
L: kdevops@lists.linux.dev
@@ -46,10 +46,6 @@ export Q=@
export NQ=echo
endif
-ifneq ($(findstring 2, $(V)),)
- export ANSIBLE_VERBOSE := '-vvv'
-endif
-
include Makefile.min_deps
DEFAULT_DEPS += $(KDEVOPS_DEPCHECK)
@@ -62,6 +58,8 @@ ANSIBLE_EXTRA_ARGS_SEPARATED :=
ANSIBLE_EXTRA_ARGS_DIRECT :=
include Makefile.extra_vars
+include scripts/ansible.Makefile
+
LIMIT_HOSTS :=
ifneq (,$(HOSTS))
LIMIT_HOSTS := '-l $(subst ${space},$(comma),$(HOSTS))'
new file mode 100644
@@ -0,0 +1,4 @@
+# SPDX-License-Identifier: copyleft-next-0.3.1
+
+AV ?= 0
+export ANSIBLE_VERBOSE := $(shell scripts/validate_av.py --av "$(AV)")
@@ -70,6 +70,10 @@ help:
@echo "allnoconfig - disables all bells and whistles"
@echo "randconfig - random configuration"
@echo "defconfig-* - If you have files in the defconfig directory use default config from there"
+ @echo
+ @echo "Variable options:"
+ @echo "make V=n [targets] 1: verbose build (Makefile)"
+ @echo "make AV=n [targets] 0-6: verbose build (Ansible)"
.PHONY: clean
clean:
new file mode 100755
@@ -0,0 +1,28 @@
+#!/usr/bin/env python3
+# SPDX-License-Identifier: copyleft-next-0.3.1
+
+import argparse
+
+
+def get_ansible_verbosity(av: str, max_level: int = 6) -> str:
+ """Return Ansible verbosity flag (e.g. -vv or emtpy)."""
+ try:
+ av = int(av)
+ except ValueError:
+ return ""
+ av = max(0, min(av, max_level))
+ return "-" + "v" * av if av > 0 else ""
+
+
+def main():
+ parser = argparse.ArgumentParser(
+ description="Validate and return Ansible verbosity level."
+ )
+ parser.add_argument("--av", type=str, default="0", help="Verbosity level (0-6)")
+
+ args = parser.parse_args()
+ print(get_ansible_verbosity(args.av))
+
+
+if __name__ == "__main__":
+ main()
Ansible verbosity is controlled via V=2 parameter/value. This however has a limited configuration as it hardcodes the output of the -v, --verbose command of ansible-playbook to level 3 (-vvv). Drop support for V=2 mode in favor of AV=<number> where <number> indicates the level of verbosity from 0 (empty string) to max 6 (-vvvvvv). Add a helper script in python to handle the new AV parameter. This makes it easier to check for corner cases. Also, restore verbosity help from commit 6539f3f ("Merge commit '6539f3f6b5cf1393cb63f9ad9aac51877f088734'") and adapt V=2 to the new AV= parameter. Add a maintainer entry for this new Ansible wrapper. A reason to add a specific entry here is to extend the new ansible.Makefile with all Ansible calls across kdevops and make it easier to maintain in the long term. Signed-off-by: Daniel Gomez <da.gomez@samsung.com> --- MAINTAINERS | 8 ++++++++ Makefile | 6 ++---- scripts/ansible.Makefile | 4 ++++ scripts/kconfig/Makefile | 4 ++++ scripts/validate_av.py | 28 ++++++++++++++++++++++++++++ 5 files changed, 46 insertions(+), 4 deletions(-)