users-are-members-of-group
Example:
# Add user 'freckles' to group 'wheel'. - users-are-members-of-group: user: freckles group: wheel
Description
Ensures a list of users are all members of a certain group.
Variables
Name | Type | Default | Description |
---|---|---|---|
|
string | -- | The name of the group. Required |
|
list | -- | A list of usernames. Required |
Examples
Example 1
Add user 'freckles' to group 'wheel'.
Code
- users-are-members-of-group: user: freckles group: wheel
Code
doc: short_help: Ensures a list of users are all members of a certain group. examples: - title: Add user 'freckles' to group 'wheel'. vars: user: freckles group: wheel args: users: doc: short_help: A list of usernames. type: list schema: type: string required: true cli: param_decls: - --user - -u group: doc: short_help: The name of the group. type: string required: true cli: param_decls: - --group - -g frecklets: - users-exist: names: '{{:: users ::}}' - group-exists: group: '{{:: group ::}}' - frecklet: name: user type: ansible-module properties: elevated: true idempotent: true internet: false desc: short: "Ensure users are members of group '{{:: group ::}}': {{:: users | join(',\ \ ') ::}}" task: become: true loop: '{{:: users ::}}' loop_control: loop_var: __user__ vars: name: '{{ __user__ }}' groups: - '{{:: group ::}}' append: true
frecklecute users-are-members-of-group --help Usage: frecklecute users-are-members-of-group [OPTIONS] Ensures a list of users are all members of a certain group. Options: -g, --group GROUP The name of the group. [required] -u, --user USERS A list of usernames. [required] --help Show this message and exit.
# -*- coding: utf-8 -*- # # module path: pycklets.users_are_members_of_group.UsersAreMembersOfGroup # from dataclasses import dataclass from pyckles import AutoPycklet from typing import * # noqa @dataclass class UsersAreMembersOfGroup(AutoPycklet): """Ensures a list of users are all members of a certain group. Args: group: The name of the group. users: A list of usernames. """ FRECKLET_ID = "users-are-members-of-group" group: str = None users: List = None def __post_init__(self): super(UsersAreMembersOfGroup, self).__init__(var_names=["group", "users"]) frecklet_class = UsersAreMembersOfGroup
# -*- coding: utf-8 -*- # # module path: pycklets.users_are_members_of_group.UsersAreMembersOfGroup # from pyckles import AutoPycklet class UsersAreMembersOfGroup(AutoPycklet): """Ensures a list of users are all members of a certain group. Args: group: The name of the group. users: A list of usernames. """ FRECKLET_ID = "users-are-members-of-group" def __init__(self, group=None, users=None): super(UsersAreMembersOfGroup, self).__init__(var_names=["group", "users"]) self._group = group self._users = users @property def group(self): return self._group @group.setter def group(self, group): self._group = group @property def users(self): return self._users @users.setter def users(self, users): self._users = users frecklet_class = UsersAreMembersOfGroup