timdev / ansible-sudo

Ansible role which installs and configures sudo

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ansible franklinkim.sudo role

Build Status Ansible Role GitHub Tags Github Releases GitHub Tags

GitHub stars

franklinkim.sudo is an Ansible role which:

  • installs sudo
  • configures sudo

Installation

Using ansible-galaxy:

$ ansible-galaxy install franklinkim.sudo

Using requirements.yml:

- src: franklinkim.sudo

Using git:

$ git clone https://github.com/weareinteractive/ansible-sudo.git franklinkim.sudo

Dependencies

  • Ansible >= 1.9

Variables

Here is a list of all the default variables for this role, which are also available in defaults/main.yml.

---
# sudo_defaults:
#  - defaults: env_reset
#  - name: user1
#    defaults: requiretty
# sudo_users:
#  - name: '%group1'
#  - name: 'bar'
#    nopasswd: yes
#  - name: '%group2'
#    commands: '/bin/ls'
#

# package name (version)
sudo_package: sudo
# list of username or %groupname
sudo_users: []
# list of username or %groupname and their defaults
sudo_defaults: []

Usage

This is an example playbook:

---

- hosts: all
  sudo: yes
  roles:
    - franklinkim.sudo
  vars:
    sudo_defaults:
      - defaults: env_reset
      - defaults: secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
      - name: 'user1'
        defaults: 'requiretty'
      - name: '%group1'
        defaults: '!requiretty'
    sudo_users:
      - name: 'user1'
      - name: 'user2'
        nopasswd: yes
      - name: '%group1'
        hosts: 127.0.0.1
      - name: '%group2'
        commands: '/bin/ls'
      - name: '%group3'
        users: 'user1,user2'

Testing

$ git clone https://github.com/weareinteractive/ansible-sudo.git
$ cd ansible-sudo
$ vagrant up

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests and examples for any new or changed functionality.

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes according to these guidelines (git commit -am 'feat: add new feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Note: To update the README.md file please install and run ansible-role:

$ gem install ansible-role
$ ansible-role docgen

License

Copyright (c) We Are Interactive under the MIT license.

About

Ansible role which installs and configures sudo

License:MIT License


Languages

Language:Shell 100.0%