Default profile or role

46 views
Skip to first unread message

Ugo Bellavance

unread,
Oct 18, 2016, 1:58:18 PM10/18/16
to Puppet Users
Hi,

Is there an equivalent of the default node definition when using profiles and roles?

Thanks,

Peter Kristolaitis

unread,
Oct 18, 2016, 2:04:53 PM10/18/16
to puppet...@googlegroups.com
There is no magic involved in roles and profiles -- they're just classes that get assigned to nodes based on the node's definition.

Thus, if you want a default role assigned to the default node definition... then assign that default role to the default node definition.
--
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/7a443246-ab0f-4872-943f-66780adff83c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Matthew Nicholson

unread,
Oct 18, 2016, 2:09:34 PM10/18/16
to puppet...@googlegroups.com
Yeah, agreed, my default node looks like:
node default {
  $role=hiera('role')
  include $role
}

and the  lowest priority/default-est part of my hiera hierarchy has role: role::base. other actually classified things get role set at various parts of the hierarchy as needed. 


Ugo Bellavance

unread,
Oct 18, 2016, 2:33:04 PM10/18/16
to Puppet Users
So if my default node looks like this:

node default {
    class { 'sudo': }

    sudo::conf { 'wheel':
      content  => '%wheel  ALL=(ALL)       ALL',
  }

    sudo::conf { 'defaults_mail_always':
      content  => 'Defaults    mail_always',
  }
}

Do I simply insert include profile::base in there to add what's in this profile?

Thanks,

Ugo

Rob Nelson

unread,
Oct 18, 2016, 5:43:07 PM10/18/16
to puppet...@googlegroups.com
Ugo,

That is one way to do it. However, to use the roles and profiles pattern fully, you would `include role::base` there, which would include your base profile classes. Additionally, you would move the sudo statements into a profile class so that the include role is the ONLY line in the default node block. 

With that in mind, Matt's hiera include pattern is more dynamic and means you only need one node definition - the default - and a robust hiera/ENC setup. You would want to transition to something like that eventually. 
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/d57c4923-ec7c-40a4-93db-e401bdf68e4b%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.


--

Reply all
Reply to author
Forward
0 new messages