Hi all,

I'm relatively new to both Puppet and Augeas. I'm currently stuck
trying to figure out how to manage hosts' netgroup entries in /etc/
passwd. I've got it working to ensure a single specified netgroup is
the only one in /etc/passwd:

class ldap {
    define netgroups {
        augeas { "netgroups":
            context => "/files/etc/passwd",
            changes => [
                "rm @nis",
                "set @nis[1] $name",
            ],
        }
    }
}

In my nodes.pp:

node host1 {
    ldap::netgroups { "admins": }
}

I'd like to generalize this so I can list multiple netgroups, e.g.:

node host1 {
    ldap::netgroups { "admins dbas devs": }
}

I've been hunting around looking for similar concepts and I've come
somewhat close using split() with a variable recipe name, e.g.:

class ldap {
    $netgroups = split($name, " ")
    $context = "/files/etc/passwd"

    augeas { "cleanup-netgroups":
        context => $context,
        changes => "rm @nis",
    }

    augeas { $netgroups:
        context => $context,
        changes => [
            "set @nis[last()+1] $name",
        ],
    }
}

though I'm running into an ordering problem here.

Am I even on the right path here or is there a better approach to this
sort of problem?

Thanks,
Justin

-- 
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