handle multiple PHP versions and their modules
This commit is contained in:
@@ -1,20 +1,20 @@
|
||||
---
|
||||
- name: php | installing php and modules
|
||||
- name: php | installing php common and base modules
|
||||
apt:
|
||||
name:
|
||||
- php{{ php_version }}-fpm
|
||||
- php{{ php_version }}-common
|
||||
- php{{ php_version }}-cli
|
||||
- php{{ php_version }}-curl
|
||||
- php{{ php_version }}-opcache
|
||||
- php{{ item.version }}-common
|
||||
- php{{ item.version }}-cli
|
||||
state: present
|
||||
loop: "{{ php_versions }}"
|
||||
notify:
|
||||
- restart php-fpm
|
||||
- restart php-fpm services
|
||||
|
||||
- name: php | install extra modules
|
||||
apt:
|
||||
name: '{{ php_modules | list }}'
|
||||
name: "{{ item.modules | map('regex_replace', '^(.*)$', 'php' + item.version + '-\\1') | list }}"
|
||||
state: present
|
||||
force: yes
|
||||
loop: "{{ php_versions }}"
|
||||
when: item.modules is defined and item.modules | length > 0
|
||||
notify:
|
||||
- restart php-fpm
|
||||
- restart php-fpm services
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
---
|
||||
- name: php | apt update cache
|
||||
apt:
|
||||
ansible.builtin.apt:
|
||||
update_cache: yes
|
||||
cache_valid_time: 86400
|
||||
|
||||
- name: php | install requirements
|
||||
apt:
|
||||
ansible.builtin.apt:
|
||||
name:
|
||||
- apt-transport-https
|
||||
- lsb-release
|
||||
@@ -14,13 +14,13 @@
|
||||
state: present
|
||||
|
||||
- name: php | add sury key
|
||||
apt_key:
|
||||
ansible.builtin.apt_key:
|
||||
url: https://packages.sury.org/php/apt.gpg
|
||||
keyring: /etc/apt/trusted.gpg.d/php.gpg
|
||||
state: present
|
||||
|
||||
- name: php | add sury repository
|
||||
apt_repository:
|
||||
- name: php | add sury repository
|
||||
ansible.builtin.apt_repository:
|
||||
repo: deb https://packages.sury.org/php/ {{ ansible_distribution_release }} main
|
||||
state: present
|
||||
filename: php-sury
|
||||
|
||||
Reference in New Issue
Block a user