---
# We use the sury.org PHP repositories which contains many versions of PHP
# All of these versions will be newer 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"

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