diff --git a/localization/handlers/main.yml b/localization/handlers/main.yml index cc5308cff87ca7a36fe39cdf5b26045da29a1a9f..5a6a169f12273ada436c9eb07857120f497d3862 100644 --- a/localization/handlers/main.yml +++ b/localization/handlers/main.yml @@ -9,3 +9,10 @@ - name: update timezone command: dpkg-reconfigure --frontend noninteractive tzdata + when: is_debian + +- name: stop chronyd + systemd: + name: chronyd.service + state: stopped + ignore_errors: true diff --git a/localization/tasks/locale.yml b/localization/tasks/locale.yml index a6ae95b42bee65c860962fab3cd3c6525dd49531..b709c79c6c73c1d3a67dc3b80fb19091db376703 100644 --- a/localization/tasks/locale.yml +++ b/localization/tasks/locale.yml @@ -1,9 +1,20 @@ --- -- name: ensure locale support is installed +- name: ensure locale support is installed (Debian) apt: name: locales state: present + when: is_debian + tags: + - locale + +- name: ensure locale support is installed (RHEL) + dnf: + name: langpacks-{{ item }} + state: present + loop: >- + {{ localization_enabled_locales|map('split', '_')|map('first')|unique }} + when: is_rhel tags: - locale @@ -12,19 +23,33 @@ name: "{{ item }}.UTF-8" state: present with_items: "{{ localization_enabled_locales }}" + when: is_debian tags: - locale - name: ensure our default locale is default copy: src: "{{ localization_locale }}" - dest: /etc/default/locale + dest: >- + {%- if is_debian|default(true) -%} + /etc/default/locale + {%- elif is_rhel -%} + /etc/locale.conf + {%- endif -%} owner: root group: root mode: '0644' tags: - locale +- name: Install console keymaps + dnf: + name: kbd-legacy + state: present + when: is_rhel + tags: + - locale + - name: ensure our vconsole config is present copy: src: "{{ localization_vconsole }}" diff --git a/localization/tasks/timesyncd.yml b/localization/tasks/timesyncd.yml index 0dfa0127ed1f1b2b645a75045e22575c2ff67248..c4cadebdc43a71a3a539f9d5c3ee314e51b1df91 100644 --- a/localization/tasks/timesyncd.yml +++ b/localization/tasks/timesyncd.yml @@ -6,6 +6,25 @@ name: ntp state: absent purge: true + when: is_debian + tags: + - timesyncd + +- name: Remove chrony + dnf: + name: chrony + state: absent + when: is_rhel + notify: + - stop chronyd + tags: + - timesyncd + +- name: Install timesyncd + dnf: + name: systemd-timesyncd + state: present + when: is_rhel tags: - timesyncd diff --git a/localization/tasks/timezone.yml b/localization/tasks/timezone.yml index 0955d88c455148362143534c266770914d4ea8ae..a0af095a5dd95a1405727f81c1aebedc548c993c 100644 --- a/localization/tasks/timezone.yml +++ b/localization/tasks/timezone.yml @@ -12,6 +12,7 @@ - "{{ localization_timezone.split('/') }}" notify: - update timezone + when: is_debian tags: - timezone @@ -28,6 +29,7 @@ mode: '0644' notify: - update timezone + when: is_debian tags: - timezone diff --git a/localization/templates/timesyncd.conf.j2 b/localization/templates/timesyncd.conf.j2 index 37fdf3a8fec3e3188aee9b0e67b1a44bc7a0350c..21048752e5fabad9f2c393b1ac2a5807642a82bf 100644 --- a/localization/templates/timesyncd.conf.j2 +++ b/localization/templates/timesyncd.conf.j2 @@ -13,4 +13,8 @@ [Time] NTP={{ ntpservers|join(' ') }} +{% if is_debian %} FallbackNTP=0.debian.pool.ntp.org 1.debian.pool.ntp.org 2.debian.pool.ntp.org 3.debian.pool.ntp.org +{% elif is_rhel %} +FallbackNTP=0.rhel.pool.ntp.org 1.rhel.pool.ntp.org 2.rhel.pool.ntp.org 3.rhel.pool.ntp.org +{% endif %}