--- - name: Install php notify: restart php-fpm package: name: - php-apcu - php-bcmath - php-cgi - php-cli - php-curl - php-dev - php-fpm - php-gd - php-gmp - php-mbstring - php-mysql - php-imagick - php-intl - php-redis - php-pspell - php-xmlrpc - php-zip state: latest - name: set php config notify: restart php-fpm lineinfile: path: "/etc/php/{{ php_version }}/fpm/php.ini" regex: "^{{item.key}}\\s+=.*" line: "{{ item.key }} = {{ item.value }}" with_items: "{{ php_config }}" - name: set php-fpm config notify: restart php-fpm lineinfile: path: "/etc/php/{{ php_version }}/fpm/pool.d/www.conf" regex: '^env\[{{item.key}}\]\s+=.*' line: "env[{{ item.key }}] = {{ item.value }}" create: yes with_items: "{{ php_fpm_env }}"