Ask Your Question
0

How to Use Puppet python module in manifest file

asked 2016-02-23 09:26:04 -0500

bobby320 gravatar image

Hello,

I am writing a puppet manifest file to install python and pymongo. This python module is installed on the server, link shown below https://forge.puppetlabs.com/stankevi...

Here is the manifest file I created. But it say unknown class and resource . Please suggest what wrong in the syntax.

class { 'python' :
  version           => 'system',
  pip               => 'present'
}

  python::pip { 'pymongo' :
    pkgname         => 'pymongo',
    ensure          => '2.7',
  }

It says Unknown class: 'python and Unknown resource type: 'python::pip'

edit retag flag offensive close merge delete

Comments

It's not a problem with your syntax, it's your puppet code setup. Please edit your answer and provide the filesystem locations of the module and the code that calls it, and how you are calling puppet.

lavaman gravatar imagelavaman ( 2016-02-23 13:42:27 -0500 )edit

Thanks, I am new to puppet. Can you please suggest how to provide filesystem locations of the module in the manifest file ?

bobby320 gravatar imagebobby320 ( 2016-02-24 11:01:00 -0500 )edit

You installed them. Where did you put them? It differs depending on version and open-source vs enterprise.

lavaman gravatar imagelavaman ( 2016-02-24 13:59:25 -0500 )edit

It is installed under this location /etc/puppetlabs/puppet/modules .

bobby320 gravatar imagebobby320 ( 2016-02-24 14:53:16 -0500 )edit

Whats the file name of your script and whats the full path all the way to it? Puppet has strict requirements regarding naming. If your class is called python, then the directory needs to be named python as well. Also, your main class should be in a file named init.pp.

UBPClaw gravatar imageUBPClaw ( 2016-02-24 17:34:54 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2016-02-25 11:07:33 -0500

UBPClaw gravatar image

First off, Puppet has requirements around the naming of modules and the directory structure. You can read about that here

So if your class is called python the directory structure needs to match that. So make sure your path to your manifest is /etc/puppetlabs/puppet/modules/python/manifests/init.pp

Next, the python::pip is not a valid resource so Puppet doesnt know how to interpret that. A better solution would be to change that to a package resource.

package { 'pymongo' :
 ensure      => '2.7',}
edit flag offensive delete link more

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

Stats

Asked: 2016-02-23 09:26:04 -0500

Seen: 654 times

Last updated: Feb 25 '16