1
0
Fork 0
mirror of synced 2024-11-05 17:08:56 -05:00

this owrks but would like to remove the if statement

This commit is contained in:
bellaweo 2017-02-14 16:30:14 -08:00
parent 35c995aee7
commit 966b189127
3 changed files with 9 additions and 6 deletions

View file

@ -1,4 +1,4 @@
{% from "sudoers/map.jinja" import group_maps with context %}
{% from "sudoers/map.jinja" import ad_group_maps with context %}
{%- if (not included) %}
{%- set sudoers = pillar.get('sudoers', {}) %}
{%- if grains['os_family'] == 'Debian' %}
@ -95,11 +95,11 @@ Runas_Alias {{ name }} = {{ ",".join(runas) }}
{{ group }} {{ spec }}
{%- endfor %}
{%- endfor %}
{%- for unix_group in pillar.get('group_map:core', {}).keys() %}
{%- if unix_group in group_map.keys() %}
{{ unix_group }} {{ group_map.unix_group }}
{%- for unix_group in ad_groups.keys() %}
{%- if unix_group in ad_group_maps.keys() %}
{{ unix_group }} {{ ad_group_maps.unix_group }}
{%- else %}
{{ unix_group }} (( group_map.default }}
{{ unix_group }} {{ ad_group_maps.default }}
{%- endif %}
{%- endfor %}

View file

@ -1,4 +1,6 @@
{% from "sudoers/map.jinja" import sudoers with context %}
##{%- set ad_groups = pillar.get('group_map:core', {}) %}
{%- set ad_groups = salt['pillar.get']('group_map:core') %}
sudo:
pkg.installed:
@ -13,5 +15,6 @@ sudo:
- source: salt://sudoers/files/sudoers
- context:
included: False
ad_groups: {{ ad_groups }}
- require:
- pkg: sudo

View file

@ -14,7 +14,7 @@
'group': 'wheel'},
}, merge=salt['pillar.get']('sudoers:lookup', None)) %}
{% set group_maps = salt['grains.filter_by']({
{% set ad_group_maps = salt['grains.filter_by']({
'default': { 'default': 'ALL = (ALL:ALL) NOPASSWD: SUPPORT' },
'dev': { 'default': 'ALL = (ALL:ALL) NOPASSWD: ALL' },
'qa': { 'default': 'ALL = (ALL:ALL) NOPASSWD: SUPPORT',