-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve PHP version detection on Debian-based systems
- Loading branch information
1 parent
bd274e7
commit f6741f3
Showing
5 changed files
with
29 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
--- | ||
php_version: | ||
# Undefined by default, is populated during the run | ||
php: | ||
prefix: | ||
config: >- | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,16 @@ | ||
--- | ||
- name: Set the PHP version | ||
ansible.builtin.include_tasks: phpversion.yaml | ||
|
||
- name: Install PHP and extensions (Ubuntu/Debian) | ||
when: ansible_os_family == 'Debian' | ||
ansible.builtin.import_tasks: install.yaml | ||
ansible.builtin.include_tasks: install.yaml | ||
|
||
- name: Set up phpfpmtop | ||
ansible.builtin.import_tasks: phpfpmtop.yaml | ||
ansible.builtin.include_tasks: phpfpmtop.yaml | ||
|
||
- name: Configure PHP-FPM | ||
ansible.builtin.import_tasks: phpfpm.yaml | ||
ansible.builtin.include_tasks: phpfpm.yaml | ||
|
||
- name: Configure PHP | ||
ansible.builtin.import_tasks: php.yaml | ||
ansible.builtin.include_tasks: php.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
- name: Get PHP version | ||
changed_when: no | ||
register: php_version_full | ||
check_mode: no | ||
ansible.builtin.shell: | ||
cmd: >- | ||
Check warning on line 7 in tasks/phpversion.yaml
|
||
{%- if ansible_os_family == 'Debian' -%} | ||
apt update && | ||
apt-cache search --names-only "^php[0-9].[0-9]$" | awk '{print $1}' | ||
{%- elif ansible_os_family == 'FreeBSD' -%} | ||
# PHP is already installed on the Proserver hosts, no need to query the packages | ||
php -r 'echo phpversion();' | grep -o '[0-9]\.[0-9]' | head -n1 | ||
{%- else -%} | ||
echo "Unsupported OS" && exit 1 | ||
{%- endif -%} | ||
- name: Set PHP version fact | ||
ansible.builtin.set_fact: | ||
php_version: "{{ php_version_full.stdout }}" |