0
0
mirror of https://github.com/thegeeklab/wp-ansible.git synced 2024-11-21 23:50:40 +00:00

Move all important flags to the top

This commit is contained in:
Thomas Boerger 2020-05-15 00:03:35 +02:00 committed by GitHub
parent 5d47351d10
commit 9ad5575527
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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)
}