| --- |
| # php tasks/Debian.yml |
| # |
| # SPDX-FileCopyrightText: © 2020 Open Networking Foundation <support@opennetworking.org> |
| # SPDX-License-Identifier: Apache-2.0 |
| |
| # PHP from this PPA for Ubuntu: https://launchpad.net/~ondrej/+archive/ubuntu/php |
| - name: Add PHP apt repo GPG key (Ubuntu) |
| when: 'ansible_distribution == "Ubuntu"' |
| apt_key: |
| data: "{{ lookup('file','ubuntu_ondrej_php_ppa.key') }}" |
| state: "present" |
| |
| - name: Add PHP apt repo (Ubuntu) |
| when: 'ansible_distribution == "Ubuntu"' |
| apt_repository: |
| repo: >- |
| deb http://ppa.launchpad.net/ondrej/php/{{ ansible_lsb['id'] | lower }} |
| {{ ansible_lsb['codename'] }} main |
| update_cache: true |
| |
| # PHP from this apt repo for Debian: https://deb.sury.org/ |
| - name: Add PHP apt repo GPG key (Debian) |
| when: 'ansible_distribution == "Debian"' |
| apt_key: |
| data: "{{ lookup('file','debian_packages_sury_org_php.gpg') }}" |
| state: "present" |
| |
| - name: Add PHP apt repo (Debian) |
| when: 'ansible_distribution == "Debian"' |
| apt_repository: |
| repo: "deb https://packages.sury.org/php/ {{ ansible_lsb['codename'] }} main" |
| update_cache: true |
| |
| - name: Install PHP packages |
| apt: |
| name: "{{ php_packages }}" |
| state: "present" |
| update_cache: true |
| cache_valid_time: 3600 |
| notify: |
| - start-php |
| |
| - name: Configure PHP-FPM service |
| lineinfile: |
| path: "/etc/php/{{ php_version }}/fpm/pool.d/www.conf" |
| regexp: "^{{ item.key }}.*$" |
| line: "{{ item.key }} = {{ item.value }}" |
| loop: "{{ php_fpm_config | dict2items }}" |
| notify: |
| - restart-php |