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

Process vault flags prior to syntax check flag

This commit is contained in:
Will Hegedus 2020-04-08 14:26:07 -04:00
parent 91e0749965
commit 5d47351d10

View File

@ -245,8 +245,8 @@ func (p *Plugin) ansibleCommand(inventory string) *exec.Cmd {
inventory,
}
if p.Config.SyntaxCheck {
args = append(args, "--syntax-check")
if p.Config.ListHosts {
args = append(args, "--list-hosts")
args = append(args, p.Config.Playbooks...)
return exec.Command(
@ -255,8 +255,16 @@ func (p *Plugin) ansibleCommand(inventory string) *exec.Cmd {
)
}
if p.Config.ListHosts {
args = append(args, "--list-hosts")
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...)
return exec.Command(
@ -317,14 +325,6 @@ func (p *Plugin) ansibleCommand(inventory string) *exec.Cmd {
args = append(args, "--tags", p.Config.Tags)
}
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.PrivateKeyFile != "" {
args = append(args, "--private-key", p.Config.PrivateKeyFile)
}