--- - name: Install prerequisite packages for PHP repository ansible.builtin.apt: name: - ca-certificates - curl - gpg state: present - name: Add PHP repository key (Ondrej) ansible.builtin.shell: | curl -fsSL https://packages.sury.org/php/apt.gpg | gpg --dearmor -o /etc/apt/trusted.gpg.d/sury-php.gpg args: creates: /etc/apt/trusted.gpg.d/sury-php.gpg - name: Add PHP repository ansible.builtin.apt_repository: repo: "deb https://packages.sury.org/php/ {{ ansible_facts['lsb']['codename'] }} main" state: present update_cache: yes - name: Install PHP 8.4 and extensions ansible.builtin.apt: name: - php8.4 - libapache2-mod-php8.4 - php8.4-mysql - php8.4-cli - php8.4-curl - php8.4-gd - php8.4-mbstring - php8.4-xml - php8.4-zip - php8.4-intl - php8.4-bcmath - php8.4-imap state: present notify: Restart Apache - name: Set index.php priority ansible.builtin.lineinfile: path: /etc/apache2/mods-enabled/dir.conf regexp: '^(\s*DirectoryIndex)' line: '\1 index.php index.html index.cgi index.pl index.xhtml index.htm' backrefs: yes notify: Restart Apache