0
0
mirror of https://github.com/saltstack-formulas/timezone-formula.git synced 2024-12-18 04:22:54 +01:00

Merge pull request #1 from thomic/master

automatically install timezone packages and set symlink to localtime-file
This commit is contained in:
Niels Abspoel 2016-09-29 20:07:42 +02:00 committed by GitHub
commit 8d310cd9d3
3 changed files with 34 additions and 2 deletions

View File

@ -1,6 +1,6 @@
name: timezone
os: RedHat, Debian, Ubuntu, Suse, FreeBSD
os_family: RedHat, Debian, Suse, FreeBSD
os: Debian, RedHat, Suse
os_family: Debian, RedHat, Suse
version: 201504
release: 1
minimum_version: 2015.5

View File

@ -2,8 +2,21 @@
{%- 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 }}
timezone_symlink:
file.symlink:
- name: {{ confmap.path_localtime }}
- target: {{ confmap.path_zoneinfo }}{{ timezone }}
- force: true
- require:
- pkg: {{ confmap.pkgname }}

19
timezone/map.jinja Normal file
View File

@ -0,0 +1,19 @@
{% set map = {
'Debian': {
'path_localtime': '/etc/localtime',
'path_zoneinfo': '/usr/share/zoneinfo/',
'pkgname': 'tzdata',
},
'Redhat': {
'path_localtime': '/etc/localtime',
'path_zoneinfo': '/usr/share/zoneinfo/',
'pkgname': 'tzdata',
},
'Suse': {
'path_localtime': '/etc/localtime',
'path_zoneinfo': '/usr/share/zoneinfo/',
'pkgname': 'timezone',
},
} %}
{% set confmap = map.get(grains.os_family) %}