Quantcast
Channel: Ask Puppet: Puppet DevOps Q&A Community - RSS feed
Viewing all articles
Browse latest Browse all 257

How to call hiera in a class definition?

$
0
0
I am facing an issue in calling a hiera key with in a class.. I am playing with hiera to learn how it works and so the idea is to create set of users and groups. My class looks like the following. class musers ( $users = hiera("in_users", $groups = hiera("in_groups")) { create_resources(user, $users) create_resources(group, $groups) } where in_users and in_groups are the key holding the value and my hiera data looks like the following. --- in_users: user1: ensure: present home: /home/in/user1 managehome: true shell: /bin/bash uid: 10001 gid: 10001 password: $1$bM0KFO/z$usCU/t3/NiaL2YBRkoSTM. user2: ensure: present home: /home/in/user2 managehome: true shell: /bin/bash uid: 10002 gid: 10002 password: $1$bM0KFO/z$usCU/t3/NiaL2YBRkoSTM. in_groups: graphics: ensure: present gid: 601 hardwares: ensure: present gid: 602 coreadmin: ensure: present gid: 603 Issue:- I have assigned the musers class to the agent via PE Console and did 'puppet agent --test' and it is giving out the following error. [root@agent1 ~]# puppet agent --test Info: Using configured environment 'production' Info: Retrieving pluginfacts Info: Retrieving plugin Info: Loading facts Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Syntax error at '{' at /etc/puppetlabs/code/environments/production/modules/musers/manifests/init.pp:4:1 on node agent Warning: Not using cache on failed catalog Error: Could not retrieve catalog; skipping run

Viewing all articles
Browse latest Browse all 257

Trending Articles