29 lines
858 B
YAML
29 lines
858 B
YAML
---
|
|
- name: Add Sury PHP Repository
|
|
shell: add-apt-repository -y ppa:ondrej/php
|
|
args:
|
|
creates: "/etc/apt/sources.list.d/ondrej-ubuntu-php-jammy.list"
|
|
when: php_version is defined # add repo when version is specified, otherwise use default repo
|
|
|
|
- name: "Uninstall old PHP version"
|
|
apt:
|
|
name: "php{{ php_old_version }}*"
|
|
state: absent
|
|
purge: true
|
|
when: php_old_version is defined # uninstall when old version is specified
|
|
|
|
- name: "Install custom PHP modules {{ php_modules }}"
|
|
apt:
|
|
name: "{{ ['php' + php_version] | product(php_modules) | map('join', '-') | list }}"
|
|
state: latest
|
|
update_cache: true
|
|
cache_valid_time: 3600
|
|
|
|
- name: Copy Nginx PHP-Handler
|
|
template:
|
|
dest: /etc/nginx/conf.d/php-handler.conf
|
|
src: php-handler.conf.j2
|
|
mode: "0644"
|
|
when: '"fpm" in php_modules'
|
|
notify: reload nginx
|