Ошибка Puppet enterprise при запуске puppet agent -t commnad, невозможно получить данные пользователя/группы от hieara

У меня на виртуальной машине установлено предприятие Puppet, работающее в Virtualbox.

Установка прошла нормально, но когда я пытаюсь запустить команду puppet agent -t, я получаю следующую ошибку:

[root@puppetmaster ~]# puppet agent -t
Info: Using configured environment 'production'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
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 data item role in any Hiera data file and no default supplied at /etc/puppetlabs/code/environments/production/manifests/site.pp:32:10 on node puppetmaster.localdomain
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run

Вот моя строка файла site.pp, откуда исходит ошибка;

## site.pp ##

# This file (/etc/puppetlabs/puppet/manifests/site.pp) is the main entry point
# used when an agent connects to a master and asks for an updated configuration.
#
# Global objects like filebuckets and resource defaults should go in this file,
# as should the default node definition. (The default node can be omitted
# if you use the console and don't define any other nodes in site.pp. See
# http://docs.puppetlabs.com/guides/language_guide.html#nodes for more on
# node definitions.)

## Active Configurations ##

# Disable filebucket by default for all File resources:
#http://docs.puppetlabs.com/pe/latest/release_notes.html#filebucket-resource-no-longer-created-by-default
File { backup => false }

# DEFAULT NODE
# Node definitions in this file are merged with node data from the console. See
# http://docs.puppetlabs.com/guides/language_guide.html#nodes for more on
# node definitions.

# The default node definition matches any node lacking a more specific node
# definition. If there are no other nodes in this file, classes declared here
# will be included in every node's catalog, *in addition* to any classes
# specified in the console for that node.

node default {
 # This is where you can declare classes for all nodes.
 # Example:
 #   class { 'my_class': }
 $role = hiera('role')
 $location = hiera('location')
 notify{"in the top level site.pp : role is '${role}', location is '${location}'": }
 include "::roles::${role}"
}

person Tdl Matias    schedule 28.12.2016    source источник
comment
Где-то в ваших иерархических данных должен быть ключ role со значением.   -  person Matt Schuchard    schedule 28.12.2016


Ответы (1)


Если вы посмотрите на ошибку, она не может найти ключ hiera, который вы запросили в своем site.pp:

Could not find data item role in any Hiera data file and no default supplied at /etc/puppetlabs/code/environments/production/manifests/site.pp:32:10 on node puppetmaster.localdomain

В вашем коде у вас есть следующее:

$role = hiera('role')
$location = hiera('location')

Оба они являются вызовами hiera, для которых требуется, чтобы hiera была настроена и соответствующий ключ находился в папке hieradata.

Полезным инструментом, помогающим диагностировать проблемы с иерархией, является hiera_explain, который показывает, как настроена иерархия иерархии и настроен и может помочь объяснить, в чем проблема с вашим кодом.

person Peter Souter    schedule 29.12.2016