This commit is contained in:
Ruben Blanco 2023-10-27 14:35:12 +02:00
parent ce1dc502ac
commit 64a4fd209f
2 changed files with 17 additions and 25 deletions

View File

@ -0,0 +1,4 @@
#!/bin/bash
echo "Europe" > /etc/timezone
ln -sf /usr/share/zoneinfo/Europe/Madrid /etc/localtime
dpkg-reconfigure -f noninteractive tzdata

View File

@ -1,29 +1,17 @@
---
- name: Set the timezone using dpkg-reconfigure
expect:
command: dpkg-reconfigure -f noninteractive tzdata
responses:
"Geographic area:": "Europe"
#- "Europe" # Replace with your desired geographic area
"Time zone:": "Madrid"
#- "Madrid" # Replace with your desired city or timezone
- name: copy script set_timezone.sh to tmp
copy:
src: set_timezone.sh
dest: /tmp/set_timezone.sh
owner: root
group: root
mode: '0744'
#- name: Set the timezone for tzdata package
# debconf:
# name: tzdata
# question: "tzdata/Areas"
# vtype: select
# value: "Europe" # Replace with the desired region, e.g., "America,Europe.."
# #state: present
- name: execute script set_timezone.sh
script: /tmp/set_timezone.sh
#- name: Set the city for tzdata package
# debconf:
# name: tzdata
# question: "tzdata/Zones/Europe"
# vtype: select
# value: "Madrid" # Replace with the desired city/timezone
#state: present
#- name: Run dpkg-reconfigure to apply the timezone changes
# command: dpkg-reconfigure -f noninteractive tzdata
- name: delete script set_timezone.sh on tmp directory
file:
path: /tmp/set_timezone.sh
state: absent