Initial commit

This commit is contained in:
Sven Velt 2024-11-19 18:29:31 +01:00
commit 5cc66c3f58
6 changed files with 276 additions and 0 deletions

164
.gitignore vendored Normal file
View file

@ -0,0 +1,164 @@
# ---> Ansible
*.retry
# ---> Python
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
.pybuilder/
target/
# Jupyter Notebook
.ipynb_checkpoints
# IPython
profile_default/
ipython_config.py
# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version
# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/
# Celery stuff
celerybeat-schedule
celerybeat.pid
# SageMath parsed files
*.sage.py
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
.dmypy.json
dmypy.json
# Pyre type checker
.pyre/
# pytype static type analyzer
.pytype/
# Cython debug symbols
cython_debug/
# ---> Vim
# Swap
[._]*.s[a-v][a-z]
!*.svg # comment out if you don't need vector files
[._]*.sw[a-p]
[._]s[a-rt-v][a-z]
[._]ss[a-gi-z]
[._]sw[a-p]
# Session
Session.vim
Sessionx.vim
# Temporary
.netrwhist
*~
# Auto-generated tag files
tags
# Persistent undo
[._]*.un~

32
README.md Normal file
View file

@ -0,0 +1,32 @@
# timezone
Set timezone for different distributions
## Role Variables
Defaults:
- `timezone_zone` (defaults: `Europe/Berlin`): timezone name
## Example Playbook
---
- hosts: all
roles:
- role: timezone
vars:
timezone_zone: Europe/Berlin
## License
AGPL-3.0-or-later
## Author Information
Sven Velt - <sven-ansiblerole@velt.biz>
https://git.velt.biz/velt.biz/

2
defaults/main.yml Normal file
View file

@ -0,0 +1,2 @@
---
timezone_zone: Europe/Berlin

41
meta/main.yml Normal file
View file

@ -0,0 +1,41 @@
---
galaxy_info:
author: Sven Velt
description: Set timezone for different distributions
company: velt.biz
issue_tracker_url: https://git.velt.biz/Ansible/timezone/issues
license: AGPL-3.0-or-later
min_ansible_version: 2.1
platforms:
- name: Alpine
- name: Debian
versions:
- stretch
- buster
- bullseye
- name: Ubuntu
versions:
- trusty
- xenial
- bionic
- focal
- groovy
- hirsute
- impish
- name: Fedora
versions:
- 38
- 39
- 40
- name: EL
versions:
- 6
- 7
- 8
- 9
galaxy_tags:
- operations
dependencies: []

30
tasks/main.yml Normal file
View file

@ -0,0 +1,30 @@
---
- 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"

7
timezone.yml Normal file
View file

@ -0,0 +1,7 @@
---
- host: all
roles:
- role: timezone
# vars:
# timezone_zone: Europe/Berlin