---
- name: Validate Ansible version
  assert:
    that:
     - "{{ ansible_version is defined }}"
     - "{{ ansible_version.full | version_compare(minimum_ansible_version, '>=') }}"
    msg: "Your Ansible version is too old. Trellis require at least {{ minimum_ansible_version }}. Your version is {{ ansible_version.full | default('< 1.6') }}"

- name: Update Apt
  apt: update_cache=yes

- name: Checking essentials
  apt: name="{{ item }}" state=present
  with_items:
  - python-software-properties
  - python-pycurl
  - build-essential
  - python-mysqldb
  - curl
  - git-core
  - unzip
  - imagemagick
  - htop
  - gunzip

- 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

- include: symlinks.yml

---
- name: Validate Ansible version
  assert:
    that:
     - "{{ ansible_version is defined }}"
     - "{{ ansible_version.full | version_compare(minimum_ansible_version, '>=') }}"
    msg: "Your Ansible version is too old. Trellis require at least {{ minimum_ansible_version }}. Your version is {{ ansible_version.full | default('< 1.6') }}"

- name: Update Apt
  apt: update_cache=yes

- name: Checking essentials
  apt: name="{{ item }}" state=present
  with_items:
  - python-software-properties
  - python-pycurl
  - build-essential
  - python-mysqldb
  - curl
  - git-core
  - unzip
  - imagemagick
  - htop

- 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

- include: symlinks.yml

Revert "Added gunzip as common utility."
Revert "Added gunzip as common utility."

This reverts commit 3f12d61c39499b8f55d31314e2e83a9277f52264.
