简体   繁体   中英

How to install centos packages in puppet?

I setup a class in my site.pp

class packages {
    Package { ensure => 'installed' }
    package { 'python-devel': }
    package { 'blas-devel': }
    package { 'lapack-devel': }
}

but nothing seems to be happening? when i run

pip install scipy

I still get that Python.h cannot be compiled so I take it python devel didn't install

You have defined class ' packages ', but you do not show that class being assigned to any node. That's like writing a function but never calling it.

You need to declare that class to assign it to specific nodes or to all nodes (depending on the context of the declaration). There are a few different forms for that, but about the simplest thing you could do would be to add ...

include 'packages'

... on the line after the closing brace of your class definition.

The result will still be in rather poor form, as classes should be defined in modules, not in site.pp , and declarations rarely should appear at top scope (outside any node block, class definition, or type definition), but it will instruct Puppet that when it runs, it should ensure that the packages you specify are installed.

Actually, the way you wrote the code for the modules doesn't look right. I would try something more like the following

class 'my-python' {
  package {'python-devel':
     ensure => installed,
  }
  package {'lapack-devel':
     ensure => installed,
  }
  package {'python-devel':
     ensure => installed,
  }
}

you define each of the packages within the class as seperate package resources. Then you need to 'include mypython' in your site.pp for the node you want to install them on. Run puppet and you should be good.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM