Skip to content

Instantly share code, notes, and snippets.

@sshastri
Created August 30, 2018 06:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sshastri/a491bf322de753d36430594be226eb55 to your computer and use it in GitHub Desktop.
Save sshastri/a491bf322de753d36430594be226eb55 to your computer and use it in GitHub Desktop.
# - Warning if pp_role not defined
# - Check to see if the role exists
# - Fall back to using the base profile
node default {
# Save the role fact into a local variable
$role = $facts['role']
case $role {
default: {
# Check if the role class has been defined.
# Include it if so. If not, include the base profile and a warning.
if defined($role) {
include $role
} else {
notify { "No matching role for ${role} found":
loglevel => 'warning',
}
include profile::base
}
}
undef, '': {
notify { "${trusted['certname']} does not have a role fact!":
loglevel => 'warning',
}
include profile::base
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment