---

- block:

  - name: APT | Install APCu
    apt:
      pkg: "php-apcu"

  - name: APT | Install Opcache
    apt:
      pkg: "{{ php_package_prefix }}opcache"

  when: ansible_os_family == 'Debian'

- block:

  - name: PKGNG | Install APCu
    pkgng:
      name: "php{{ php_version | replace('.', '') }}-pecl-APCu"

  - name: PKGNG | Install Opcache
    pkgng:
      name: "{{ php_package_prefix }}opcache"

  when: ansible_os_family == 'FreeBSD'

- name: TEMPLATE | Configure Opcache
  template:
    src: "etc/__php__/mods-available/opcache.ini.j2"
    dest: "{{ php_mods_dir }}/opcache.ini"
  notify: restart php-fpm

- name: TEMPLATE | Configure APCu
  template:
    src: "etc/__php__/mods-available/apcu.ini.j2"
    dest: "{{ php_mods_dir }}/apcu.ini"
  notify: restart php-fpm