Feature #2408
It should be possible to assign a definition to a node in an external nodes tool
| Status: | Accepted | Start date: | 07/13/2009 | |
|---|---|---|---|---|
| Priority: | High | Due date: | ||
| Assignee: | % Done: | 0% |
||
| Category: | - | |||
| Target version: | 3.X | |||
| Affected Puppet version: | 0.24.8 | Branch: | ||
| Keywords: | ||||
| Votes: | 6 |
Description
Until now, only classes/modules and parameters can be assigned to nodes in an external nodes tool.
It would be very useful to be able to assign a definition, such as:
node ws1 inherits webserver {
apache::vhost{"www.example.com"}
}
to a node using yaml. The only other way to do now, seems to be writing wrapper classes.
Thanks,
Pieter.
History
Updated by James Turnbull almost 3 years ago
- Status changed from Unreviewed to Needs Decision
- Assignee set to Luke Kanies
Updated by Luke Kanies about 2 years ago
- Status changed from Needs Decision to Accepted
- Target version set to 2.6.0
Updated by Jesse Wolfe almost 2 years ago
- Target version changed from 2.6.0 to 52
Updated by Jeff McCune over 1 year ago
A request for this feature recently came up [1] on the puppet-users mailing list.
Updated by Luke Kanies over 1 year ago
- Assignee deleted (
Luke Kanies) - Priority changed from Normal to High
- Target version changed from 52 to 2.7.x
Updated by Nigel Kersten about 1 year ago
- Target version changed from 2.7.x to 3.X
Updated by Raffael Schmid 8 months ago
This is a blocker for our puppet roll out. Do you know in which release this will be done? Is there a way we could help?
Updated by Nigel Kersten 8 months ago
We don’t have a clear plan for directly adding resources from an ENC, so working on defining that plan would be a huge help :)
It’s a reasonably large behavior change to make an ENC now support adding resources directly (including their parameters) rather than just saying what classes should be added.
Note the workaround is to pass node parameters for use with classes that use those parameters to instantiate the resources. It’s at least one too many abstraction layers… but does work :(
Updated by Nigel Kersten 8 months ago
- Status changed from Accepted to Needs More Information
Updated by Raffael Schmid 8 months ago
I thought about this when taking a shower this morning. From a sysadmin point of view, it would be the easiest if we could provide a yaml which looks like:
classes:
common:
apt:
resources:
- "add local repo":
type: "apt::repo"
ensure: present
content: "deb localrepo.magpie.lan/ubuntu lucid vendor"
- "touch restart.txt":
type: "exec"
user: "root"
command: "touch /var/www/rails/tmp/restart.txt"
unless: "/var/www/rails/tmp/restart.txt"
require:
- file: "/var/www/"
- file: "/var/www/rails"
This would evaluate to something like this:
irb> pp YAML.load(File.open("/tmp/l"))
{"resources"=>
[{"type"=>"apt::repo",
"content"=>"deb localrepo.magpie.lan/ubuntu lucid vendor",
"ensure"=>"present",
"add local repo"=>nil},
{"command"=>"touch /var/www/rails/tmp/restart.txt",
"type"=>"exec",
"require"=>[{"file"=>"/var/www/"}, {"file"=>"/var/www/rails"}],
"unless"=>"/var/www/rails/tmp/restart.txt",
"user"=>"root",
"touch restart.txt"=>nil}],
"classes"=>{"common"=>nil, "apt"=>nil}}
Is this something you meant? Or did you mean something else by “helping to define a plan”? :)
Updated by Nigel Kersten 8 months ago
No, that’s a great start. Would you like to take this to the puppet-users list for comment?
Although it’s possible to put naked resources into site.pp at the top level, we’ve generally been moving away from that as a community towards classes/modules for everything, and this does modify that somewhat.
To be clear, I’m not opposed to this, it fits reasonably well, I just haven’t convinced myself that we’ve considered all the aspects :)
Updated by Sean Millichamp 8 months ago
Nigel Kersten wrote:
Although it’s possible to put naked resources into site.pp at the top level, we’ve generally been moving away from that as a community towards classes/modules for everything, and this does modify that somewhat.
I’m aware of this direction, but I’m not convinced it reasonably covered all use-cases. Maybe it does and I haven’t been thinking about it the right way but there are some cases where it feels like parameterized classes are awkward.
In our environment every server we deploy in Puppet has multiple network interfaces (at least two, but variable in type and quantity) and we use Puppet to deploy the network interfaces configurations. In this case, on RHEL so /etc/sysconfig/network-scripts/ifcfg-ethX style files. In each node stanza we use a definition to instantiate these network configs, something like:
intf::eth { 'eth0': ip => '192.168.1.10/24' }
intf::eth { 'eth1': ip => '10.2.2.2/24' }
In this case we could probably implement something via a hash, but sometimes the definitions get quite a bit more complex, with entries for 802.1q tagged VLAN interfaces, bonding interfaces, etc. Under the hood the defines make sure the files get created from templates as needed and according to our best practices.
We use similar definitions for iproute2 routes and rules.
Given that those resources are variable in type and quantity per-node it seems like definitions at the node level is the most elegant way of handling it.
The lack of definition/resource support in ENCs are preventing our use of an ENC and the changed scoping rules in 2.7 require us to use an ENC to implement things we have working in 2.6. Right now we are stuck between these two problems.
Updated by Nigel Kersten 8 months ago
- Status changed from Needs More Information to Accepted
- Assignee set to Nigel Kersten
I’m convinced. I’d still like to see some discussion on the user list about this though.
Updated by Raffael Schmid 8 months ago
Cool. I created now a thread called “Definitions in a external node classifier”. It’s waiting to be approved by a moderator.
Updated by Raffael Schmid 8 months ago
- Assignee deleted (
Nigel Kersten)
It looks like there are no additions from the ml. How do we want to proceed?
Updated by Raffael Schmid 8 months ago
- Assignee set to Nigel Kersten
sorry, didn’t want to remove the assignment…
Updated by Raffael Schmid 7 months ago
- Target version set to 3.X
yeah, better not remove the target version (don’t ask my why it removes good settings when i update the case…)