Ask Your Question
0

Roles/Profiles

asked 2018-09-03 07:20:30 -0600

dmccabe7 gravatar image

updated 2018-11-06 08:18:50 -0600

Hi, I am trying to get roles/profiles working for the first time, so any guidance is appreciated

Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Function Call, Could not find class ::role::{::role} for testpuppet.mydomain.com (file: /etc/puppetlabs/code/environments/production/manifests/site.pp, line: 3, column: 3) on node testpuppet.techlabs.accenture.com Warning: Not using cache on failed catalog Error: Could not retrieve catalog; skipping run

-

/etc/puppetlabs/code/environments/production/hiera.html

--
version: 5
defaults:


hierarchy:
  - name: "Per-node data (yaml version)"
    path: "nodes/%{::trusted.certname}"
  - name: "Per-node roles (yaml version)"
    path: "roles/%{::role}}"
  - name: "Common and fallback data"
    path: "common.yaml"

defaults:
  data_hash: yaml_data

/etc/puppetlabs/code/environments/production/manifests/site.pp

node default {
 if $::role {
  #include "role::{::web}"
   include "role::{::role}"


 } else {
  include profile::base
  notify { "Node ${::fqdn} has no role set.": }
 }
}

/etc/puppetlabs/code/environments/production/modules/roles/default.pp

#role/manifests/default.pp
class role::default {
 include profile::base
}

/etc/puppetlabs/code/environments/production/modules/profile/manifests/web.pp

#role/manifests/web.pp
class role::web {
 include profile::base
 include profile::lamp
}

[root@testpuppet ~]# facter -p role
web
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2018-09-12 05:25:05 -0600

jesse gravatar image

The include function call in your site.pp looks to be the problem:

node default { 
  if $::role {
    include "role::{::web}"

Instead try:

node default { 
  if $::role {
    include "role::${::role}"
edit flag offensive delete link more

Comments

Hi, I just updated my code above in line with this. Still getting the same error. any thoughts?. Thanks

dmccabe7 gravatar imagedmccabe7 ( 2018-11-06 08:19:33 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2018-09-03 07:20:30 -0600

Seen: 426 times

Last updated: Nov 06