From bb976ddfe0e00700c8041eae054e7ce4d2cc904f Mon Sep 17 00:00:00 2001 From: Romeo Theriault Date: Fri, 16 Nov 2012 16:05:16 -1000 Subject: [PATCH] add solaris subclass to group module --- library/group | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/library/group b/library/group index 0e7ecb07e2d..8a9c893500a 100755 --- a/library/group +++ b/library/group @@ -142,6 +142,31 @@ class Group(object): # =========================================== +class SunOS(Group): + """ + This is a SunOS Group manipulation class. Solaris doesnt have + the 'system' group concept. + + This overrides the following methods from the generic class:- + - group_add() + """ + + platform = 'SunOS' + distribution = None + GROUPFILE = '/etc/group' + + def group_add(self, **kwargs): + cmd = [self.module.get_bin_path('groupadd', True)] + for key in kwargs: + if key == 'gid' and kwargs[key] is not None: + cmd.append('-g') + cmd.append(kwargs[key]) + cmd.append(self.name) + return self.execute_command(cmd) + + +# =========================================== + def main(): module = AnsibleModule( argument_spec = dict(