Files
Ansible/roles/php/tasks/main.yml
Oli b9af96fbbe replace apt_repository with shell module
apt_repository use deprecated apt-key
2023-02-28 01:52:50 +00:00

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