---
# Debian 9 Stretch ONLY

# We use the sury.org PHP repositories which contains many versions of PHP
# All of these versions will be newere than comes stock with debian

# Add sury.org GPG keys
- name: Addding sury.org PHP sources GPG key
  apt_key: url='https://packages.sury.org/php/apt.gpg' state=present

# Add sury.org PHP repositories - Debian 8 Jessie
- name: Adding sury.org PHP sources for Debian 8 Jessie
  apt_repository: repo='deb https://packages.sury.org/php/ jessie main' state=present
  when: ansible_os_family == "Debian" and ansible_distribution_major_version == "8"

# Add sury.org PHP repositories - Debian 9 Stretch
- name: Adding sury.org PHP sources for Debian 9 Stretch
  apt_repository: repo='deb https://packages.sury.org/php/ stretch main' state=present
  when: ansible_os_family == "Debian" and ansible_distribution_major_version == "9"

# Add sury.org PHP repositories - Debian 10 Buster
- name: Adding sury.org PHP sources for Debian 10 Buster
  apt_repository: repo='deb https://packages.sury.org/php/ buster main' state=present
  when: ansible_os_family == "Debian" and ansible_distribution_major_version == "10"

# Install PHP 7.2
- name: Installing PHP 7.2
  apt:
    update_cache: yes
    state: present
    name:
      - php7.2-bcmath
      - php7.2-bz2
      - php7.2-cli
      - php7.2-common
      - php7.2-curl
      - php7.2-fpm
      - php7.2-gd
      - php7.2-imap
      - php7.2-intl
      - php7.2-json
      - php7.2-ldap
      - php7.2-mbstring
      #- php7.2-mcrypt # Gone in 7.2
      - php7.2-mysql
      - php7.2-opcache
      - php7.2-readline
      - php7.2-soap
      - php7.2-sybase
      - php7.2-xml
      - php7.2-zip
