Adding a mapping template for OS specific packages

This commit is contained in:
Elijah Lazkani 2017-03-18 20:54:02 -04:00
parent 08a03f0b5a
commit 5f805a19c1
3 changed files with 32 additions and 13 deletions

View file

@ -1,2 +0,0 @@
Kernel: {{ grains['kernel'] }}
OS_Family: {{ grains['os_family'] }}

View file

@ -1,19 +1,22 @@
{% from "neovim/map.jinja" import neovim with context %}
neovim-install: neovim-install:
{% if grains['os_family'] == 'Debian' %} {% if grains['os_family'] == 'Debian' %}
pkgrepo.managed: pkgrepo.managed:
- ppa: neovim-ppa/unstable - ppa: {{ neovim.ppa }}
{% endif %} {% endif %}
pkg.installed: pkg.installed:
{% if grains['kernel'] == 'Darwin' %} - name: {{ neovim.name }}
- name: neovim {% if grains['os_family'] == 'MacOS' %}
- taps: 'neovim/neovim' - taps: {{ neovim.taps }}
{% elif grains['kernel'] == 'Linux' %}
- name: neovim
{% endif %} {% endif %}
os-family: # TODO: fix the python for MacOS
file.managed: {% if grains['os_family'] != 'MacOS' %}
- name: {{ grains.homedir }}/os_family python-neovim:
- source: salt:///neovim/files/os_fams pkg.installed:
- template: jinja - pkgs:
- {{ grains.python2 }}
- {{ grains.python3 }}
{% endif %}

View file

@ -0,0 +1,18 @@
{% set neovim = salt['grains.filter_by']({
'Debian': {
'name': 'neovim',
'ppa': 'neovim-ppa/unstable',
'python2': 'python-neovim',
'python3': 'python3-neovim',
},
'Arch': {
'name': 'neovim',
'python2': 'python2-neovim',
'python3': 'python-neovim',
},
'MacOS': {
'name': 'neovim',
'taps': 'neovim/neovim',
'python': 'neovim',
},
}, merge=salt['pillar.get']('neovim:lookup')) %}