2019-08-26 00:32:51 +02:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
# vim: ft=sls
|
2015-04-25 11:04:14 +02:00
|
|
|
|
2019-08-26 00:32:51 +02:00
|
|
|
{#- Get the `tplroot` from `tpldir` #}
|
|
|
|
{%- set tplroot = tpldir.split('/')[0] %}
|
|
|
|
{%- from tplroot ~ "/map.jinja" import timezone with context %}
|
2015-04-25 11:04:14 +02:00
|
|
|
|
2019-08-26 00:32:51 +02:00
|
|
|
{%- if grains.os not in ('MacOS', 'Windows') %}
|
2015-04-25 12:23:45 +02:00
|
|
|
timezone_packages:
|
2020-03-23 12:36:45 +01:00
|
|
|
{#- Work around bug in Salt for certain platforms where symlink isn't available #}
|
|
|
|
{%- if not salt['file.file_exists'](timezone.path_localtime) %}
|
2015-04-25 12:23:45 +02:00
|
|
|
file.symlink:
|
2019-08-26 00:32:51 +02:00
|
|
|
- name: {{ timezone.path_localtime }}
|
2020-03-23 12:36:45 +01:00
|
|
|
- target: {{ timezone.path_zoneinfo }}{{ timezone.tz_UTC }}
|
2015-04-25 12:23:45 +02:00
|
|
|
- force: true
|
2020-03-23 12:36:45 +01:00
|
|
|
- require_in:
|
|
|
|
# Required for unattended installation of the timezone package
|
|
|
|
- pkg: timezone_packages
|
|
|
|
# Required for timezone comparison (symlink must be present for checking the current timezone)
|
|
|
|
- timezone: timezone_setting
|
|
|
|
{%- endif %}
|
|
|
|
pkg.installed:
|
|
|
|
- name: {{ timezone.pkg.name }}
|
|
|
|
- require_in:
|
|
|
|
# Required for timezone comparison (current and proposed)
|
|
|
|
- timezone: timezone_setting
|
2019-06-11 13:58:29 +02:00
|
|
|
|
2020-03-23 12:36:45 +01:00
|
|
|
dbus_for_timezone:
|
|
|
|
pkg.installed:
|
|
|
|
- name: {{ timezone.dbus.pkg }}
|
|
|
|
- require_in:
|
|
|
|
- timezone: timezone_setting
|
|
|
|
{%- if timezone.dbus.run_service %}
|
|
|
|
service.running:
|
|
|
|
- name: {{ timezone.dbus.service }}
|
|
|
|
- enable: true
|
|
|
|
- require:
|
|
|
|
- pkg: dbus_for_timezone
|
|
|
|
- require_in:
|
|
|
|
# `dbus` is required for running `timedatectl`
|
|
|
|
- timezone: timezone_setting
|
|
|
|
{%- endif %}
|
2019-08-26 00:32:51 +02:00
|
|
|
{%- endif %}
|
2020-03-23 12:36:45 +01:00
|
|
|
|
|
|
|
timezone_setting:
|
|
|
|
timezone.system:
|
|
|
|
- name: {{ timezone.name }}
|
|
|
|
- utc: {{ timezone.utc }}
|