0
0
mirror of https://github.com/saltstack-formulas/sudoers-formula.git synced 2024-11-28 00:48:12 +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" - secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
aliases: aliases:
hosts: hosts:
- WEBSERVERS: WEBSERVERS:
- www1 - www1
- www2 - www2
- www3 - www3
users: users:
- ADMINS: ADMINS:
- millert - millert
- dowdy - dowdy
- mikef - mikef
commands: commands:
- PROCESSES: PROCESSES:
- /usr/bin/nice - /usr/bin/nice
- /bin/kill - /bin/kill
- /usr/bin/renice - /usr/bin/renice

View File

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