Is there a way to force puppet to do certain things first? For instance, I need it to install an RPM on all servers to add a yum repository (IUS Community) before I install any of the packages.
|
|
If you want to make sure a repository is installed on all your server then I would suggest something like this
Then, for any node that extends
This will ensure that
|
|||||||||||||||
|
|
You could use Tags. This would allow you to tag the repo installer with then run
and it would only execute the modules/statements matching the tag. |
|||
|
|
|
Although stages can handle this and so can specific yum repo dependencies, better is to declare the relationship generically. Just put
This makes it so that all yumrepo types will get processed before any packages that don't have 'rpm' as their provider. That latter exclusion is so that I can use the (for example) epel-release RPM package to help install the yum repo. |
|||
|
|
|
(I found this question after I replied almost the same.. so thought my answer applies here as well and it's worth repeating it (it's safer to have an answer in two places..) As far as I understand, this is exactly what stages are for -- they let you group and order class executions. I use "stages" to update and configure APT at Debian servers, which should be very similar to what you are going to do with YUM. First of all, you declare "yum" stage at top level (above "nodes"), so that classes in "yum" stage will be executed before "main" ones:
Then, you assign stage to the classes. You can do this right in your node definition:
|
|||
|
|
The key thing you need to use is the require keyword - "Evaluate one or more classes, adding the required class as a dependency." An example using an apt repository could be:
(Adapted from this example of puppet bootstrapping). So you can see how each stage requires that the previous one be done first. I'll leave you to work out how to apply this to yum as I'm not familiar with where it stores it's files. |
|||
|
|
|
Puppet reads the config from top to bottom, so if you include a class with the yum repo first in that class, this repo will be added before anything else. If you use the require settings on a package, you will ensure that the required resource type is present before adding the package, as such:
This code above will add the repo before adding the package. |
|||||
|
|
That's weird. Puppet make a song and dance about being so much better than cfengine at ordering operations. When I look at the puppet site, it looks like if you want to "make puppet do certain things" you have to start programming in ruby, otherwise it is completely uncertain what it will do. This solution seems pretty clunky compared to cf's bundlesequence. My money's still on cfengine 3 I have to say. |
|||||||||||
|