Skip to content
This repository has been archived by the owner on Apr 13, 2022. It is now read-only.

Commit

Permalink
Added support for custom ssh ports
Browse files Browse the repository at this point in the history
  • Loading branch information
feldsam authored Oct 30, 2019
1 parent 63fb385 commit 4863c1a
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions one-inv
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@ function getAll(callback) {

// save host and its user template vars
hosts[hostname] = vm.USER_TEMPLATE;

// set custom ssh port from VM USER_TEMPLATE var SSH_PORT
sshPort = getSshPort(vm);
if (sshPort) {
hosts[hostname]["ansible_port"] = sshPort;
}
}
}
}
Expand Down Expand Up @@ -118,6 +124,14 @@ function getHostName(vm) {
return vm.NAME;
}

function getSshPort(vm) {
if (vm.USER_TEMPLATE["SSH_PORT"] !== "undefined") {
return vm.USER_TEMPLATE["SSH_PORT"];
}

return false;
}

function getVMIp(vm) {
var nic = vm.TEMPLATE.NIC;

Expand Down

0 comments on commit 4863c1a

Please sign in to comment.