add ability to log to file, update to v2.28.1 and fix 'first upgrade' issue

This commit is contained in:
2025-09-13 00:49:05 +03:00
parent d51a98efb3
commit 4f38f3a851
35 changed files with 773 additions and 543 deletions

View File

@@ -2,6 +2,7 @@ package kubespray
import (
"context"
"fmt"
"kube-forge/internal/config"
"kube-forge/internal/logging"
"kube-forge/internal/python"
@@ -44,9 +45,9 @@ func runPlaybook(playbookPath string, tags string) {
execute.WithExecutable(epExec),
)
if config.Verbose {
if config.Verbose > 0 {
envVars["ANSIBLE_STDOUT_CALLBACK"] = "unixy"
envVars["ANSIBLE_VERBOSITY"] = "3"
envVars["ANSIBLE_VERBOSITY"] = fmt.Sprintf("%d", config.Verbose)
envVars["ANSIBLE_DISPLAY_SKIPPED_HOSTS"] = "true"
envVars["ANSIBLE_DISPLAY_OK_HOSTS"] = "true"
} else {
@@ -58,6 +59,9 @@ func runPlaybook(playbookPath string, tags string) {
envVars["ANSIBLE_HOST_PATTERN_MISMATCH"] = "ignore"
envVars["ANSIBLE_SYSTEM_WARNINGS"] = "false"
}
if config.LogFile != "" {
envVars["ANSIBLE_LOG_PATH"] = config.LogFile
}
callbackExecute = stdoutcallback.NewDefaultStdoutCallbackExecute(execute)