Search code examples
puppetserversystem-administrationhiera

Hiera, default site.pp and error could not find class


I have a server who was running puppet and hiera and, for the moment, 1 client. I want to manage all my nodes with hiera config files so I only put this in /etc/puppet/manifests/site.pp :

hiera_include(classes, '')

In my file /etc/puppet/hieradata/common :

---
classes:
  - "common_test"
  - fw_test
  - zabbix::agent

    zabbix::agent:zabbix_version : '2.2'
    zabbix::agent:server: 192.168.1.1
    zabbix::agent:serveractive: '192.168.1.1'
    zabbix::agent:hostname: 'Test_puppet'
    zabbix::agent:manage_firewall: true

With this configuration my parameters (192.168.1.1, true, Test_puppet, etc.) are not set on my client.

Second question, when I add zabbix::userparameters in my class list I have this error Could not find class zabbix::userparameters for... But this class exist (I use this package https://forge.puppetlabs.com/wdijkerman/zabbix)

I take this example but it's also does'nt work with others classes for the parameters error. Best regards.


Solution

  • Your parameter keys are incorrect. For example, this ...

    zabbix::agent:zabbix_version : '2.2'

    ... should instead be ...

    zabbix::agent::zabbix_version: '2.2'

    . The main issue is one too few colons between zabbix::agent and zabbix_version. I don't think whitespace between the key and trailing colon matters, but it's more conventional to not have any.

    As for zabbix::userparameters, it is a (defined) resource type, not a class. You cannot include it (or hiera_include() it).