diff --git a/src/main/groovy/com/rundeck/plugins/ansible/plugin/AnsibleResourceModelSource.java b/src/main/groovy/com/rundeck/plugins/ansible/plugin/AnsibleResourceModelSource.java index 3d1ca592..e622237b 100644 --- a/src/main/groovy/com/rundeck/plugins/ansible/plugin/AnsibleResourceModelSource.java +++ b/src/main/groovy/com/rundeck/plugins/ansible/plugin/AnsibleResourceModelSource.java @@ -347,7 +347,7 @@ public INodeSet getNodes() throws ResourceModelSourceException { } else { StringBuilder sb = new StringBuilder(); - if (root.has("ansible_distribution")) { + if (root.has("ansible_distribution") && !root.get("ansible_distribution").isJsonNull()) { sb.append(root.get("ansible_distribution").getAsString()).append(" "); } if (root.has("ansible_distribution_version")) { @@ -366,7 +366,7 @@ public INodeSet getNodes() throws ResourceModelSourceException { node.setOsFamily(root.get("ansible_os_family").getAsString()); } - if (root.has("ansible_os_name")) { + if (root.has("ansible_os_name") && !root.get("ansible_os_name").isJsonNull()) { node.setOsName(root.get("ansible_os_name").getAsString()); }