realize virtual definition ?

837 views
Skip to first unread message

tehcook

unread,
Jun 22, 2010, 8:32:44 PM6/22/10
to Puppet Users
Hi

New to the puppet. I'm trying to make a user management module
"users", which has one definition and a bunch of classes. Here is my
structure under $modulepath :

users/manifests/classes/evergent.pp
users/manifests/classes/admins.pp
users/manifests/classes/list.pp
users/manifests/classes/outside.pp
users/manifests/classes/dbas.pp
users/manifests/defines/account.pp
users/manifests/init.pp

Definition is :

define users::account($realname, $userid, $password) {
....
}

It creates user, group, $HOME, adds user's public ssh key and chown -R
his whole $HOME

Then there is a class users::list that has all users like this :

@users::account { "root":
realname => "Root user",
userid => "1000",
password => "xxxxxxxxxxx",
}

The idea is that all users are defined as a "virtual definition" and
will be realized later.

Now there is class users:admins that has all sysadmins :

class users::admins {
realize Users::Account["root"]
}

Then in site.pp I import my "users" module :

import "users"

and in one of the nodes I include sysadmins :

node "host1.test.com" inherits "default" {
include users::admins
}

Now when I run puppetd -o -t -v on that node I get error :

err: Could not retrieve catalog from remote server: Error 400 on
SERVER: Failed to realize virtual resources Users::Account[root] on
node host1.test.com

Do I do something not supported by the puppet ? I understand everyone
suggests making virtual resource user and then realize them in the
class. But I want add some thing like chown -R $HOME, ssh keys and
more. Can I use virtual definition same way as virtual resources ?
What am I doing wrong ? Any pointers to something similar would help a
lot. I've checked "Pulling strings with Puppet" book but it does not
show any example of the virtual definitions like this.

Thanks

Joe McDonagh

unread,
Jun 23, 2010, 9:38:51 AM6/23/10
to puppet...@googlegroups.com
Is that just an example or are you actually trying to make an account
named root with uid 1000?

--
--
Joe McDonagh
Operations Engineer
AIM: YoosingYoonickz
IRC: joe-mac on freenode
"When the going gets weird, the weird turn pro."

sergei

unread,
Jun 23, 2010, 12:59:11 PM6/23/10
to puppet...@googlegroups.com
Yes of course this is just to use some anonymous username.

I figured out what went wrong. This had to do something with wrapping
my define and virtual resources in class {}

> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To post to this group, send email to puppet...@googlegroups.com.
> To unsubscribe from this group, send email to
> puppet-users...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/puppet-users?hl=en.
>
>

tehcook

unread,
Jun 23, 2010, 12:52:28 PM6/23/10
to Puppet Users
Of course this is just to replace real usernames with something
anynymous.
I actually figured out what was wrong - this was about putting
"classname::" in front of some things and wrapping define in class {}.
Had to tear apart whole thing and make a simple test module.
Reply all
Reply to author
Forward
0 new messages