Jamie Wilkinson <[EMAIL PROTECTED]> writes:

>>user" and "cfengine manage users".
>
> For system users:
>
> groups:
>
>    user_X_exists = ( ReturnsZero(/bin/sh -c "/usr/bin/id -u X >& /dev/null")
> )
>
> shellcommands:
>
>    !user_X_exists.redhat::
>
>      "/usr/sbin/useradd -r -c X -s /sbin/nologin -d / -M -g nobody X
>
>    !user_X_exists.debian::
>
>      "/usr/sbin/adduser --system --gecos X --shell /bin/false --home /
> --no-create-home --disabled-login --disabled-password --group nobody X"

I'm having fun learning cfengine, here's a slightly different
way for kicks.

module:users
#!/bin/sh
  /usr/bin/getent passwd |\
    /usr/bin/awk -F: '{print "+user_" $1 "_exists"}' |\
     sed 's/-/_/g'


control:

AddInstallable  = ( user_user1_exists user_user2_exists )
actionsequence  = ( module:users shellcommands  )


shellcommands:

   !user_user1_exists.redhat::

     "/usr/sbin/useradd -r -c X -s /sbin/nologin -d / -M -g nobody X

...

It seems to work without addinstallable, but the docs say to use it, so
I do, otherwise there is a little less typing.

Now I got to work out where my in-reply-to header is.


_______________________________________________
Help-cfengine mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-cfengine

Reply via email to