├── .gitignore ├── LICENSE ├── README.md ├── defaults └── main.yml ├── handlers └── main.yml ├── meta └── main.yml ├── tasks └── main.yml └── templates └── timezone.j2 /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2014 Sergey Korolev 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Deprecation warning 2 | ======== 3 | 4 | Unmaintained project. Please, use ansible timezone module. 5 | 6 | timezone 7 | ======== 8 | 9 | Set timezone on Debian-like systems. 10 | 11 | Role Variables 12 | -------------- 13 | 14 | * *timezone* - timezone (like _UTC_, _Europe/Moscow_) 15 | 16 | License 17 | ------- 18 | 19 | MIT 20 | 21 | Author Information 22 | ------------------ 23 | 24 | Sergey Korolev () 25 | -------------------------------------------------------------------------------- /defaults/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # defaults file for timezone 3 | timezone: UTC 4 | backup_etc_files: true 5 | -------------------------------------------------------------------------------- /handlers/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # handlers file for timezone 3 | - name: update tzdata 4 | command: dpkg-reconfigure --frontend noninteractive tzdata 5 | -------------------------------------------------------------------------------- /meta/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | galaxy_info: 3 | author: Sergey Korolev 4 | description: Set timezone on Debian-like systems. 5 | license: MIT 6 | platforms: 7 | - name: Ubuntu 8 | versions: 9 | - all 10 | - name: Debian 11 | versions: 12 | - all 13 | categories: 14 | - system 15 | dependencies: [] 16 | -------------------------------------------------------------------------------- /tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # tasks file for timezone 3 | - name: Install neccessary software packages 4 | apt: name=rsync 5 | tags: [configuration,timezone] 6 | 7 | - name: Copy timezone {{ timezone }} to /etc/localtime 8 | command: rsync --itemize-changes --checksum --copy-links /usr/share/zoneinfo/{{ timezone }} /etc/localtime 9 | register: command_result 10 | when: ansible_os_family == "Debian" 11 | changed_when: "command_result.stdout != ''" 12 | tags: [configuration,timezone] 13 | 14 | - name: Set /etc/timezone to {{ timezone }} 15 | template: dest=/etc/timezone src=timezone.j2 16 | notify: update tzdata 17 | when: ansible_os_family == "Debian" 18 | tags: [configuration,timezone] 19 | -------------------------------------------------------------------------------- /templates/timezone.j2: -------------------------------------------------------------------------------- 1 | {{ timezone }} 2 | --------------------------------------------------------------------------------