From abd8e8c67a9f986d72e4789ca4f480aa34a6a9b9 Mon Sep 17 00:00:00 2001 From: Kenneth Wilke Date: Tue, 20 Aug 2013 12:10:47 -0500 Subject: [PATCH] sudoers_prepare test --- pillar.example | 19 +++++-------------- sudoers/files/sudoers | 6 +++--- sudoers/files/sudoers_prepare.py | 2 ++ sudoers/init.sls | 6 +++--- 4 files changed, 13 insertions(+), 20 deletions(-) create mode 100644 sudoers/files/sudoers_prepare.py diff --git a/pillar.example b/pillar.example index ca66c07..04621c4 100644 --- a/pillar.example +++ b/pillar.example @@ -2,18 +2,9 @@ sudoers: users: # Simple user johndoe: - - commands: - - ALL - # Defaults - janedoe: - - hosts: ALL - - runas: ALL - - commands: - - ALL - groups: - sudo: - - commands: - # Command tags - - ALL: - - NOPASSWD + - ALL: ALL + # List of users + janedoe,marydoe: + # Multiple hosts + - ALL: ALL #include: /etc/sudoers.d diff --git a/sudoers/files/sudoers b/sudoers/files/sudoers index f3b3b48..d5e23e6 100644 --- a/sudoers/files/sudoers +++ b/sudoers/files/sudoers @@ -1,6 +1,4 @@ {% set sudoers = pillar.get('sudoers', {}) %} -{% set users = sudoers.get('users', {} %} -{% set groups = sudoers.get('users', {} %} {% set includedir = sudoers.get('includedir', None) %} # @@ -13,7 +11,9 @@ # Cmnd alias specification # User privilege specification - +{%- for userspec in users %} +{{ userspec }} +{%- endfor %} # Group privilege specification diff --git a/sudoers/files/sudoers_prepare.py b/sudoers/files/sudoers_prepare.py new file mode 100644 index 0000000..70b6c7e --- /dev/null +++ b/sudoers/files/sudoers_prepare.py @@ -0,0 +1,2 @@ +def run(**kwargs): + print kwargs diff --git a/sudoers/init.sls b/sudoers/init.sls index 75ce735..86fd038 100644 --- a/sudoers/init.sls +++ b/sudoers/init.sls @@ -1,10 +1,10 @@ sudo: pkg.installed -/etc/sudoers: +/etc/sudoers.test: file.managed: - user: root - group: root - mode: 440 - - template: jinja - - source: salt://sudoders/files/sudoers + - template: py + - source: salt://sudoers/files/sudoers.py