role.timezone/tasks/main.yml

31 lines
735 B
YAML
Raw Permalink Normal View History

2024-11-19 17:29:31 +00:00
---
- name: Set /etc/timezone
copy:
content: |
{{ timezone_zone }}
dest: /etc/timezone
mode: 0644
owner: root
group: root
backup: yes
- name: 'Look for /usr/share/zoneinfo/{{ timezone_zone }}'
stat:
path: '/usr/share/zoneinfo/{{ timezone_zone }}'
register: timezone_zoneinfo
- name: 'Link /etc/localtime to /usr/share/zoneinfo/{{ timezone_zone }}'
file:
src: '/usr/share/zoneinfo/{{ timezone_zone }}'
dest: /etc/localtime
state: link
mode: 0644
when: timezone_zoneinfo.stat.exists
- name: Setup timezone for Alpine Linux
command:
cmd: '/sbin/setup-timezone {{ timezone_zone }}'
creates: '/etc/zoneinfo/{{ timezone_zone }}'
when: ansible_os_family == "Alpine"