Giter Club home page Giter Club logo

Comments (1)

ahuffman avatar ahuffman commented on June 12, 2024

The command alias and user alias always gets created in /etc/sudoers.
The specific specs get created in /etc/sudoers.d. In your specified configuration, you'll want to make some changes specifically to the sudoer_specs definiton:

sudoer_specs:
        - name: XPERM_AIX
          comment: aix permissions
          users: XAIX_STAFF
          hosts: ALL
          operators: XAIX_STAFF
          tags: NOPASSWD
          commands: XSU_ROOT
          defaults:
            - '!requiretty'

Produces /etc/sudoers.d/XPERM_AIX:

# Ansible managed

# aix permissions
Defaults:XAIX_STAFF !requiretty
XAIX_STAFF ALL=(XAIX_STAFF) NOPASSWD: XSU_ROOT

Another problem I see with your configuration is that you should have the following change for your command alias:

        command:
          - name:  XSU_ROOT
            comment: root stuff
            commands:
              - "/usr/bin/su -"
              - "/usr/bin/su - -c *"

This will produce an /etc/sudoers file like so:

# Ansible managed

Defaults    !visiblepw
Defaults    always_set_home
Defaults    env_reset
Defaults    env_keep = "COLORS DISPLAY HOSTNAME HISTSIZE INPUTRC"
Defaults    env_keep += "KDEDIR LS_COLORS MAIL PS1 PS2"
Defaults    env_keep += "QTDIR USERNAME LANG LC_ADDRESS LC_CTYPE"
Defaults    env_keep += "LC_COLLATE LC_IDENTIFICATION LC_MEASUREMENT LC_MESSAGES LC_MONETARY"
Defaults    env_keep += "LC_NAME LC_NUMERIC LC_PAPER LC_TELEPHONE LC_TIME"
Defaults    env_keep += "LC_ALL LANGUAGE LINGUAS _XKB_CHARSET XAUTHORITY"
Defaults    secure_path = "/sbin:/bin:/usr/sbin:/usr/bin"

## User Aliases
## These aren't often necessary, as you can use regular groups
## (ie, from files, LDAP, NIS, etc) in this file - just use %groupname
## rather than USERALIAS
# aix users
User_Alias XAIX_STAFF = ab,alti,nj,rb,rgruber,tremch,seb,walzjo,gnowotny

## Runas Aliases
# root stuff
Runas_Alias ROOT = #0

## Command Aliases
## These are groups of related commands...
# root stuff
Cmnd_Alias XSU_ROOT = /usr/bin/su -,/usr/bin/su - -c *


## Allow root to run any commands anywhere
root    ALL=(ALL)       ALL

## Read drop-in files from /etc/sudoers.d (the # here does not mean a comment)
#includedir /etc/sudoers.d

from ansible-sudoers.

Related Issues (18)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.