diff --git a/src/main/groovy/com/rundeck/plugins/ansible/ansible/AnsibleInventoryList.java b/src/main/groovy/com/rundeck/plugins/ansible/ansible/AnsibleInventoryList.java index df75627..b36c4dd 100644 --- a/src/main/groovy/com/rundeck/plugins/ansible/ansible/AnsibleInventoryList.java +++ b/src/main/groovy/com/rundeck/plugins/ansible/ansible/AnsibleInventoryList.java @@ -117,6 +117,8 @@ public String getNodeList() throws IOException, AnsibleException { private void processAnsibleVault(List stdinVariables, List procArgs) throws IOException { + if (vaultPrompt == null) { return; } + if(ansibleVault == null){ tempInternalVaultFile = AnsibleVault.createVaultScriptAuth("ansible-script-vault"); ansibleVault = AnsibleVault.builder() @@ -125,20 +127,21 @@ private void processAnsibleVault(List stdinVariables, List .debug(debug).build(); } - if (vaultPrompt != null) { - stdinVariables.add(vaultPrompt); - tempVaultFile = ansibleVault.getVaultPasswordScriptFile(); - procArgs.add("--vault-id"); - procArgs.add(tempVaultFile.getAbsolutePath()); - } + stdinVariables.add(vaultPrompt); + tempVaultFile = ansibleVault.getVaultPasswordScriptFile(); + procArgs.add("--vault-id"); + procArgs.add(tempVaultFile.getAbsolutePath()); } private void processLimit(List procArgs) throws IOException { - if (limits != null && limits.size() == 1) { + + if (limits == null) { return; } + + if (limits.size() == 1) { procArgs.add("-l"); procArgs.add(limits.get(0)); - } else if (limits != null && limits.size() > 1) { + } else if (limits.size() > 1) { StringBuilder sb = new StringBuilder(); for (String limit : limits) { sb.append(limit).append("\n");