add ability to enable verbose logging
This commit is contained in:
@@ -56,19 +56,26 @@ func CopyK8SAdminConfig(pathInDataDir string) {
|
||||
}
|
||||
|
||||
func runPlaybook(playbookPath string, tags string) {
|
||||
config := config.GetConfig()
|
||||
var callbackExecute execute.Executor
|
||||
|
||||
playbookOptions := getPlaybookParameters(tags)
|
||||
playbookCmd := playbook.NewAnsiblePlaybookCmd(
|
||||
playbook.WithPlaybooks(playbookPath),
|
||||
playbook.WithPlaybookOptions(&playbookOptions),
|
||||
)
|
||||
exec := stdoutcallback.NewDebugStdoutCallbackExecute(
|
||||
execute.NewDefaultExecute(
|
||||
execute.WithCmd(playbookCmd),
|
||||
execute.WithErrorEnrich(playbook.NewAnsiblePlaybookErrorEnrich()),
|
||||
),
|
||||
execute := execute.NewDefaultExecute(
|
||||
execute.WithCmd(playbookCmd),
|
||||
execute.WithErrorEnrich(playbook.NewAnsiblePlaybookErrorEnrich()),
|
||||
)
|
||||
|
||||
err := exec.Execute(context.Background())
|
||||
if config.Verbose {
|
||||
callbackExecute = stdoutcallback.NewDebugStdoutCallbackExecute(execute)
|
||||
} else {
|
||||
callbackExecute = stdoutcallback.NewDenseStdoutCallbackExecute(execute)
|
||||
}
|
||||
|
||||
err := callbackExecute.Execute(context.Background())
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user