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