Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -293,9 +293,21 @@ public INodeSet getNodes() throws ResourceModelSourceException {
System.out.println("[warn] Problem getting the ansible_host attribute from node " + hostname);
}

String port = root.get("inventory_hostname").getAsString();
try {
if (root.has("ansible_port")) {
port = root.get("ansible_port").getAsString();
} else { // fallback to default ssh port
port = "22";
}
}catch(Exception ex){
System.out.println("[warn] Problem getting the ansible_port attribute from node " + port);
}

String nodename = root.get("inventory_hostname").getAsString();
String hostname_with_port = hostname + ":" + port;

node.setHostname(hostname);
node.setHostname(hostname_with_port);
node.setNodename(nodename);

String username = System.getProperty("user.name"); // TODO better default?
Expand Down