---
- name: Converge
  hosts: all
  become: true

  vars:
    php_enablerepo: "remi,remi-php82"
    php_enable_webserver: false
    php_version: '8.2'

    # Test a global requirement.
    composer_global_packages:
      - name: phpunit/phpunit
        release: "@stable"

  pre_tasks:
    - name: Update apt cache.
      apt: update_cache=yes cache_valid_time=600
      when: ansible_os_family == 'Debian'

    - name: Set php_packages for Fedora install.
      set_fact:
        php_packages:
          - php
          - php-cli
          - php-common
          - php-devel
          - php-mbstring
          - php-opcache
          - php-pecl-apcu
          - php-xml
          - php-json
      when: ansible_distribution == 'Fedora'

  roles:
    - role: geerlingguy.repo-remi
      when: ansible_os_family == 'RedHat' and ansible_distribution != 'Fedora'
    - role: geerlingguy.git
    - role: geerlingguy.php-versions
    - role: geerlingguy.php
    - role: geerlingguy.composer
