1it.sudo

Ansible Role: Sudoers

This role makes it easy to manage sudoers.

Requirements


  • Ansible version 2.3.0 or later.

Installation


Run the following command to install the role:

ansible-galaxy install 1it.sudo

Variables

Here’s how to specify sudoers commands and settings:

sudo_nopasswd_group: 'admin' # Default group that must be created first
sudo_set_custom_commands: yes # If not set, a basic configuration will be used (from templates/etc_sudoers)
sudo_commands_services:
    - /usr/sbin/service nginx reload
    - /usr/sbin/service elasticsearch restart
    - /usr/sbin/service redis-server restart
sudo_commands_main:
    - /sbin/iptables
    - /bin/netstat
    - /usr/bin/supervisorctl
sudo_commands_misc:
    - /usr/sbin/php5dismod
    - /usr/sbin/php5enmod
sudo_custom_definitions:
    - user ALL=(ALL) NOPASSWD: /usr/sbin/nginx
    - editor ALL=(www-data) NOPASSWD: /usr/bin/vim
sudo_set_per_user: # This creates a sudoers file in /etc/sudoers.d/user_name that allows NOPASSWD for all commands.
    - alice
    - bob

Playbook Example

Here’s how to use the role in a playbook:

---
- hosts: all
  roles:
    - 1it.sudo
Informazioni sul progetto

Ansible role for managing sudoers

Installa
ansible-galaxy install 1it.sudo
Licenza
mit
Download
440
Proprietario
Site Reliability Engineer