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:
{% if grains['os_family'] == 'Debian' %}
pkgrepo.managed:
- ppa: neovim-ppa/unstable
- ppa: {{ neovim.ppa }}
{% endif %}
pkg.installed:
{% if grains['kernel'] == 'Darwin' %}
- name: neovim
- taps: 'neovim/neovim'
{% elif grains['kernel'] == 'Linux' %}
- name: neovim
- name: {{ neovim.name }}
{% if grains['os_family'] == 'MacOS' %}
- taps: {{ neovim.taps }}
{% endif %}
os-family:
file.managed:
- name: {{ grains.homedir }}/os_family
- source: salt:///neovim/files/os_fams
- template: jinja
# TODO: fix the python for MacOS
{% if grains['os_family'] != 'MacOS' %}
python-neovim:
pkg.installed:
- 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')) %}