passwordless-sudo-users

Example:

# Enable passwordless sudo for users 'freckles' and 'boingboing'.
- passwordless-sudo-users:
    users:
    - freckles
    - boingboing

Description

Ensure that one or more users can use passwordless sudo.

This also makes sure that the sudo package is installed (if not already available), and creates the user(s) (if not already present).

Resources

Variables

Name Type Default Description

users

list --

n/a Required

Examples

Example 1

Enable passwordless sudo for users 'freckles' and 'boingboing'.

Code
- passwordless-sudo-users:
    users:
    - freckles
    - boingboing

Code

doc:
  short_help: Grant passwordless sudo permission to a user.
  help: |
    Ensure that one or more users can use passwordless sudo.

    This also makes sure that the sudo package is installed (if not already available), and creates the user(s) (if not already present).

  references:
    "'freckfrackery.basic-security' Ansible role": https://gitlab.com/freckfrackery/freckfrackery.basic-security
  examples:
  - title: Enable passwordless sudo for users 'freckles' and 'boingboing'.
    vars:
      users:
      - freckles
      - boingboing

args:
  users:
    type: list
    required: true
    schema:
      type: string
    cli:
      nargs: -1
      param_type: argument
      metavar: USER

meta:
  tags:
  - user
  - user-management
  - system
  - sudo
  - passwordless-sudo

frecklets:

- task:
    loop: '{{:: users ::}}'
    include-type: include
    become: true
  frecklet:
    name: freckfrackery.basic-security
    type: ansible-role
    resources:
      ansible-role:
      - freckfrackery.basic-security
    desc:
      short: "grant passwordless sudo permssions to user(s): {{:: users | join(' ')\
        \ ::}}"
      references:
        "'freckfrackery.basic-security' Ansible role": https://gitlab.com/freckfrackery/freckfrackery.basic-security
      long: |
        Make sure the follwing users have sudo permissions and do not need to enter a passwrod when executing ``sudo``:

        {%:: for u in users ::%}
        - {{:: u ::}}
        {%:: endfor ::%}
    properties:
      elevated: true
      idempotent: true
      internet: false
  vars:
    basic_security_user_name: '{{ item }}'
    basic_security_enable_passwordless_sudo: true
frecklecute passwordless-sudo-users --help

Usage: frecklecute passwordless-sudo-users [OPTIONS] USER

  Ensure that one or more users can use passwordless sudo.

  This also makes sure that the sudo package is installed (if not already
  available), and creates the user(s) (if not already present).

Options:
  --help  Show this message and exit.
# -*- coding: utf-8 -*-


#
# module path: pycklets.passwordless_sudo_users.PasswordlessSudoUsers
#


from dataclasses import dataclass
from pyckles import AutoPycklet
from typing import *    # noqa

@dataclass
class PasswordlessSudoUsers(AutoPycklet):
    """Ensure that one or more users can use passwordless sudo.

     This also makes sure that the sudo package is installed (if not already available), and creates the user(s) (if not already present).

       Args:
         users: n/a

    """

    FRECKLET_ID = "passwordless-sudo-users"

    users: List = None


    def __post_init__(self):
        super(PasswordlessSudoUsers, self).__init__(var_names=["users"])


frecklet_class = PasswordlessSudoUsers
# -*- coding: utf-8 -*-


#
# module path: pycklets.passwordless_sudo_users.PasswordlessSudoUsers
#


from pyckles import AutoPycklet

class PasswordlessSudoUsers(AutoPycklet):
    """Ensure that one or more users can use passwordless sudo.

     This also makes sure that the sudo package is installed (if not already available), and creates the user(s) (if not already present).

       Args:
         users: n/a

    """

    FRECKLET_ID = "passwordless-sudo-users"

    def __init__(self, users=None):

        super(PasswordlessSudoUsers, self).__init__(var_names=["users"])
        self._users = users

    @property
    def users(self):
        return self._users

    @users.setter
    def users(self, users):
        self._users = users



frecklet_class = PasswordlessSudoUsers