Lenverge/roles/php/tasks/main.yml
2025-06-15 09:24:28 +08:00

26 lines
834 B
YAML

---
- name: "Install required PHP versions and extensions"
ansible.builtin.apt:
name:
- "php{{ item }}"
- "php{{ item }}-fpm"
- "php{{ item }}-cli"
- "php{{ item }}-common"
- "php{{ item }}-mysql"
- "php{{ item }}-pgsql"
- "php{{ item }}-xml"
- "php{{ item }}-zip"
- "php{{ item }}-mbstring"
- "php{{ item }}-curl"
- "php{{ item }}-bcmath"
state: present
loop: "{{ php_versions_to_install }}"
when: php_versions_to_install is defined and php_versions_to_install | length > 0
- name: "Ensure all PHP-FPM services are enabled and started"
ansible.builtin.service:
name: "php{{ item }}-fpm"
enabled: yes
state: started
loop: "{{ php_versions_to_install }}"
when: php_versions_to_install is defined and php_versions_to_install | length > 0