From d7940c09988cfd9eacecf38e90872d4684eb355e Mon Sep 17 00:00:00 2001 From: Imran Iqbal Date: Tue, 12 Feb 2019 07:36:59 +0000 Subject: [PATCH 1/2] Fix `map.jinja` and add more OSes --- CHANGELOG.rst | 4 ++++ VERSION | 2 +- template/map.jinja | 22 +++++++++++----------- template/osfamilymap.yaml | 18 ++++++++++++++++-- template/osmap.yaml | 11 +++++++++-- 5 files changed, 41 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index ccf000df..a85bfa13 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,10 @@ template formula ================ +0.1.2 (2019-02-12) + +- Update map.jinja, osfamilymap.yaml & osmap.yaml + 0.1.1 (2019-02-10) - Update map.jinja and README diff --git a/VERSION b/VERSION index 245ad5ce..0ff3b6b2 100644 --- a/VERSION +++ b/VERSION @@ -1,2 +1,2 @@ # should contain the currently released version of the formula -0.1.0 +0.1.2 diff --git a/template/map.jinja b/template/map.jinja index a86f555e..1830bd54 100644 --- a/template/map.jinja +++ b/template/map.jinja @@ -1,22 +1,22 @@ # -*- coding: utf-8 -*- # vim: ft=jinja -{## Start imports as ##} +{## Start imports as ##} {% import_yaml 'template/defaults.yaml' as defaults %} -{% import_yaml 'template/osfamilymap.yaml' ad osfamilymap %} -{% import_yaml 'template/osmap.yaml' ad osmap %} +{% import_yaml 'template/osfamilymap.yaml' as osfamilymap %} +{% import_yaml 'template/osmap.yaml' as osmap %} -{## merge the osfamilymap ##} -{% set osfamily = salt['grains.filter_by']('osfamilymap', grain='os_family_map') or{} %} +{## Merge the osfamilymap ##} +{% set osfamily = salt['grains.filter_by'](osfamilymap, grain='os_family') or {} %} {% do salt['defaults.merge'](defaults['template'], osfamily) %} -{## merge the osmap ##} -{% set osmap = salt['grains.filter_by']('osmap', grain='os') or{} %} -{% do salt['defaults.merge'](defaults['template'], osmap) %} +{## Merge the osmap ##} +{% set os = salt['grains.filter_by'](osmap, grain='os') or {} %} +{% do salt['defaults.merge'](defaults['template'], os) %} -{## merge the lookup ##} -{% lookup = salt['pillar.get']('template:lookup', default={}, merge=True) %} +{## Merge the lookup ##} +{% set lookup = salt['pillar.get']('template:lookup', default={}) %} {% do salt['defaults.merge'](defaults['template'], lookup) %} -{## merge the template pillar ##} +{## Merge the template pillar ##} {% set template = salt['pillar.get']('template', default=defaults['template'], merge=True) %} diff --git a/template/osfamilymap.yaml b/template/osfamilymap.yaml index 10c334f3..ad342db0 100644 --- a/template/osfamilymap.yaml +++ b/template/osfamilymap.yaml @@ -1,5 +1,8 @@ # -*- coding: utf-8 -*- -# # vim: ft=yaml +# vim: ft=yaml +# +# Setup variables using grains['os_family'] based logic. +# Only add key:values that differ from `defaults.yaml`. --- Debian: pkg: template-debian @@ -12,6 +15,17 @@ RedHat: Suse: pkg: template-suse +Gentoo: {} + Arch: pkg: template-arch - + +Alpine: {} + +FreeBSD: {} + +OpenBSD: {} + +Windows: {} + +MacOS: {} diff --git a/template/osmap.yaml b/template/osmap.yaml index b0fb6b16..9a696250 100644 --- a/template/osmap.yaml +++ b/template/osmap.yaml @@ -1,8 +1,15 @@ # -*- coding: utf-8 -*- # vim: ft=yaml +# +# Setup variables using grains['os'] based logic. +# Only add key:values that differ from `defaults.yaml` + `os_family.yaml`. --- +Ubuntu: + pkg: template-ubuntu + Fedora: pkg: template-fedora -Ubuntu: - pkg: template-ubuntu +Raspbian: {} + +SmartOS: {} From b5c4987ac3cdac3734891c40b4258b23dc9e5d3f Mon Sep 17 00:00:00 2001 From: Imran Iqbal Date: Tue, 12 Feb 2019 11:57:41 +0000 Subject: [PATCH 2/2] Improve comments and examples in `osfamilymap` & `osmap` --- template/osfamilymap.yaml | 7 ++++++- template/osmap.yaml | 8 +++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/template/osfamilymap.yaml b/template/osfamilymap.yaml index ad342db0..0aa404aa 100644 --- a/template/osfamilymap.yaml +++ b/template/osfamilymap.yaml @@ -2,7 +2,10 @@ # vim: ft=yaml # # Setup variables using grains['os_family'] based logic. -# Only add key:values that differ from `defaults.yaml`. +# You just need to add the key:values for an `os_family` that differ +# from `defaults.yaml`. +# Only add an `os_family` which is/will be supported by the formula +# (empty `os_family`s do not need to be listed, just added here as an example). --- Debian: pkg: template-debian @@ -19,6 +22,8 @@ Gentoo: {} Arch: pkg: template-arch + service: + name: service-arch Alpine: {} diff --git a/template/osmap.yaml b/template/osmap.yaml index 9a696250..f2e5fe53 100644 --- a/template/osmap.yaml +++ b/template/osmap.yaml @@ -2,13 +2,19 @@ # vim: ft=yaml # # Setup variables using grains['os'] based logic. -# Only add key:values that differ from `defaults.yaml` + `os_family.yaml`. +# You just need to add the key:values for an `os` that differ +# from `defaults.yaml` + `os_family.yaml`. +# Only add an `os` which is/will be supported by the formula +# (empty `os`es do not need to be listed, just added here as an example). --- Ubuntu: pkg: template-ubuntu + config: /etc/template.d/custom-ubuntu.conf Fedora: pkg: template-fedora + service: + name: service-fedora Raspbian: {}