diff --git a/src/main/groovy/com/rundeck/plugins/ansible/ansible/InventoryList.java b/src/main/groovy/com/rundeck/plugins/ansible/ansible/InventoryList.java index f0f83d7..4de139c 100644 --- a/src/main/groovy/com/rundeck/plugins/ansible/ansible/InventoryList.java +++ b/src/main/groovy/com/rundeck/plugins/ansible/ansible/InventoryList.java @@ -100,11 +100,10 @@ public void handle(NodeEntryImpl node, Map tags) throws Resource }, USERNAME { @Override - public void handle(NodeEntryImpl node, Map tags) throws ResourceModelSourceException { + public void handle(NodeEntryImpl node, Map tags) { final List usernames = List.of("username", "ansible_user", "ansible_ssh_user", "ansible_user_id"); String nameTag = InventoryList.findTag(usernames, tags); - node.setUsername(Optional.ofNullable(nameTag) - .orElseThrow(() -> new ResourceModelSourceException(format(ERROR_MISSING_TAG, usernames)))); + Optional.ofNullable(nameTag).ifPresent(node::setUsername); } }, OS_FAMILY {