Skip to content
This repository has been archived by the owner on Dec 16, 2021. It is now read-only.
/ ansible-role-sudo Public archive

[READ-ONLY] Ansible role dealing with the setup of Sudo

Notifications You must be signed in to change notification settings

manala/ansible-role-sudo

Repository files navigation

#######################################################################################################

❗ DEPRECATION ❗

This repository and the role associated are deprecated in favor of the Manala Ansible Collection

You will find informations on its usage on the collection repository

#######################################################################################################

Ansible Role: Sudo Build Status

Report issues and send Pull Requests in the main Ansible Role repository

This role will deal with the setup of Sudo.

It's part of the Manala Ansible stack but can be used as a stand alone component.

Requirements

None.

Dependencies

None.

Installation

Ansible 2+

Using ansible galaxy cli:

ansible-galaxy install manala.sudo

Using ansible galaxy requirements file:

- src: manala.sudo

Role Handlers

Name Type Description
sudo restart Service Restart sudo service

Role Variables

Definition

Name Default Type Description
manala_sudo_install_packages ~ Boolean Dependency packages to install
manala_sudo_install_packages_default ['sudo'] Boolean Default dependency packages to install
manala_sudo_sudoers_exclusive false Boolean Sudoers files exclusivity
manala_sudo_sudoers_dir '/etc/sudoers.d' String Sudoers files directory path
manala_sudo_sudoers_defaults {} Array Sudoers files defaults
manala_sudo_sudoers [] Array Sudoers files directives

Example

- hosts: all
  vars:
    manala_sudo_sudoers:
      # Template based (file name based on template)
      - template: sudo/app.j2
      # Template based (force file name)
      - file: template
        template: sudo/app.j2
      # Content based
      - file: content
        config: |
          user ALL=NOPASSWD:ALL
      # Config based (deprecated)
      - file: config
        config:
          - vagrant: ALL=NOPASSWD:ALL
      # Ensure sudoer is absent
      - file: absent
        state: absent # "present" by default
      # Ignore sudoer
      - file: ignore
        state: ignore
      # Flatten sudoers
      - "{{ my_custom_sudoers_array }}"
  roles:
    - role: manala.sudo

Exclusivity (all sudoers non defined by role will be deleted)

manala_sudo_sudoers_exclusive: true

Licence

MIT

Author information

Manala (http://www.manala.io/)