Fix README.

Added FORMULA for Salt Package Manager

More detailed: https://docs.saltstack.com/en/latest/topics/spm/

install timezone pkg and update symlink based on osfamily

bugfix in symlink function

...#

another symlink bugfix testing

changed variable-names in jinja according to https://github.com/ansible/ansible/issues/3907

added debian to mapfile

changed function names for better looking code

changed FORMULA according to contents of map.jinja, other distributions may follow

added Redhat in map.jinja

added Redhat in map.jinja

added Redhat in map.jinja

install timezone data containing pkg on several distros and symlink to the choosen timezone
This commit is contained in:
Florian Bittner 2015-04-25 12:23:45 +02:00 committed by Thorsten B
parent 93837b5be6
commit 4e881296c7
4 changed files with 41 additions and 1 deletions

8
FORMULA Normal file
View File

@ -0,0 +1,8 @@
name: timezone
os: Debian, RedHat, Suse
os_family: Debian, RedHat, Suse
version: 201504
release: 1
minimum_version: 2015.5
summary: Formula for timezone management
description: Formula for managing timezone settings

View File

@ -28,4 +28,4 @@ Default values are:
timezone: 'Europe/Berlin'
utc: True
See mopidy/pillar.example.
See timezone/pillar.example.

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) %}