Any thoughts on this?Best,Matt
--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/c1157f75-5a08-4e13-8739-abef8bd23cf4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
I work with Matt and am filling in for him since I posed this question to him originally.Our confusion really lies around how you layout profiles for a multi-function box. For example, suppose you have a role, "CMS App Server" that will host various CMS like Wordpress, Drupal, and others. They are all built on top of the same technologies, Apache, PHP, and MySQL. I don't believe you can build a separate profile for each CMS b/c they will conflict (at least within Puppet). Each will require a certain set of php modules and settings, apache modules and settings, etc. So do you build a single profile like profile::wordpress_drupal_cms3_cm4 or do you build a profile::apachefpm profile? The later seems more logical to me however you lose the ability to define profile specific hiera variables b/c profile::apachefpm is generic.
On Friday, May 16, 2014 10:55:35 AM UTC-5, Jesse Cotton wrote:I work with Matt and am filling in for him since I posed this question to him originally.Our confusion really lies around how you layout profiles for a multi-function box. For example, suppose you have a role, "CMS App Server" that will host various CMS like Wordpress, Drupal, and others. They are all built on top of the same technologies, Apache, PHP, and MySQL. I don't believe you can build a separate profile for each CMS b/c they will conflict (at least within Puppet). Each will require a certain set of php modules and settings, apache modules and settings, etc. So do you build a single profile like profile::wordpress_drupal_cms3_cm4 or do you build a profile::apachefpm profile? The later seems more logical to me however you lose the ability to define profile specific hiera variables b/c profile::apachefpm is generic.
You can declare the same class multiple times, provided that you use the 'include' function or its cousins to do so. That is a tremendously useful technique for managing configurations where multiple facilities share requirements on some of the same core resources. Using 'include' instead of resource-like class declarations means you must feed data to your classes via hiera instead of via your manifests, but separating your data from your manifests is good practice anyway. That's what Christopher Wood was pointing you toward, and it is good advice.
It is thus possible to find and/or write composable classes and modules for managing the components you want. As David Schmitt observes, composability is not automatic, but I don't see why your particular case of an apache-based PHP app server with firewall rules and a specific collection of PHP and apache modules should present any special problem.
Thus, the answer to your question is "neither." You build a drupal profile, and a wordpress profile, etc., and you use them all together.
John
We're aware of most of this and agree with most of this. However when you always call include, you lose the ability to say a particular hiera variable is attached to the profile. For exampleIf you define:class profile::apache_phpfpm {include ::apache}with the following in hiera:apache::keepalive = 1keepalive = 1 applies anywhere apache is includedvsclass profile::apache_phpfpm ($keepalive = 1) {class { ::apache:keepalive => $keepalive}}profile::apache_phpfpm::keepalive = 1
You could do global variables, but you couldn't one set the hierarchy to the profile level? Thus you isolate variables in preference to the profile, rather than a global mismash. Stick with parametrization for now if this works, refactor later after getting it working, as you'll have a functional base state.
We're aware of most of this and agree with most of this. However when you always call include, you lose the ability to say a particular hiera variable is attached to the profile. For exampleIf you define:class profile::apache_phpfpm {include ::apache}with the following in hiera:apache::keepalive = 1keepalive = 1 applies anywhere apache is includedvsclass profile::apache_phpfpm ($keepalive = 1) {class { ::apache:keepalive => $keepalive}}profile::apache_phpfpm::keepalive = 1
I am not sure about this... Personally, I get scared of having too many sub-classes beyond install.pp, config.pp, service.pp, etc. It might make those files verbose, but then it is easier to contain and debug. Afterwards, parts into separate pieces, if this helps.
Is cron a separate class? Personally, I put my bottom level modules into their product role, which may require cron functionality. I avoid crafting classes based on their functionality, as this would be the same as having a class called package that accepts an array packages to be installed. It gets hard to identify what is involved in installing a product or scheduling cleanup tasks for the same product; the code to implement a particular product gets scattered across many files, rather than self-contained in one module.
On Monday, May 19, 2014 10:18:11 AM UTC-4, jcbollinger wrote:
On Friday, May 16, 2014 10:55:35 AM UTC-5, Jesse Cotton wrote:I work with Matt and am filling in for him since I posed this question to him originally.Our confusion really lies around how you layout profiles for a multi-function box. For example, suppose you have a role, "CMS App Server" that will host various CMS like Wordpress, Drupal, and others. They are all built on top of the same technologies, Apache, PHP, and MySQL. I don't believe you can build a separate profile for each CMS b/c they will conflict (at least within Puppet). Each will require a certain set of php modules and settings, apache modules and settings, etc. So do you build a single profile like profile::wordpress_drupal_cms3_cm4 or do you build a profile::apachefpm profile? The later seems more logical to me however you lose the ability to define profile specific hiera variables b/c profile::apachefpm is generic.
You can declare the same class multiple times, provided that you use the 'include' function or its cousins to do so. That is a tremendously useful technique for managing configurations where multiple facilities share requirements on some of the same core resources. Using 'include' instead of resource-like class declarations means you must feed data to your classes via hiera instead of via your manifests, but separating your data from your manifests is good practice anyway. That's what Christopher Wood was pointing you toward, and it is good advice.We're aware of most of this and agree with most of this. However when you always call include, you lose the ability to say a particular hiera variable is attached to the profile. For exampleIf you define:class profile::apache_phpfpm {include ::apache}with the following in hiera:apache::keepalive = 1keepalive = 1 applies anywhere apache is includedvsclass profile::apache_phpfpm ($keepalive = 1) {class { ::apache:keepalive => $keepalive}}profile::apache_phpfpm::keepalive = 1So with the later you can build a somewhat self-contained profile. With the former you have to set variables "globally" or on a node.
We're aware of most of this and agree with most of this. However when you always call include, you lose the ability to say a particular hiera variable is attached to the profile. For exampleIf you define:class profile::apache_phpfpm {include ::apache}with the following in hiera:apache::keepalive = 1keepalive = 1 applies anywhere apache is includedvsclass profile::apache_phpfpm ($keepalive = 1) {class { ::apache:keepalive => $keepalive}}profile::apache_phpfpm::keepalive = 1So with the later you can build a somewhat self-contained profile. With the former you have to set variables "globally" or on a node.
That is what your data hierarchy is for. Hiera does not limit you to only global and per-node data. You can define as many hierarchy levels as you need, each grouping your nodes in its own way (though it usually makes the most sense for the groups at each level to be subsets of the groups at the next lower level).
And the foregoing is based on using only the built-in YAML back end. Hiera supports pluggable back ends, usable together or separately. A custom back end can employ whatever lookup or computation you want to serve whichever data you choose.
Duplicate declaration: Apache::Listen[80] is already declared in file ...
Yes, the class could be broken into separate classes but this only exacerbates the issue of assigning variables based on the profile.
John
Understood. However without creating a custom fact, I am not aware of a way to say 'apache::keepalive = 1' only applies when a node has the profile 'profile::apache_phpfpm'.
And the foregoing is based on using only the built-in YAML back end. Hiera supports pluggable back ends, usable together or separately. A custom back end can employ whatever lookup or computation you want to serve whichever data you choose.We're really trying to avoid this.
Yes, the class could be broken into separate classes but this only exacerbates the issue of assigning variables based on the profile.
But that's just it: you don't want to assign data based (strictly) on profile. Or if you do, then understand that it is inherently inconsistent with composable profiles. Since the node characteristic that determines the combination of profiles in use is its role, it is on that basis that you want to assign data. Indeed, that's what you already said with respect to apache::keepalive. Note that with hiera, that doesn't mean you must avoid assigning data based on profile; it just means you must (also) be able to assign data based on role, with the role-based data having higher priority.