updated pillar lookup with map.jinja
This commit is contained in:
parent
0a1fab9f8a
commit
78b8323716
3 changed files with 10 additions and 16 deletions
|
@ -1,4 +1,4 @@
|
|||
{% from "sudoers/package-map.jinja" import pkgs with context %}
|
||||
{% from "sudoers/map.jinja" import sudoers with context %}
|
||||
|
||||
include:
|
||||
- sudoers
|
||||
|
@ -9,7 +9,7 @@ include:
|
|||
{{ included_file }}:
|
||||
file.managed:
|
||||
- user: root
|
||||
- group: {{ pkgs.get('group', 'root') }}
|
||||
- group: {{ sudoers.get('group', 'root') }}
|
||||
- mode: 440
|
||||
- template: jinja
|
||||
- source: salt://sudoers/files/sudoers
|
||||
|
@ -17,5 +17,5 @@ include:
|
|||
included: True
|
||||
sudoers: {{ spec }}
|
||||
- require:
|
||||
- file: {{ pkgs.get('config-path', '/etc') }}/sudoers
|
||||
- file: {{ sudoers.get('config-path', '/etc') }}/sudoers
|
||||
{% endfor %}
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
{% from "sudoers/package-map.jinja" import pkgs with context %}
|
||||
{% from "sudoers/map.jinja" import sudoers with context %}
|
||||
|
||||
sudo:
|
||||
pkg.installed:
|
||||
- name: {{ pkgs.sudo }}
|
||||
- name: {{ sudoers.pkgs|json }}
|
||||
|
||||
{{ pkgs.get('config-path', '/etc') }}/sudoers:
|
||||
{{ sudoers.get('config-path', '/etc') }}/sudoers:
|
||||
file.managed:
|
||||
- user: root
|
||||
- group: {{ pkgs.get('group', 'root') }}
|
||||
- group: {{ sudoers.get('group', 'root') }}
|
||||
- mode: 440
|
||||
- template: jinja
|
||||
- source: salt://sudoers/files/sudoers
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{% set package_table = {
|
||||
{% set sudoers = salt['grains.filter_by'])({
|
||||
'Debian': {'sudo': 'sudo'},
|
||||
'Ubuntu': {'sudo': 'sudo'},
|
||||
'CentOS': {'sudo': 'sudo'},
|
||||
|
@ -9,11 +9,5 @@
|
|||
'Mint': {'sudo': 'sudo'},
|
||||
'FreeBSD': {'sudo': 'sudo',
|
||||
'config-path': '/usr/local/etc',
|
||||
'group': 'wheel'}
|
||||
} %}
|
||||
|
||||
{% if 'package_table' in pillar %}
|
||||
{% set pkgs = pillar['package_table'] %}
|
||||
{% elif grains['os'] in package_table %}
|
||||
{% set pkgs = package_table[grains['os']] %}
|
||||
{% endif %}
|
||||
'group': 'wheel'},
|
||||
}, merge=salt['pillar.get']('sudoers:lookup')) %}
|
Loading…
Reference in a new issue