Ask Your Question
0

classes defined in hiera and Must pass

asked 2015-06-03 05:03:05 -0500

deftones gravatar image

updated 2015-06-03 08:32:20 -0500

csharpsteen gravatar image

Hello

I want to include all my classes in hiera file but when I do one of my modules failes with

Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Must pass my_users to Class[Users] at /etc/puppet/manifests/site.pp:2 on node

This only happens when I "include" in hiera, if i include in site.pp it works. Here is my module:

class users (
  $my_users,
  $my_ssh_keys,
  $my_groups,
){

$user_defaults = {
  ensure         => present,
  purge_ssh_keys => true,
  managehome     => true,
  provider       => 'useradd',
  shell          => '/bin/bash',
  groups         => 'sudo',
}

$group_defaults = {
  ensure => present,
}

$ssh_authorized_key_defaults = {
  ensure => present,
  type   => 'ssh-rsa',
}

  create_resources(user, $my_users, $user_defaults)
  create_resources(ssh_authorized_key, $my_ssh_keys, $ssh_authorized_key_defaults)
  create_resources(group, $my_groups, $group_defaults)
}

and hiera file:

classes:
    - users
---
users::my_users:
    zenon3:
        home: /home/zenon3
        uid: 1023
        gid: 1023
        password: testtest
users::my_groups:
    zenon3:
        gid: 1023
users::my_ssh_keys:
    zenon3:
        user: zenon3
        key: testtest

I probably miss some basics ...

For better reading u can go to:

http://pastebin.com/YxmCM2RJ

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2015-08-28 15:44:24 -0500

kayn gravatar image

Try define users with default values:

class users (
  $my_users = undef,
  $my_ssh_keys = undef,
  $my_groups = undef,
){
edit flag offensive delete link more

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: 2015-06-03 04:59:31 -0500

Seen: 1,317 times

Last updated: Jun 03 '15