From 02cba444a09b84e328e72a73878164740bcd7069 Mon Sep 17 00:00:00 2001
From: Dennis Ahrens <dennis.ahrens@hs-hannover.de>
Date: Tue, 26 Apr 2016 17:19:30 +0200
Subject: [PATCH] Add locales and basic python packages

---
 README.md             | 11 ++++++-----
 hshbase/defaults.yaml |  4 ++++
 hshbase/init.sls      | 21 +++++++++++++++++++--
 hshbase/locale.sls    | 21 +++++++++++++++++++++
 4 files changed, 50 insertions(+), 7 deletions(-)
 create mode 100644 hshbase/locale.sls

diff --git a/README.md b/README.md
index 1ec1828..f17ad41 100644
--- a/README.md
+++ b/README.md
@@ -4,11 +4,12 @@ Basic server configuration used for most unix based servers at HsH.
 
 ## States
 
-* apt
-* openvmtools
-
-* iptables
-* locale
+* **apt** proxy, sources.list and sources.list.d
+* **openvmtools** use them for vmware
+* **locale** setup your servers locales
+* **python-packages** we are using for salt grains or modules.
+ * **netifaces** useful information in grains about net cfg
+ * **psutil** who needs that?!
 
 
 ## Configuration
diff --git a/hshbase/defaults.yaml b/hshbase/defaults.yaml
index e88b800..7f80411 100644
--- a/hshbase/defaults.yaml
+++ b/hshbase/defaults.yaml
@@ -6,3 +6,7 @@ hshbase:
   time:
     server: time.rz.fh-hannover.de
     zone: Europe/Berlin
+  locale:
+    system: en_US.UTF-8
+    present:
+      - de_DE.UTF-8
diff --git a/hshbase/init.sls b/hshbase/init.sls
index 60d3c73..da8c903 100644
--- a/hshbase/init.sls
+++ b/hshbase/init.sls
@@ -1,8 +1,25 @@
 {% from "hshbase/map.jinja" import hshbase with context %}
 
-# Include all submodules by default.
-
+# Include all submodules by default - they ca be disable in pillar, if necessary
 include:
   - .apt
   - .openvmtools
   - .time
+  - .locale
+
+# Always ships this packages - we need them for grains
+{% if grains['os'] == 'Debian' and grains['oscodename'] != 'squeeze' or grains['os'] == 'Ubuntu' %}
+salt-python-packages:
+  pkg.installed:
+    - pkgs:
+      - python-netifaces
+      - python-psutil
+
+{% elif grains['os'] == 'FreeBSD' %}
+salt-python-packages:
+  pkg.installed:
+    - pkgs:
+      - net/py-netifaces
+      - py27-psutil
+
+{% endif %}
diff --git a/hshbase/locale.sls b/hshbase/locale.sls
new file mode 100644
index 0000000..c2b9e06
--- /dev/null
+++ b/hshbase/locale.sls
@@ -0,0 +1,21 @@
+{% from "hshbase/map.jinja" import hshbase with context %}
+
+locales:
+  pkg.installed
+
+hshbase_locale_system:
+  locale.present:
+    - name: {{ hshbase.locale.system }}
+
+hshbase_locale_install_system:
+  locale.system:
+    - name: {{ hshbase.locale.system }}
+    - require:
+      - locale: hshbase_locale_system
+
+{% for locale in hshbase.locale.present %}
+hshbase_locale_{{ loop.index }}:
+  locale.present:
+    - name: {{ locale }}
+
+{% endfor %}
-- 
GitLab