1
0
Fork 0
mirror of synced 2024-12-22 14:11:07 -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) %} {%- if (not included) %}
{%- set sudoers = pillar.get('sudoers', {}) %} {%- set sudoers = pillar.get('sudoers', {}) %}
{%- if grains['os_family'] == 'Debian' %} {%- if grains['os_family'] == 'Debian' %}
@ -95,11 +95,11 @@ Runas_Alias {{ name }} = {{ ",".join(runas) }}
{{ group }} {{ spec }} {{ group }} {{ spec }}
{%- endfor %} {%- endfor %}
{%- endfor %} {%- endfor %}
{%- for unix_group in pillar.get('group_map:core', {}).keys() %} {%- for unix_group in ad_groups.keys() %}
{%- if unix_group in group_map.keys() %} {%- if unix_group in ad_group_maps.keys() %}
{{ unix_group }} {{ group_map.unix_group }} {{ unix_group }} {{ ad_group_maps.unix_group }}
{%- else %} {%- else %}
{{ unix_group }} (( group_map.default }} {{ unix_group }} {{ ad_group_maps.default }}
{%- endif %} {%- endif %}
{%- endfor %} {%- endfor %}

View file

@ -1,4 +1,6 @@
{% from "sudoers/map.jinja" import sudoers with context %} {% 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: sudo:
pkg.installed: pkg.installed:
@ -13,5 +15,6 @@ sudo:
- source: salt://sudoers/files/sudoers - source: salt://sudoers/files/sudoers
- context: - context:
included: False included: False
ad_groups: {{ ad_groups }}
- require: - require:
- pkg: sudo - pkg: sudo

View file

@ -14,7 +14,7 @@
'group': 'wheel'}, 'group': 'wheel'},
}, merge=salt['pillar.get']('sudoers:lookup', None)) %} }, 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' }, 'default': { 'default': 'ALL = (ALL:ALL) NOPASSWD: SUPPORT' },
'dev': { 'default': 'ALL = (ALL:ALL) NOPASSWD: ALL' }, 'dev': { 'default': 'ALL = (ALL:ALL) NOPASSWD: ALL' },
'qa': { 'default': 'ALL = (ALL:ALL) NOPASSWD: SUPPORT', 'qa': { 'default': 'ALL = (ALL:ALL) NOPASSWD: SUPPORT',