mirror of
https://github.com/geerlingguy/ansible-role-php-versions.git
synced 2024-11-28 11:15:20 +01:00
042b9f01c8
[DEPRECATION WARNING]: Invoking "apt" only once while using a loop via squash_actions is deprecated. Instead of using a loop to supply multiple items and specifying `name: "{{ item }}"`, please use `name: ['php5.6-common', 'php7.0-common', 'php7.1-common', 'php7.2-common', 'php7.3-common']` and remove the loop. This feature will be removed in version 2.11. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.
55 lines
1.5 KiB
YAML
55 lines
1.5 KiB
YAML
---
|
|
- name: Set the correct opcache filename (Ubuntu/Debian).
|
|
set_fact:
|
|
php_opcache_conf_filename: "10-opcache.ini"
|
|
|
|
- name: Add repository for PHP versions (Ubuntu).
|
|
apt_repository: repo='ppa:ondrej/php'
|
|
when: ansible_distribution == "Ubuntu"
|
|
|
|
- name: Add repository for PHP 5 compatibility packages (Ubuntu).
|
|
apt_repository: repo='ppa:ondrej/php5-compat'
|
|
when:
|
|
- php_version == "5.6"
|
|
- ansible_distribution == "Ubuntu"
|
|
- ansible_distribution_release != "bionic"
|
|
|
|
# Debian-specific tasks.
|
|
- name: Add dependencies for PHP versions (Debian).
|
|
apt:
|
|
name:
|
|
- apt-transport-https
|
|
- ca-certificates
|
|
state: present
|
|
when: ansible_distribution == "Debian"
|
|
|
|
- name: Add Ondrej Sury's apt key (Debian).
|
|
apt_key:
|
|
url: https://packages.sury.org/php/apt.gpg
|
|
state: present
|
|
when: ansible_distribution == "Debian"
|
|
|
|
- name: Add Ondrej Sury's repo (Debian).
|
|
apt_repository:
|
|
repo: "deb https://packages.sury.org/php/ {{ ansible_distribution_release }} main"
|
|
state: present
|
|
register: php_ondrej_debian_repo
|
|
when: ansible_distribution == "Debian"
|
|
|
|
- name: Update apt caches after repo is added (Debian).
|
|
apt: update_cache=true
|
|
when:
|
|
- php_ondrej_debian_repo.changed
|
|
- ansible_distribution == "Debian"
|
|
tags: ['skip_ansible_lint']
|
|
|
|
# PHP package purges.
|
|
- name: Purge PHP version packages.
|
|
apt:
|
|
name: "{{ __php_versions_debian |
|
|
reject('search', 'php' ~ php_version) |
|
|
list }}"
|
|
state: absent
|
|
purge: true
|
|
force: true
|