mirror of
https://github.com/HanXHX/ansible-php.git
synced 2026-02-28 09:42:09 +07:00
Compare commits
8 Commits
fix_lint
...
new_releas
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b08ebe25bb | ||
|
|
abe0801363 | ||
|
|
6881f70517 | ||
|
|
a6e75032a5 | ||
|
|
57aee1fbc4 | ||
|
|
2f4bc96d6a | ||
|
|
387b03ddbf | ||
|
|
99f4da524b |
@@ -4,6 +4,8 @@ env:
|
|||||||
global:
|
global:
|
||||||
- VAGRANT_VERSION='2.2.18'
|
- VAGRANT_VERSION='2.2.18'
|
||||||
jobs:
|
jobs:
|
||||||
|
- PLATFORM='docker-debian-stretch-php70' ANSIBLE_VERSION='>=2.11,<2.12'
|
||||||
|
- PLATFORM='docker-debian-stretch-php74' ANSIBLE_VERSION='>=2.11,<2.12'
|
||||||
- PLATFORM='docker-debian-buster-php73' ANSIBLE_VERSION='>=2.11,<2.12'
|
- PLATFORM='docker-debian-buster-php73' ANSIBLE_VERSION='>=2.11,<2.12'
|
||||||
- PLATFORM='docker-debian-bullseye-php74' ANSIBLE_VERSION='>=2.11,<2.12'
|
- PLATFORM='docker-debian-bullseye-php74' ANSIBLE_VERSION='>=2.11,<2.12'
|
||||||
- PLATFORM='docker-debian-bullseye-php80' ANSIBLE_VERSION='>=2.11,<2.12'
|
- PLATFORM='docker-debian-bullseye-php80' ANSIBLE_VERSION='>=2.11,<2.12'
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
Ansible PHP (+FPM) role for Debian / Ubuntu / FreeBSD
|
Ansible PHP (+FPM) role for Debian / Ubuntu / FreeBSD
|
||||||
=====================================================
|
=====================================================
|
||||||
|
|
||||||
[](https://galaxy.ansible.com/hanxhx.php) [](https://app.travis-ci.com/HanXHX/ansible-php)
|
[](https://galaxy.ansible.com/HanXHX/php) [](https://app.travis-ci.com/HanXHX/ansible-php)
|
||||||
|
|
||||||
Install PHP on Debian / Ubuntu / FreeBSD. Manage PHP-FPM, APCu, Opcache and Xdebug.
|
Install PHP on Debian / Ubuntu / FreeBSD. Manage PHP-FPM, APCu, Opcache and Xdebug.
|
||||||
|
|
||||||
Managed OS / Versions
|
Managed OS / Versions
|
||||||
---------------------
|
---------------------
|
||||||
|
|
||||||
On all Debian versions, you can install all PHP versions by using [Sury's APT repository](https://deb.sury.org/).
|
On all Debian versions, you can install all PHP versions (from PHP 5.6 to 8.1 beta) by using [Sury's APT repository](https://deb.sury.org/).
|
||||||
|
|
||||||
Other cases:
|
Other cases:
|
||||||
|
|
||||||
@@ -161,14 +161,14 @@ Example Playbook
|
|||||||
|
|
||||||
- hosts: servers
|
- hosts: servers
|
||||||
roles:
|
roles:
|
||||||
- { role: hanxhx.php }
|
- { role: HanXHX.php }
|
||||||
|
|
||||||
### Debian Bullseye with PHP 8.0 CLI (no FPM)
|
### Debian Bullseye with PHP 8.0 CLI (no FPM)
|
||||||
|
|
||||||
- hosts: servers
|
- hosts: servers
|
||||||
roles:
|
roles:
|
||||||
- { role: HanXHX.sury }
|
- { role: HanXHX.sury }
|
||||||
- { role: hanxhx.php, php_version: '8.0', php_install_fpm: false }
|
- { role: HanXHX.php, php_version: '8.0', php_install_fpm: false }
|
||||||
|
|
||||||
License
|
License
|
||||||
-------
|
-------
|
||||||
|
|||||||
12
Vagrantfile
vendored
12
Vagrantfile
vendored
@@ -6,6 +6,8 @@
|
|||||||
Vagrant.configure("2") do |config|
|
Vagrant.configure("2") do |config|
|
||||||
|
|
||||||
vms_debian = [
|
vms_debian = [
|
||||||
|
{ :name => "debian-stretch-php70", :box => "debian/stretch64", :vars => { }},
|
||||||
|
{ :name => "debian-stretch-php74", :box => "debian/stretch64", :vars => { "php_version": '7.4' }},
|
||||||
{ :name => "debian-buster-php73", :box => "debian/buster64", :vars => { }},
|
{ :name => "debian-buster-php73", :box => "debian/buster64", :vars => { }},
|
||||||
{ :name => "debian-buster-php74", :box => "debian/buster64", :vars => { "php_version": '7.4' }},
|
{ :name => "debian-buster-php74", :box => "debian/buster64", :vars => { "php_version": '7.4' }},
|
||||||
{ :name => "debian-bullseye-php74", :box => "debian/bullseye64", :vars => { }},
|
{ :name => "debian-bullseye-php74", :box => "debian/bullseye64", :vars => { }},
|
||||||
@@ -19,6 +21,8 @@ Vagrant.configure("2") do |config|
|
|||||||
]
|
]
|
||||||
|
|
||||||
conts = [
|
conts = [
|
||||||
|
{ :name => "docker-debian-stretch-php70", :docker => "hanxhx/vagrant-ansible:debian9", :vars => { }},
|
||||||
|
{ :name => "docker-debian-stretch-php74", :docker => "hanxhx/vagrant-ansible:debian9", :vars => { "php_version": '7.4' }},
|
||||||
{ :name => "docker-debian-buster-php73", :docker => "hanxhx/vagrant-ansible:debian10", :vars => { }},
|
{ :name => "docker-debian-buster-php73", :docker => "hanxhx/vagrant-ansible:debian10", :vars => { }},
|
||||||
{ :name => "docker-debian-buster-php74", :docker => "hanxhx/vagrant-ansible:debian10", :vars => { "php_version": '7.4' }},
|
{ :name => "docker-debian-buster-php74", :docker => "hanxhx/vagrant-ansible:debian10", :vars => { "php_version": '7.4' }},
|
||||||
{ :name => "docker-debian-bullseye-php74", :docker => "hanxhx/vagrant-ansible:debian11", :vars => { }},
|
{ :name => "docker-debian-bullseye-php74", :docker => "hanxhx/vagrant-ansible:debian11", :vars => { }},
|
||||||
@@ -36,6 +40,10 @@ Vagrant.configure("2") do |config|
|
|||||||
d.has_ssh = true
|
d.has_ssh = true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if opts[:name].include? "bullseye"
|
||||||
|
m.vm.provision "shell", inline: "[ -f '/root/first_provision' ] || (apt-get update -qq && apt-get -y dist-upgrade && touch /root/first_provision)"
|
||||||
|
end
|
||||||
|
|
||||||
#m.vm.provision "shell", inline: "apt-get update && apt-get install -y python python-apt"
|
#m.vm.provision "shell", inline: "apt-get update && apt-get install -y python python-apt"
|
||||||
m.vm.provision "ansible" do |ansible|
|
m.vm.provision "ansible" do |ansible|
|
||||||
ansible.playbook = "tests/test.yml"
|
ansible.playbook = "tests/test.yml"
|
||||||
@@ -55,6 +63,10 @@ Vagrant.configure("2") do |config|
|
|||||||
end
|
end
|
||||||
m.vm.provision "shell", inline: "apt-get update && apt-get install -y ifupdown python"
|
m.vm.provision "shell", inline: "apt-get update && apt-get install -y ifupdown python"
|
||||||
|
|
||||||
|
if opts[:name].include? "bullseye"
|
||||||
|
m.vm.provision "shell", inline: "[ -f '/root/first_provision' ] || (apt-get update -qq && apt-get -y dist-upgrade && touch /root/first_provision)"
|
||||||
|
end
|
||||||
|
|
||||||
m.vm.provision "ansible" do |ansible|
|
m.vm.provision "ansible" do |ansible|
|
||||||
ansible.playbook = "tests/test.yml"
|
ansible.playbook = "tests/test.yml"
|
||||||
ansible.verbose = 'vv'
|
ansible.verbose = 'vv'
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
---
|
---
|
||||||
|
|
||||||
- name: Restart php-fpm
|
- name: restart php-fpm
|
||||||
ansible.builtin.service:
|
ansible.builtin.service:
|
||||||
name: '{{ php_fpm_service }}'
|
name: '{{ php_fpm_service }}'
|
||||||
state: restarted
|
state: restarted
|
||||||
when: php_install_fpm
|
when: php_install_fpm
|
||||||
notify: Docker restart php-fpm
|
notify: docker restart php-fpm
|
||||||
|
|
||||||
- name: Docker restart php-fpm
|
- name: docker restart php-fpm
|
||||||
ansible.builtin.command: 'service {{ php_fpm_service }} restart'
|
ansible.builtin.command: 'service {{ php_fpm_service }} restart'
|
||||||
args:
|
args:
|
||||||
warn: false
|
warn: false
|
||||||
|
|||||||
@@ -1,6 +0,0 @@
|
|||||||
---
|
|
||||||
|
|
||||||
argument_specs:
|
|
||||||
main:
|
|
||||||
short_description: Main entry point
|
|
||||||
options: {}
|
|
||||||
@@ -1,15 +1,14 @@
|
|||||||
---
|
---
|
||||||
galaxy_info:
|
galaxy_info:
|
||||||
author: Emilien Mantel
|
author: Emilien Mantel
|
||||||
role_name: php
|
description: Install and configure PHP 7.0/7.1/7.2/7.3/7.4/8.0
|
||||||
namespace: hanxhx
|
company:
|
||||||
description: Install and configure PHP 7.x/8.x
|
|
||||||
company: TripleStack
|
|
||||||
license: GPLv2
|
license: GPLv2
|
||||||
min_ansible_version: '2.11'
|
min_ansible_version: 2.11
|
||||||
platforms:
|
platforms:
|
||||||
- name: Debian
|
- name: Debian
|
||||||
versions:
|
versions:
|
||||||
|
- stretch
|
||||||
- buster
|
- buster
|
||||||
- bullseye
|
- bullseye
|
||||||
- name: Ubuntu
|
- name: Ubuntu
|
||||||
@@ -17,9 +16,9 @@ galaxy_info:
|
|||||||
- bionic
|
- bionic
|
||||||
- name: FreeBSD
|
- name: FreeBSD
|
||||||
versions:
|
versions:
|
||||||
- '11.0'
|
- 11.0
|
||||||
- '11.1'
|
- 11.1
|
||||||
- '12.0'
|
- 12.0
|
||||||
galaxy_tags:
|
galaxy_tags:
|
||||||
- development
|
- development
|
||||||
- web
|
- web
|
||||||
@@ -30,5 +29,4 @@ galaxy_info:
|
|||||||
- debian
|
- debian
|
||||||
- ubuntu
|
- ubuntu
|
||||||
- freebsd
|
- freebsd
|
||||||
|
|
||||||
dependencies: []
|
dependencies: []
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
group: root
|
group: root
|
||||||
mode: 0644
|
mode: 0644
|
||||||
loop: "{{ php_ini | combine(php_ini_fpm) | dict2items }}"
|
loop: "{{ php_ini | combine(php_ini_fpm) | dict2items }}"
|
||||||
notify: Restart php-fpm
|
notify: restart php-fpm
|
||||||
|
|
||||||
- name: TEMPLATE | Deploy pool configuration
|
- name: TEMPLATE | Deploy pool configuration
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
@@ -32,11 +32,11 @@
|
|||||||
group: root
|
group: root
|
||||||
mode: 0644
|
mode: 0644
|
||||||
loop: "{{ ansible_local.hanxhx_php.fpm_pool }}"
|
loop: "{{ ansible_local.hanxhx_php.fpm_pool }}"
|
||||||
notify: Restart php-fpm
|
notify: restart php-fpm
|
||||||
|
|
||||||
- name: FILE | Delete default pool if necessary
|
- name: FILE | Delete default pool if necessary
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
path: "{{ php_fpm_pool_dir }}/www.conf"
|
path: "{{ php_fpm_pool_dir }}/www.conf"
|
||||||
state: absent
|
state: absent
|
||||||
when: '"www" not in (ansible_local.hanxhx_php.fpm_pool | map(attribute="name") | list) and php_autoremove_default_pool'
|
when: '"www" not in (ansible_local.hanxhx_php.fpm_pool | map(attribute="name") | list) and php_autoremove_default_pool'
|
||||||
notify: Restart php-fpm
|
notify: restart php-fpm
|
||||||
|
|||||||
@@ -1,14 +1,5 @@
|
|||||||
---
|
---
|
||||||
|
|
||||||
- name: SHELL | Check if we are in multiple PHP distribution
|
|
||||||
ansible.builtin.shell: set -o pipefail && apt-cache search php xdebug | grep 'php[[:digit:]].[[:digit:]]'
|
|
||||||
args:
|
|
||||||
executable: /bin/bash
|
|
||||||
failed_when: false
|
|
||||||
changed_when: false
|
|
||||||
register: multiple_php
|
|
||||||
when: ansible_os_family == 'Debian'
|
|
||||||
|
|
||||||
- name: INCLUDE_VARS | Related to OS family
|
- name: INCLUDE_VARS | Related to OS family
|
||||||
ansible.builtin.include_vars: "OS_Family_{{ ansible_os_family }}.yml"
|
ansible.builtin.include_vars: "OS_Family_{{ ansible_os_family }}.yml"
|
||||||
|
|
||||||
@@ -60,8 +51,6 @@
|
|||||||
group: root
|
group: root
|
||||||
mode: 0644
|
mode: 0644
|
||||||
register: f
|
register: f
|
||||||
tags:
|
|
||||||
- skip_ansible_lint
|
|
||||||
|
|
||||||
- name: SETUP | Gathers new facts
|
- name: SETUP | Gathers new facts
|
||||||
ansible.builtin.setup:
|
ansible.builtin.setup:
|
||||||
@@ -75,16 +64,15 @@
|
|||||||
state: present
|
state: present
|
||||||
update_cache: true
|
update_cache: true
|
||||||
cache_valid_time: 3600
|
cache_valid_time: 3600
|
||||||
install_recommends: false
|
|
||||||
vars:
|
vars:
|
||||||
pkgs: "{{ php_packages + php_extra_packages | flatten }}"
|
pkgs: "{{ php_packages + php_extra_packages | flatten }}"
|
||||||
notify: Restart php-fpm
|
notify: restart php-fpm
|
||||||
when: ansible_os_family == 'Debian'
|
when: ansible_os_family == 'Debian'
|
||||||
|
|
||||||
- name: PKGNG | Install PHP packages
|
- name: PKGNG | Install PHP packages
|
||||||
community.general.pkgng:
|
community.general.pkgng:
|
||||||
name: "{{ php_packages + php_extra_packages | flatten | join(',') }}"
|
name: "{{ php_packages + php_extra_packages | flatten | join(',') }}"
|
||||||
notify: Restart php-fpm
|
notify: restart php-fpm
|
||||||
when: ansible_os_family == 'FreeBSD'
|
when: ansible_os_family == 'FreeBSD'
|
||||||
|
|
||||||
- name: IMPORT_TASKS | PHP-FPM
|
- name: IMPORT_TASKS | PHP-FPM
|
||||||
@@ -109,9 +97,7 @@
|
|||||||
state: started
|
state: started
|
||||||
when: php_install_fpm and ansible_virtualization_type != 'docker'
|
when: php_install_fpm and ansible_virtualization_type != 'docker'
|
||||||
|
|
||||||
- name: BLOCK | Ensure PHP-FPM is started if running on Docker
|
- block:
|
||||||
when: php_install_fpm and ansible_virtualization_type == 'docker'
|
|
||||||
block:
|
|
||||||
|
|
||||||
- name: COMMAND | Check if PHP-FPM is started (Docker)
|
- name: COMMAND | Check if PHP-FPM is started (Docker)
|
||||||
ansible.builtin.command: 'service {{ php_fpm_service }} status'
|
ansible.builtin.command: 'service {{ php_fpm_service }} status'
|
||||||
@@ -126,3 +112,5 @@
|
|||||||
args:
|
args:
|
||||||
warn: false
|
warn: false
|
||||||
when: dps.stdout.find('is not running') != -1
|
when: dps.stdout.find('is not running') != -1
|
||||||
|
|
||||||
|
when: php_install_fpm and ansible_virtualization_type == 'docker'
|
||||||
|
|||||||
@@ -1,23 +1,18 @@
|
|||||||
---
|
---
|
||||||
|
|
||||||
- name: Install opcache/apcu on Debian
|
- block:
|
||||||
when: ansible_os_family == 'Debian'
|
|
||||||
block:
|
|
||||||
|
|
||||||
- name: APT | Install APCu
|
- name: APT | Install APCu
|
||||||
ansible.builtin.apt:
|
ansible.builtin.apt:
|
||||||
pkg: "{{ php_apcu_package }}"
|
pkg: "php-apcu"
|
||||||
install_recommends: false
|
|
||||||
|
|
||||||
- name: APT | Install Opcache
|
- name: APT | Install Opcache
|
||||||
ansible.builtin.apt:
|
ansible.builtin.apt:
|
||||||
pkg: "{{ php_package_prefix }}opcache"
|
pkg: "{{ php_package_prefix }}opcache"
|
||||||
install_recommends: false
|
|
||||||
|
|
||||||
|
when: ansible_os_family == 'Debian'
|
||||||
|
|
||||||
- name: Install opcache/apcu on FreeBSD
|
- block:
|
||||||
when: ansible_os_family == 'FreeBSD'
|
|
||||||
block:
|
|
||||||
|
|
||||||
- name: PKGNG | Install APCu
|
- name: PKGNG | Install APCu
|
||||||
community.general.pkgng:
|
community.general.pkgng:
|
||||||
@@ -27,6 +22,8 @@
|
|||||||
community.general.pkgng:
|
community.general.pkgng:
|
||||||
name: "{{ php_package_prefix }}opcache"
|
name: "{{ php_package_prefix }}opcache"
|
||||||
|
|
||||||
|
when: ansible_os_family == 'FreeBSD'
|
||||||
|
|
||||||
- name: TEMPLATE | Configure Opcache
|
- name: TEMPLATE | Configure Opcache
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: "etc/__php__/mods-available/opcache.ini.j2"
|
src: "etc/__php__/mods-available/opcache.ini.j2"
|
||||||
@@ -34,7 +31,7 @@
|
|||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
mode: 0644
|
mode: 0644
|
||||||
notify: Restart php-fpm
|
notify: restart php-fpm
|
||||||
|
|
||||||
- name: TEMPLATE | Configure APCu
|
- name: TEMPLATE | Configure APCu
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
@@ -43,4 +40,4 @@
|
|||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
mode: 0644
|
mode: 0644
|
||||||
notify: Restart php-fpm
|
notify: restart php-fpm
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
---
|
---
|
||||||
|
|
||||||
- name: BLOCK | Uninstall xdebug
|
- block:
|
||||||
when: php_install_xdebug
|
|
||||||
block:
|
|
||||||
|
|
||||||
- name: APT | Install xdebug
|
- name: APT | Install xdebug
|
||||||
ansible.builtin.apt:
|
ansible.builtin.apt:
|
||||||
@@ -10,7 +8,6 @@
|
|||||||
state: present
|
state: present
|
||||||
update_cache: true
|
update_cache: true
|
||||||
cache_valid_time: 3600
|
cache_valid_time: 3600
|
||||||
install_recommends: false
|
|
||||||
when: ansible_os_family == 'Debian'
|
when: ansible_os_family == 'Debian'
|
||||||
|
|
||||||
- name: PKGNG | Install xdebug
|
- name: PKGNG | Install xdebug
|
||||||
@@ -24,12 +21,11 @@
|
|||||||
dest: "{{ php_mods_dir }}/xdebug.ini"
|
dest: "{{ php_mods_dir }}/xdebug.ini"
|
||||||
owner: root
|
owner: root
|
||||||
mode: 0644
|
mode: 0644
|
||||||
notify: Restart php-fpm
|
notify: restart php-fpm
|
||||||
|
|
||||||
|
when: php_install_xdebug
|
||||||
|
|
||||||
- name: BLOCK | Uninstall xdebug
|
- block:
|
||||||
when: not php_install_xdebug
|
|
||||||
block:
|
|
||||||
|
|
||||||
- name: APT | Uninstall xdebug
|
- name: APT | Uninstall xdebug
|
||||||
ansible.builtin.apt:
|
ansible.builtin.apt:
|
||||||
@@ -42,3 +38,5 @@
|
|||||||
name: "{{ php_xdebug_package }}"
|
name: "{{ php_xdebug_package }}"
|
||||||
state: absent
|
state: absent
|
||||||
when: ansible_os_family == 'FreeBSD'
|
when: ansible_os_family == 'FreeBSD'
|
||||||
|
|
||||||
|
when: not php_install_xdebug
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
---
|
---
|
||||||
|
|
||||||
- hosts: all
|
- hosts: all
|
||||||
name: Test all
|
|
||||||
vars:
|
vars:
|
||||||
vhost: 'test.local'
|
vhost: 'test.local'
|
||||||
php_extra_packages:
|
php_extra_packages:
|
||||||
@@ -47,24 +46,24 @@
|
|||||||
- name: TEMPLATE | Nginx site config
|
- name: TEMPLATE | Nginx site config
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: "templates/nginx.conf.j2"
|
src: "templates/nginx.conf.j2"
|
||||||
dest: "{{ __nginx_conf }}"
|
dest: "{{ __nginx_conf }}"
|
||||||
mode: 0644
|
mode: 0644
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
notify: Reload nginx
|
notify: reload nginx
|
||||||
|
|
||||||
- name: COMMAND | Fix nginx config
|
- name: COMMAND | Fix nginx config
|
||||||
ansible.builtin.command: "cp {{ __nginx_conf | dirname }}/fastcgi_params {{ __nginx_conf | dirname }}/fastcgi.conf"
|
ansible.builtin.command: "cp {{ __nginx_conf | dirname }}/fastcgi_params {{ __nginx_conf | dirname }}/fastcgi.conf"
|
||||||
args:
|
args:
|
||||||
creates: "{{ __nginx_conf | dirname }}/fastcgi.conf"
|
creates: "{{ __nginx_conf | dirname }}/fastcgi.conf"
|
||||||
notify: Reload nginx
|
notify: reload nginx
|
||||||
|
|
||||||
- name: LINEINFILE | Fix nginx config (second step)
|
- name: LINEINFILE | Fix nginx config (second step)
|
||||||
ansible.builtin.lineinfile:
|
ansible.builtin.lineinfile:
|
||||||
regexp: '^fastcgi_param\s+SCRIPT_FILENAME'
|
regexp: '^fastcgi_param\s+SCRIPT_FILENAME'
|
||||||
line: "fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;"
|
line: "fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;"
|
||||||
dest: "{{ __nginx_conf | dirname }}/fastcgi.conf"
|
dest: "{{ __nginx_conf | dirname }}/fastcgi.conf"
|
||||||
notify: Reload nginx
|
notify: reload nginx
|
||||||
|
|
||||||
- name: SERVICE | Ensure nginx is started
|
- name: SERVICE | Ensure nginx is started
|
||||||
ansible.builtin.service:
|
ansible.builtin.service:
|
||||||
@@ -72,9 +71,7 @@
|
|||||||
state: started
|
state: started
|
||||||
when: ansible_virtualization_type != 'docker'
|
when: ansible_virtualization_type != 'docker'
|
||||||
|
|
||||||
- name: Start nginx if testing with Docker
|
- block:
|
||||||
when: ansible_virtualization_type == 'docker'
|
|
||||||
block:
|
|
||||||
|
|
||||||
- name: COMMAND | Docker nginx status
|
- name: COMMAND | Docker nginx status
|
||||||
ansible.builtin.command: service nginx status
|
ansible.builtin.command: service nginx status
|
||||||
@@ -90,19 +87,21 @@
|
|||||||
warn: false
|
warn: false
|
||||||
when: ngs.stdout.find('nginx is not running') != -1
|
when: ngs.stdout.find('nginx is not running') != -1
|
||||||
|
|
||||||
|
when: ansible_virtualization_type == 'docker'
|
||||||
|
|
||||||
handlers:
|
handlers:
|
||||||
|
|
||||||
- name: Reload nginx
|
- name: reload nginx
|
||||||
ansible.builtin.service:
|
ansible.builtin.service:
|
||||||
name: nginx
|
name: nginx
|
||||||
state: reloaded
|
state: reloaded
|
||||||
notify: Docker reload nginx
|
notify: docker reload nginx
|
||||||
|
|
||||||
- name: Docker reload nginx
|
- name: docker reload nginx
|
||||||
ansible.builtin.command: service nginx reload
|
ansible.builtin.command: service nginx reload
|
||||||
args:
|
args:
|
||||||
warn: false
|
warn: false
|
||||||
notify: Docker reload nginx
|
notify: docker reload nginx
|
||||||
when: ansible_virtualization_type == 'docker'
|
when: ansible_virtualization_type == 'docker'
|
||||||
|
|
||||||
roles:
|
roles:
|
||||||
@@ -168,21 +167,3 @@
|
|||||||
ansible.builtin.uri:
|
ansible.builtin.uri:
|
||||||
url: "http://localhost{{ php_fpm_poold.0.status_path }}"
|
url: "http://localhost{{ php_fpm_poold.0.status_path }}"
|
||||||
when: php_fpm_poold.0.status_path is defined
|
when: php_fpm_poold.0.status_path is defined
|
||||||
|
|
||||||
- name: Debian extra checks
|
|
||||||
when: ansible_os_family == 'Debian'
|
|
||||||
block:
|
|
||||||
|
|
||||||
- name: SHELL | Check if we installed multiple PHP versions
|
|
||||||
ansible.builtin.shell: set -o pipefail && (dpkg -l | grep 'php[[:digit:]].*common' | wc -l)
|
|
||||||
args:
|
|
||||||
executable: /bin/bash
|
|
||||||
failed_when: false
|
|
||||||
changed_when: false
|
|
||||||
register: check_multiple_php
|
|
||||||
|
|
||||||
|
|
||||||
- name: FAIL | If we have multiple PHP version
|
|
||||||
ansible.builtin.fail:
|
|
||||||
msg: "Multiple PHP versions detected"
|
|
||||||
when: check_multiple_php.stdout != '1'
|
|
||||||
|
|||||||
3
vars/Debian-stretch.yml
Normal file
3
vars/Debian-stretch.yml
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
php_default_version: '7.0'
|
||||||
@@ -7,8 +7,7 @@ php_packages:
|
|||||||
- '{{ php_package_prefix }}mysql'
|
- '{{ php_package_prefix }}mysql'
|
||||||
- '{{ php_package_prefix }}intl'
|
- '{{ php_package_prefix }}intl'
|
||||||
|
|
||||||
php_xdebug_package: '{% if multiple_php.rc == 0 %}{{ php_package_prefix }}{% else %}php-{% endif %}xdebug'
|
php_xdebug_package: 'php-xdebug'
|
||||||
php_apcu_package: '{% if multiple_php.rc == 0 %}{{ php_package_prefix }}{% else %}php-{% endif %}apcu'
|
|
||||||
|
|
||||||
php_package_prefix: 'php{{ php_version }}-'
|
php_package_prefix: 'php{{ php_version }}-'
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user