mirror of
https://github.com/saltstack-formulas/timezone-formula.git
synced 2024-11-28 01:17:58 +01:00
Set vars in YAML files
- Add defaults YAML - Add osfamilymap YAML - Add lookup dict merge to support user overrides - Add Gentoo support
This commit is contained in:
parent
646159fc5b
commit
7e6ad3bbfd
3
timezone/defaults.yaml
Normal file
3
timezone/defaults.yaml
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
path_localtime: /etc/localtime
|
||||||
|
path_zoneinfo: /usr/share/zoneinfo/
|
||||||
|
pkgname: tzdata
|
@ -1,29 +1,15 @@
|
|||||||
{% set map = {
|
{% import_yaml "timezone/defaults.yaml" as defaults %}
|
||||||
'Debian': {
|
{% import_yaml "timezone/osfamilymap.yaml" as osfamilymap %}
|
||||||
'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',
|
|
||||||
},
|
|
||||||
'Arch': {
|
|
||||||
'path_localtime': '/etc/localtime',
|
|
||||||
'path_zoneinfo': '/usr/share/zoneinfo/',
|
|
||||||
'pkgname': 'tzdata',
|
|
||||||
},
|
|
||||||
'FreeBSD': {
|
|
||||||
'path_localtime': '/etc/localtime',
|
|
||||||
'path_zoneinfo': '/usr/share/zoneinfo/',
|
|
||||||
'pkgname': 'zoneinfo',
|
|
||||||
},
|
|
||||||
} %}
|
|
||||||
|
|
||||||
{% set confmap = map.get(grains.os_family) %}
|
{% set osfam = salt['grains.filter_by'](
|
||||||
|
osfamilymap,
|
||||||
|
grain='os_family'
|
||||||
|
) or {} %}
|
||||||
|
|
||||||
|
{% do salt['defaults.merge'](defaults, osfam) %}
|
||||||
|
|
||||||
|
{%- set confmap = salt['pillar.get'](
|
||||||
|
'timezone:lookup',
|
||||||
|
default=defaults,
|
||||||
|
merge=True,
|
||||||
|
) %}
|
6
timezone/osfamilymap.yaml
Normal file
6
timezone/osfamilymap.yaml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
Suse:
|
||||||
|
pkgname: timezone
|
||||||
|
FreeBSD:
|
||||||
|
pkgname: zoneinfo
|
||||||
|
Gentoo:
|
||||||
|
pkgname: sys-libs/timezone-data
|
Loading…
Reference in New Issue
Block a user