0
0
mirror of https://github.com/saltstack-formulas/sudoers-formula.git synced 2024-11-27 22:38:22 +01:00

fleshed out template

This commit is contained in:
Kenneth Wilke 2013-08-20 16:51:13 -05:00
parent 34178002e7
commit 61a216de81
2 changed files with 22 additions and 12 deletions

View File

@ -9,17 +9,17 @@ sudoers:
- secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
aliases:
hosts:
- WEBSERVERS:
WEBSERVERS:
- www1
- www2
- www3
users:
- ADMINS:
ADMINS:
- millert
- dowdy
- mikef
commands:
- PROCESSES:
PROCESSES:
- /usr/bin/nice
- /bin/kill
- /usr/bin/renice

View File

@ -1,10 +1,10 @@
{% set sudoers = pillar.get('sudoers', {}) %}
{% set defaults = sudoers.get('defaults', []) %}
{% set aliases = sudoers.get('aliases', {}) %}
{% set host_aliases = aliases.get('hosts', []) %}
{% set user_aliases = aliases.get('users', []) %}
{% set cmnd_aliases = aliases.get('commands', []) %}
{% set runas_aliases = aliases.get('runas', []) %}
{% set host_aliases = aliases.get('hosts', {}) %}
{% set user_aliases = aliases.get('users', {}) %}
{% set command_aliases = aliases.get('commands', {}) %}
{% set runas_aliases = aliases.get('runas', {}) %}
{% set users = sudoers.get('users', {}) %}
{% set groups = sudoers.get('groups', {}) %}
{% set includedir = sudoers.get('includedir', None) %}
@ -22,19 +22,29 @@ Host_Alias {{ name }} = {{ ",".join(hosts) }}
{% endfor %}
# User alias specification
{{ user_aliases }}
{% for name,users in user_aliases.items() %}
User_Alias {{ name }} = {{ ",".join(users) }}
{% endfor %}
# Cmnd alias specification
{{ cmnd_aliases }}
{% for name,commands in command_aliases.items() %}
Cmnd_Alias {{ name }} = {{ ",".join(commands) }}
{% endfor %}
# Runas alias specification
{{ runas_aliases }}
{% for name,runas in runas_aliases.items() %}
Runas_Alias {{ name }} = {{ ",".join(runas) }}
{% endfor %}
# User privilege specification
{{ users }}
{% for user,spec in users %}
{{ user }} {{ spec }}
{% endfor %}
# Group privilege specification
{{ groups }}
{% for group,spec in groups %}
%{{ group }} {{ spec }}
{% endfor %}
{% if includedir %}
includedir {{ includedir }}