-1

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.

Oyabi
  • 824
  • 3
  • 10
  • 27

1 Answers1

1

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).

John Bollinger
  • 160,171
  • 8
  • 81
  • 157
  • Oh it's really simple, thank you very much ! Have you an idea for userparameters ? Can i do something like that zabbix::agent::userparameters:source: '...' ? – Oyabi Dec 04 '14 at 15:47
  • 1
    You can create your own class to wrap a declaration of a `zabbix::userparameters`. You can give that class whatever parameters it needs, and declare it and its parameters via hiera. Note, however, that the point of `zabbix::userparameters` being a resource type instead of a class should be to enable nodes to declare more than one. Thus, although the strategy I describe should work from a Puppet perspective, I cannot speak to whether it is actually the right thing to do for your nodes. – John Bollinger Dec 04 '14 at 15:57
  • Ok i gonna try that tomorrow. I have a last question. I have write a puppet module (not publish). His init.p begin like `class testasterisk($host_patton = undef, ...`. But when i set parameter in my hiera file with `testasterisk::host_patton: '192.168.1.1'` it doesn't seems to work. I use host_patton variable in a template with `<%= @host_patton %>` and it's perfectly work when I only use puppet. Have you an idea ? Thank you very much for your precious help =) – Oyabi Dec 04 '14 at 16:47
  • 1
    Your description of your module layout, hiera data, and template appear correct. If the data are in fact in a file that Hiera will consult for the node in question, and if there is no higher-priority data file in the picture, then I have to conclude that your description is mistaken. Possibly the data file contains a typo in the `tecfaxbox::host_patton` key. Alternatively, if there is also a `tecfaxbox::texfaxbox` class then under certain circumstances you might be confused about which one you are actually declaring. – John Bollinger Dec 04 '14 at 16:59
  • regarding `zabbix::agent::userparameters:source:`, it should be `zabbix::userparameters::source:` – BMW Dec 08 '14 at 23:12
  • @BMW, No. `zabbix::userparameters` is a defined type, not a class. You cannot (automatically) bind parameter values to it via hiera. You can *manually* call hiera to get values for its parameters, but in that case the keys can be anything. – John Bollinger Dec 09 '14 at 17:06