Hi,

Being a newbie, I'm trying to wrap my head around puppet. Here are my
first stumbling blocks:

We have an output from a database which is essentially a list of users
that we want to manage in the uid 2001-2999 range:

* No other users may be present in that range (puppet should delete them)
* Users outside that range must not be touched
* The user names change, but their uids will remain constant

So say that we start with no users in the 2001-2999 range and we have
this list of users in the range

peter (uid = 2001)
henrik (uid = 2002)
fred (uid = 2003)
barney (uid = 2004)

Creating/adding them is trivial based on http://docs.puppetlabs.com/learning/.

But now say that the new desired configuration driven by the databases is:

martin (uid = 2002)
barney (uid = 2003)
fred (uid = 2004)
sally (uid = 2005)

How do I achieve this:
* Get puppet to discover that peter (uid = 2001) must be deleted
* Get puppet to rename henrik->martin (trivial rename)
* Get puppet to rename fred->barney and barney->fred (complicated
rename) A third temporary username will be necessary, I guess, so that
it really becomes fred->tmp, barney->fred, tmp->barney, because
otherwise an attempt will be made to have non-unique users
temporarily. This necessary temporary user name doesn't swing well
with the declarative nature of puppet, I'm guessing.

I know exactly how to achieve these things in a shell script, but I
want to use puppet. I realize I'm going to have to have the database
output converted into either facts or manifests. I guess that
pre-processing could also identify users to be deleted, and even users
to be renamed. But the two-step rename I don't know how to even model
given the declarative nature of puppet.

Is it possible to write "myuser" so that all the above is done with just:

myuser { 2002:
    name => 'martin',
}
myuser { 2003:
    name => 'barney',
}
myuser { 2004:
    name => 'fred',
}
myuser { 2005:
    name => 'sally',
}

First step for a newbie is to ask the right questions. Am I even
asking the right questions? Does this make sense to anyone? Should I
just do this in a shell/perl script instead? What is it about this
task, that makes it unsuited for puppet?

Thanks for reading this far,
Peter

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

Reply via email to