Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow user to set the timezone of the server and php #301

Merged
merged 1 commit into from
Aug 15, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions group_vars/all
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
apt_cache_valid_time: 86400
default_timezone: Etc/UTC
mariadb_dist: trusty
mysql_user: root
www_root: /srv/www
Expand Down
1 change: 1 addition & 0 deletions roles/common/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
minimum_ansible_version: 1.9.2
default_timezone: Etc/UTC
18 changes: 18 additions & 0 deletions roles/common/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,21 @@
- python-mysqldb
- curl
- git-core

- name: Validate timezone variable
stat: path=/usr/share/zoneinfo/{{ default_timezone }}
register: timezone_path
changed_when: false

- name: Explain timezone error
fail: msg="{{ default_timezone }} is not a valid timezone. For a list of valid timezones, check https://php.net/manual/en/timezones.php"
when: not timezone_path.stat.exists

- name: Get current timezone
command: cat /etc/timezone
register: current_timezone
changed_when: false

- name: Set timezone
command: timedatectl set-timezone {{ default_timezone }}
when: current_timezone.stdout != default_timezone
1 change: 1 addition & 0 deletions roles/php/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ php_sendmail_path: /usr/sbin/ssmtp -t
php_session_save_path: /tmp
php_upload_max_filesize: 25M
php_track_errors: 'Off'
php_default_timezone: '{{ default_timezone }}'

php_opcache_enable: 1
php_opcache_enable_cli: 1
Expand Down
1 change: 1 addition & 0 deletions roles/php/templates/php.ini.j2
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ session.save_path = {{ php_session_save_path }}
track_errors = {{ php_track_errors }}
upload_max_filesize = {{ php_upload_max_filesize }}
expose_php = Off
date.timezone = {{ php_default_timezone }}

[mysqlnd]
mysqlnd.collect_memory_statistics = {{ php_mysqlnd_collect_memory_statistics }}
Expand Down