From 5f805a19c12731ebd02280085fbfca9638ca6306 Mon Sep 17 00:00:00 2001 From: Elijah Lazkani Date: Sat, 18 Mar 2017 20:54:02 -0400 Subject: [PATCH] Adding a mapping template for OS specific packages --- salty/base/neovim/files/os_fams | 2 -- salty/base/neovim/init.sls | 25 ++++++++++++++----------- salty/base/neovim/map.jinja | 18 ++++++++++++++++++ 3 files changed, 32 insertions(+), 13 deletions(-) delete mode 100644 salty/base/neovim/files/os_fams create mode 100644 salty/base/neovim/map.jinja diff --git a/salty/base/neovim/files/os_fams b/salty/base/neovim/files/os_fams deleted file mode 100644 index 2a76532..0000000 --- a/salty/base/neovim/files/os_fams +++ /dev/null @@ -1,2 +0,0 @@ -Kernel: {{ grains['kernel'] }} -OS_Family: {{ grains['os_family'] }} diff --git a/salty/base/neovim/init.sls b/salty/base/neovim/init.sls index a470ea7..15fce06 100644 --- a/salty/base/neovim/init.sls +++ b/salty/base/neovim/init.sls @@ -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 %} diff --git a/salty/base/neovim/map.jinja b/salty/base/neovim/map.jinja new file mode 100644 index 0000000..ce0f1b6 --- /dev/null +++ b/salty/base/neovim/map.jinja @@ -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')) %}