From 3fb41ca3b847a8f41a7626ee8871bd2f43cd781d Mon Sep 17 00:00:00 2001 From: Thorsten Bro Date: Wed, 28 Sep 2016 16:14:08 +0200 Subject: [PATCH] install timezone pkg and update symlink based on osfamily --- timezone/init.sls | 11 +++++++++++ timezone/map.jinja | 9 +++++++++ 2 files changed, 20 insertions(+) create mode 100644 timezone/map.jinja diff --git a/timezone/init.sls b/timezone/init.sls index facd463..b3e01c7 100644 --- a/timezone/init.sls +++ b/timezone/init.sls @@ -2,8 +2,19 @@ {%- set timezone = salt['pillar.get']('timezone:name', 'Europe/Berlin') %} {%- set utc = salt['pillar.get']('timezone:utc', True) %} +{% from "timezone/map.jinja" import confmap with context %} timezone_setting: timezone.system: - name: {{ timezone }} - utc: {{ utc }} + +timezone.packages: + pkg.installed: + - name: {{ confmap.pkgname }} + +{{ confmap.path-localtime }}: + file.symlink: + - target: {{ path-zoneinfo }}{{ timezone }} + - require: + - pkg: {{ confmap.pkgname }} diff --git a/timezone/map.jinja b/timezone/map.jinja new file mode 100644 index 0000000..49bef33 --- /dev/null +++ b/timezone/map.jinja @@ -0,0 +1,9 @@ +{% set map = { + 'Suse': { + 'path-localtime': '/etc/localtime', + 'path-zoneinfo': '/usr/share/zoneinfo/', + 'pkgname': 'timezone', + }, +} %} + +{% set confmap = map.get(grains.os_family) %}