Ask Your Question

puppet rundeck integration issue

asked 2015-10-30 08:12:24 -0500

rajeevsharma gravatar image


I want to use rundeck as my orchestration and calling "puppet resource vspherevm ..." using a rundeck job. I am not getting why it is not able to recognize vshperevm in rundeck? Either case it is not working.

  1. puppet resource vsphere_vm

Error: Could not run: Could not find type vsphere_vm 18:35:51 Remote command failed with exit status 1 18:35:51 Failed: NonZeroResultCode: Remote command failed with exit status 1

  1. puppet apply /tmp/myvm.pp --noop

Error: Evaluation Error: Error while evaluating a Resource Statement, Invalid resource type vsphere_vm at /tmp/myvm.pp:1:1 on node ip-xx-xx-xx-xx.ec2.internal 18:25:25 Remote command failed with exit status 1 18:25:25 Failed: NonZeroResultCode: Remote command failed with exit status 1

I am running above commands from Rundeck using sudo user. It works when I run "Puppet help". There is something wrong with puppet resource options.

Please help. Thanks.

edit retag flag offensive close merge delete


What is the effective uid of the user executing the Rundeck job? Is it the root user?

GregLarkin gravatar imageGregLarkin ( 2015-10-30 14:35:29 -0500 )edit

Hi Greg, That's a sudo user and ssh keys are configured between rundeck and puppet server. Though that sudo user is able to execute command "puppet help" but not "puppet resource vsphere_vm ...." Error log transcript mentioned in the question.

rajeevsharma gravatar imagerajeevsharma ( 2015-11-01 01:52:48 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2015-11-03 03:44:35 -0500

rajeevsharma gravatar image

I have figured out a way using following steps:

  1. Comment following line in /etc/sudoers #Defaults requiretty
  2. Run puppet command with sudo in Rundeck job sudo /usr/local/bin/puppet resource vspherevm ensure="$ensure" name='"$vmname"' source='"$template"' sourcetype=template memory=$memory cpus=$cpus --debug"

Above will suffice to run successfully in following situations:

  1. Installation of vsphere module is done using sudo user.
  2. Rundeck node for puppet server is added using the same sudo user.

If puppet server node is a remote node to rundeck, add "AcceptEnv RD*" in sshdconfig file.

This helps. Thanks.

edit flag offensive delete link more


Excellent, good to hear it!

GregLarkin gravatar imageGregLarkin ( 2015-11-03 16:38:40 -0500 )edit

answered 2015-11-01 23:12:37 -0500

GregLarkin gravatar image

Is the sudo user the root user? You need to run the "puppet apply" command as the root user if you have installed the module as the root user.

If your sudo user is not the root user, then you need to install the module as that user. The module will be installed in different places depending on the user running the "puppet module install" command.

edit flag offensive delete link more


Yes. I have "sadmin" user which is: sadmin ALL=(ALL) NOPASSWD: ALL. Using sadmin I switch to "sudo su -" and installed puppet server and modules etc. From rundeck, sadmin is not able to execute cmd directly neither root(don't have direct root access)

rajeevsharma gravatar imagerajeevsharma ( 2015-11-02 02:35:16 -0500 )edit

Please run the following command as both the root user and as the sadmin user: "puppet module list --tree" and post a link to a pastebin of the output.

GregLarkin gravatar imageGregLarkin ( 2015-11-02 10:04:23 -0500 )edit

Only following 3 lines are missing for sadmin: 1. /etc/puppetlabs/code/environments/production/modules 2. puppetlabs-vsphere (v1.1.0) 3. /etc/puppetlabs/code/modules (no modules installed) --- /opt/puppetlabs/puppet/modules and PE installed modules are common for both.

rajeevsharma gravatar imagerajeevsharma ( 2015-11-02 12:54:23 -0500 )edit

Ok, so as the sadmin user, run "puppet module install puppetlabs/vsphere". That user must have the module installed into its own modulepath if you are running puppet as that user.

GregLarkin gravatar imageGregLarkin ( 2015-11-02 13:01:44 -0500 )edit

Hi Greg, without installing this module again for sadmin. I am able to make it using: sudo su -c "puppet resource vsphere_vm ...." from tty and to make it from rundeck I followed these 2 steps: 1. #Defaults requiretty (commented in sudoer file) 2. sudo "puppet resource vsphere_vm .." This worked.

rajeevsharma gravatar imagerajeevsharma ( 2015-11-02 13:31:17 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2015-10-30 08:12:24 -0500

Seen: 418 times

Last updated: Nov 03 '15