1
0
Fork 0
mirror of synced 2024-12-22 06:01:07 -05:00
formula-sudoers/sudoers/files/sudoers
2014-02-09 18:32:22 +01:00

54 lines
1.5 KiB
Text

{%- if (not included) %}
{%- set sudoers = pillar.get('sudoers', {}) %}
{%- set includedir = sudoers.get('includedir', '/etc/sudoers.d') -%}
{%- else %}
{%- set includedir = sudoers.get('includedir', None) %}
{%- endif %}
{%- set defaults = sudoers.get('defaults', []) %}
{%- set aliases = sudoers.get('aliases', {}) %}
{%- 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', {}) -%}
#
# This file is managed by salt
#
{% for default in defaults -%}
Defaults {{ default }}
{% endfor %}
# Host alias specification
{%- for name,hosts in host_aliases.items() %}
Host_Alias {{ name }} = {{ ",".join(hosts) }}
{%- endfor %}
# User alias specification
{%- for name,users in user_aliases.items() %}
User_Alias {{ name }} = {{ ",".join(users) }}
{%- endfor %}
# Cmnd alias specification
{%- for name,commands in command_aliases.items() %}
Cmnd_Alias {{ name }} = {{ ",".join(commands) }}
{%- endfor %}
# Runas alias specification
{%- for name,runas in runas_aliases.items() %}
Runas_Alias {{ name }} = {{ ",".join(runas) }}
{%- endfor %}
# User privilege specification
{%- for user,spec in users.items() %}
{{ user }} {{ spec }}
{%- endfor %}
# Group privilege specification
{%- for group,spec in groups.items() %}
%{{ group }} {{ spec }}
{%- endfor %}
{% if includedir %}
#includedir {{ includedir }}
{% endif %}