VMware Cloud Community
future2000
Enthusiast
Enthusiast

'Run SSH Command' vRO Workflow - not passing through environment

Hi,

I've developed a vRO workflow which runs a Puppet Task unfortunately when this is running through the vRO 'Run SSH command' workflow the Puppet Task is not executed correctly and requests credentials, these already exist in the format of a token in the puppet users SSH profile.

When running the command via SSH manually from a session logged in as the exact same user the command runs without issue.

Is their something different about the way the 'Run a SSH command'. workflow functions in vRO. Is it perhaps that the users environment is not read when it makes a connection. Is their a way to do this so that the puppet task command I am trying to run is aware of the token. Unfortunately their is no way to specify the token with the command I am running.

Cheers

0 Kudos
3 Replies
daphnissov
Immortal
Immortal

I'm not clear if you're trying to do this exclusively in vRO or if it's something that you're doing through vRA.

0 Kudos
future2000
Enthusiast
Enthusiast

Hi,

The usual extensibility properties object is being passed from vRA to vRO for this workflow so than we can extract the provisioned systems name. The puppet task is used to remove the computer account from active directory. This is something that cannot be done easily with the AD plugin due to some complexities regarding our network architecture.

I did manage to specify the puppet task token with the command but unfortunately something particular to the way the ssh plugin operates means the command run on the host doesn't work in the same way it would do when you were logged in locally.

Cheers

0 Kudos
iiliev
VMware Employee
VMware Employee

Hi,

Try to modify the workflow 'Run SSH Command' (eg. by duplicating it) and add the line

session.pty = true;

immediately after the new session object is created at the beginning in the first scriptable task item. This should request allocation of pseudo-terminal for the session. I think this should expose the environment variables to the SSH channel.

There is also SSHSession#addEnvironment() scripting method to manually add environment variables if needed.

0 Kudos