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:
commit
8d310cd9d3
4
FORMULA
4
FORMULA
@ -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
|
||||
|
@ -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
19
timezone/map.jinja
Normal 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) %}
|
Loading…
Reference in New Issue
Block a user