ENC - how to set order of operations?

94 views
Skip to first unread message

Jon Yeargers

unread,
Feb 3, 2014, 10:13:28 AM2/3/14
to puppet...@googlegroups.com
I need to convert my resource based system to ENC. It's mostly straightforward but I'm not sure how to handle operations like these: 

Class['apt'] -> Package<| |>

José Luis Ledesma

unread,
Feb 3, 2014, 12:33:40 PM2/3/14
to puppet...@googlegroups.com

Hi

Perhaps  I'm confused but an ENC stores node definition and not collector nor dependencies...doesn't it?

Regards,

El 03/02/2014 16:13, "Jon Yeargers" <ethr...@gmail.com> escribió:
I need to convert my resource based system to ENC. It's mostly straightforward but I'm not sure how to handle operations like these: 

Class['apt'] -> Package<| |>

--
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/b6324c21-3725-480d-b2ab-33ee48577ba6%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Jon Yeargers

unread,
Feb 3, 2014, 12:45:53 PM2/3/14
to puppet...@googlegroups.com
Right. So how would I declare this dependency setup if I stop using node files?

José Luis Ledesma

unread,
Feb 3, 2014, 12:56:05 PM2/3/14
to puppet...@googlegroups.com

You could set up this on the package class for example, although I don't know the "best practices" what say about that.

Regards

Dan Bode

unread,
Feb 3, 2014, 1:14:52 PM2/3/14
to public puppet users
On Mon, Feb 3, 2014 at 9:45 AM, Jon Yeargers <ethr...@gmail.com> wrote:
Right. So how would I declare this dependency setup if I stop using node files?

Even if you use an ENC, Puppet will still consult your site manifest, so using an ENC does not preclude you from setting resource dependencies via collection in your site manifest.
 

Jon Yeargers

unread,
Feb 3, 2014, 1:51:30 PM2/3/14
to puppet...@googlegroups.com
So if a given node is named in both an ENC and the site manifest... it will use both? IE If I have some definitions that I want to send everywhere and others that are node specific.. I can use both types of node entries?

José Luis Ledesma

unread,
Feb 3, 2014, 1:54:03 PM2/3/14
to puppet...@googlegroups.com

Then just setup a class and include it on the ENC node definition.

Regards,

Jason Antman

unread,
Feb 4, 2014, 7:43:05 AM2/4/14
to puppet...@googlegroups.com
Jon,

I've been using ENCs for quite a while, and have never used them with site manifests (or any other manifests outside of modules). At the moment, when I do things like that, I either do them inside a class (i.e. put what you have in a wrapper class), or use "require" on all resource instances.

My plan in the near future, which AFAIK is at least close to best practice and is (at least in my opinion) the most elegant and "right" way to do this, the is to use run stages to handle all Package resources in a "setup" stage, and then add a stage before that that handles repository setup. Though this will probably also require a site.pp to setup the stage for all Package resources.

For more information on run stages, see:
- http://docs.puppetlabs.com/puppet/3/reference/lang_run_stages.html
- the default stages setup by puppetlabs-stdlib - https://github.com/puppetlabs/puppetlabs-stdlib/blob/master/manifests/stages.pp

-Jason

Jason Antman

unread,
Feb 4, 2014, 7:45:57 AM2/4/14
to puppet...@googlegroups.com
Disregard some of what I said. Sorry for the confusion. Stages can only be used on classes not individual resources, so that won't work as cleanly with forge modules (or anything that isn't specifically setup to use stages).

jcbollinger

unread,
Feb 4, 2014, 9:45:55 AM2/4/14
to puppet...@googlegroups.com


On Monday, February 3, 2014 9:13:28 AM UTC-6, JonY wrote:
I need to convert my resource based system to ENC.


That statement does not make sense.  You cannot do anything useful with Puppet without resources.

I suppose you may mean that you want to drop node blocks, in which you sometimes declare resources and resource collections, in favor of classifying nodes via an ENC.

 
It's mostly straightforward but I'm not sure how to handle operations like these: 

Class['apt'] -> Package<| |>


ENCs can feed only classes (with or without parameters) and top-scope variables to Puppet.  You therefore have two general ways forward:
  1. Do as you said, and drop all node blocks in favor of ENC classification.  In this case you need to wrap all resource and resource collection declarations in classes.  Your ENC then specifies the appropriate classes.
  2. Use node blocks together with ENC, and leave resource declarations in the node blocks.  In this case Puppet must be able to match a node block to every node, but that's not an onerous requirement because it can be satisfied trivially via an empty 'default' node block.  In this case, yes, Puppet will combine the ENC-specified and node-block-specified declarations for each node, and use them all.

John

Reply all
Reply to author
Forward
0 new messages