From 9ad55755274b35acd6409fc8e47da6407f176cb5 Mon Sep 17 00:00:00 2001 From: Thomas Boerger Date: Fri, 15 May 2020 00:03:35 +0200 Subject: [PATCH] Move all important flags to the top --- plugin.go | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/plugin.go b/plugin.go index 8191e5c..0c52eac 100644 --- a/plugin.go +++ b/plugin.go @@ -245,6 +245,22 @@ func (p *Plugin) ansibleCommand(inventory string) *exec.Cmd { inventory, } + if len(p.Config.ModulePath) > 0 { + args = append(args, "--module-path", strings.Join(p.Config.ModulePath, ":")) + } + + if p.Config.VaultID != "" { + args = append(args, "--vault-id", p.Config.VaultID) + } + + if p.Config.VaultPasswordFile != "" { + args = append(args, "--vault-password-file", p.Config.VaultPasswordFile) + } + + for _, v := range p.Config.ExtraVars { + args = append(args, "--extra-vars", v) + } + if p.Config.ListHosts { args = append(args, "--list-hosts") args = append(args, p.Config.Playbooks...) @@ -255,14 +271,6 @@ func (p *Plugin) ansibleCommand(inventory string) *exec.Cmd { ) } - if p.Config.VaultID != "" { - args = append(args, "--vault-id", p.Config.VaultID) - } - - if p.Config.VaultPasswordFile != "" { - args = append(args, "--vault-password-file", p.Config.VaultPasswordFile) - } - if p.Config.SyntaxCheck { args = append(args, "--syntax-check") args = append(args, p.Config.Playbooks...) @@ -273,10 +281,6 @@ func (p *Plugin) ansibleCommand(inventory string) *exec.Cmd { ) } - for _, v := range p.Config.ExtraVars { - args = append(args, "--extra-vars", v) - } - if p.Config.Check { args = append(args, "--check") } @@ -309,10 +313,6 @@ func (p *Plugin) ansibleCommand(inventory string) *exec.Cmd { args = append(args, "--list-tasks") } - if len(p.Config.ModulePath) > 0 { - args = append(args, "--module-path", strings.Join(p.Config.ModulePath, ":")) - } - if p.Config.SkipTags != "" { args = append(args, "--skip-tags", p.Config.SkipTags) }