blob: dd8e9b77dd917f1a5f61eee64ce20cce30cdb689 [file] [log] [blame]
Zack Williams15c09e72020-10-14 21:30:57 -07001---
2# php tasks/Debian.yml
3#
4# SPDX-FileCopyrightText: © 2020 Open Networking Foundation <support@opennetworking.org>
5# SPDX-License-Identifier: Apache-2.0
6
7# PHP from this PPA for Ubuntu: https://launchpad.net/~ondrej/+archive/ubuntu/php
8- name: Add PHP apt repo GPG key (Ubuntu)
9 when: 'ansible_distribution == "Ubuntu"'
10 apt_key:
11 data: "{{ lookup('file','ubuntu_ondrej_php_ppa.key') }}"
12 state: "present"
13
14- name: Add PHP apt repo (Ubuntu)
15 when: 'ansible_distribution == "Ubuntu"'
16 apt_repository:
17 repo: >-
18 deb http://ppa.launchpad.net/ondrej/php/{{ ansible_lsb['id'] | lower }}
19 {{ ansible_lsb['codename'] }} main
20 update_cache: true
21
22# PHP from this apt repo for Debian: https://deb.sury.org/
23- name: Add PHP apt repo GPG key (Debian)
24 when: 'ansible_distribution == "Debian"'
25 apt_key:
26 data: "{{ lookup('file','debian_packages_sury_org_php.gpg') }}"
27 state: "present"
28
29- name: Add PHP apt repo (Debian)
30 when: 'ansible_distribution == "Debian"'
31 apt_repository:
32 repo: "deb https://packages.sury.org/php/ {{ ansible_lsb['codename'] }} main"
33 update_cache: true
34
35- name: Install PHP packages
36 apt:
37 name: "{{ php_packages }}"
38 state: "present"
39 update_cache: true
40 cache_valid_time: 3600
41 notify:
42 - start-php
Zack Williams2b6937a2021-07-07 13:36:22 -070043 - restart-php # load new packages
Zack Williamscf75b762021-07-02 16:48:26 -070044
45- name: Configure PHP-FPM service
46 lineinfile:
47 path: "/etc/php/{{ php_version }}/fpm/pool.d/www.conf"
48 regexp: "^{{ item.key }}.*$"
49 line: "{{ item.key }} = {{ item.value }}"
50 loop: "{{ php_fpm_config | dict2items }}"
51 notify:
52 - restart-php
Zack Williams2b6937a2021-07-07 13:36:22 -070053
54- name: Configure PHP-FPM php.ini file
55 lineinfile:
56 path: "/etc/php/{{ php_version }}/fpm/php.ini"
57 regexp: "^{{ item.key }}.*$"
58 line: "{{ item.key }} = {{ item.value }}"
59 loop: "{{ php_ini_config | dict2items }}"
60 notify:
61 - restart-php