--- - name: install requirements for php repository apt: update_cache: yes state: "{% if cloud_update | bool %}latest{% else %}present{% endif %}" install_recommends: yes pkg: - apt-transport-https - ca-certificates - gnupg2 - lsb-release - name: Create keyrings directory file: path: /etc/apt/keyrings state: directory mode: '0755' - name: Download Sury PHP repository key get_url: url: https://packages.sury.org/php/apt.gpg dest: /etc/apt/keyrings/sury-php.gpg mode: '0644' - name: Add Sury PHP repository apt_repository: repo: >- deb [signed-by=/etc/apt/keyrings/sury-php.gpg] https://packages.sury.org/php/ {{ ansible_distribution_release }} main state: present filename: sury-php - name: Update apt cache apt: update_cache: yes - name: install PHP and recommendations apt: update_cache: yes state: "{% if cloud_update | bool %}latest{% else %}present{% endif %}" install_recommends: yes pkg: "{{ php_modules + php_modules_base }}" - name: configure PHP fpm lineinfile: path: "{{ php_path }}/fpm/php.ini" regexp: '^(;|){{ item.key }}( |)=( |)' line: "{{ item.key }}={{ item.value }}" loop: "{{ php_fpm_config + php_fpm_config_default }}" loop_control: label: "{{ item.key }}" notify: restart php-fpm - name: configure PHP fpm pool conf lineinfile: path: "{{ php_path }}/fpm/pool.d/www.conf" regexp: '^(;|){{ item.key }}( |)=( |)' line: "{{ item.key }}={{ item.value }}" loop: "{{ php_fpm_poolconf + php_fpm_poolconf_default }}" loop_control: label: "{{ item.key }}" notify: restart php-fpm - name: configure PHP fpm env pool conf lineinfile: path: "{{ php_path }}/fpm/pool.d/www.conf" regexp: '^(;|)env\[{{ item.key }}\]( |)=( |)' line: "env[{{ item.key }}]={{ item.value }}" loop: "{{ php_fpm_poolconf_env }}" loop_control: label: "{{ item.key }}" notify: restart php-fpm - name: configure PHP apcu availability lineinfile: path: "{{ php_path }}/mods-available/apcu.ini" regexp: '^(;\s*|)apc.enable_cli=' line: "apc.enable_cli=1" notify: restart php-fpm