mirror of
https://github.com/HanXHX/ansible-php.git
synced 2026-02-28 09:42:09 +07:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f8ddae5064 | ||
|
|
f38aa400b3 | ||
|
|
8758a9b7dc | ||
|
|
2a6b921b5e | ||
|
|
1bce22acbd | ||
|
|
7f7087cdb2 | ||
|
|
2987051153 | ||
|
|
7727e19da9 |
39
.travis.yml
39
.travis.yml
@@ -1,16 +1,49 @@
|
|||||||
env:
|
env:
|
||||||
- PLATFORM=debian-jessie-php-5.6
|
- PLATFORM='docker-debian-jessie-php56' ANSIBLE_VERSION='ansible>=2.0,<2.1'
|
||||||
- PLATFORM=debian-jessie-php-7.0
|
- PLATFORM='docker-debian-jessie-php70' ANSIBLE_VERSION='ansible>=2.0,<2.1'
|
||||||
|
- PLATFORM='docker-debian-jessie-php71' ANSIBLE_VERSION='ansible>=2.0,<2.1'
|
||||||
|
- PLATFORM='docker-debian-stretch-php70' ANSIBLE_VERSION='ansible>=2.0,<2.1'
|
||||||
|
- PLATFORM='docker-debian-stretch-php71' ANSIBLE_VERSION='ansible>=2.0,<2.1'
|
||||||
|
- PLATFORM='docker-debian-jessie-php56' ANSIBLE_VERSION='ansible>=2.1,<2.2'
|
||||||
|
- PLATFORM='docker-debian-jessie-php70' ANSIBLE_VERSION='ansible>=2.1,<2.2'
|
||||||
|
- PLATFORM='docker-debian-jessie-php71' ANSIBLE_VERSION='ansible>=2.1,<2.2'
|
||||||
|
- PLATFORM='docker-debian-stretch-php70' ANSIBLE_VERSION='ansible>=2.1,<2.2'
|
||||||
|
- PLATFORM='docker-debian-stretch-php71' ANSIBLE_VERSION='ansible>=2.1,<2.2'
|
||||||
|
- PLATFORM='docker-debian-jessie-php56' ANSIBLE_VERSION='ansible>=2.2,<2.3'
|
||||||
|
- PLATFORM='docker-debian-jessie-php70' ANSIBLE_VERSION='ansible>=2.2,<2.3'
|
||||||
|
- PLATFORM='docker-debian-jessie-php71' ANSIBLE_VERSION='ansible>=2.2,<2.3'
|
||||||
|
- PLATFORM='docker-debian-stretch-php70' ANSIBLE_VERSION='ansible>=2.2,<2.3'
|
||||||
|
- PLATFORM='docker-debian-stretch-php71' ANSIBLE_VERSION='ansible>=2.2,<2.3'
|
||||||
|
- PLATFORM='docker-debian-jessie-php56' ANSIBLE_VERSION='ansible>=2.3,<2.4'
|
||||||
|
- PLATFORM='docker-debian-jessie-php70' ANSIBLE_VERSION='ansible>=2.3,<2.4'
|
||||||
|
- PLATFORM='docker-debian-jessie-php71' ANSIBLE_VERSION='ansible>=2.3,<2.4'
|
||||||
|
- PLATFORM='docker-debian-stretch-php70' ANSIBLE_VERSION='ansible>=2.3,<2.4'
|
||||||
|
- PLATFORM='docker-debian-stretch-php71' ANSIBLE_VERSION='ansible>=2.3,<2.4'
|
||||||
|
|
||||||
sudo: required
|
sudo: required
|
||||||
|
|
||||||
|
dist: trusty
|
||||||
|
|
||||||
language: python
|
language: python
|
||||||
|
|
||||||
services:
|
services:
|
||||||
- docker
|
- docker
|
||||||
|
|
||||||
|
before_install:
|
||||||
|
- wget https://releases.hashicorp.com/vagrant/1.9.5/vagrant_1.9.5_x86_64.deb
|
||||||
|
- sudo dpkg -i vagrant_1.9.5_x86_64.deb
|
||||||
|
|
||||||
|
install:
|
||||||
|
- pip install "$ANSIBLE_VERSION"
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- docker build -f tests/$PLATFORM.Dockerfile -t test-$PLATFORM . && docker run --name $PLATFORM test-$PLATFORM
|
- VAGRANT_DEFAULT_PROVIDER=docker vagrant up $PLATFORM
|
||||||
|
- >
|
||||||
|
VAGRANT_DEFAULT_PROVIDER=docker vagrant provision $PLATFORM
|
||||||
|
| grep -q 'changed=0.*failed=0'
|
||||||
|
&& (echo 'Idempotence test: pass' && exit 0)
|
||||||
|
|| (echo 'Idempotence test: fail' && exit 1)
|
||||||
|
- VAGRANT_DEFAULT_PROVIDER=docker vagrant status
|
||||||
|
|
||||||
notifications:
|
notifications:
|
||||||
webhooks: https://galaxy.ansible.com/api/v1/notifications/
|
webhooks: https://galaxy.ansible.com/api/v1/notifications/
|
||||||
|
|||||||
13
README.md
13
README.md
@@ -3,15 +3,20 @@ Ansible PHP (+FPM) role for Debian
|
|||||||
|
|
||||||
[](https://galaxy.ansible.com/HanXHX/php) [](https://travis-ci.org/HanXHX/ansible-php)
|
[](https://galaxy.ansible.com/HanXHX/php) [](https://travis-ci.org/HanXHX/ansible-php)
|
||||||
|
|
||||||
Install PHP (php-fpm optional) on Debian Jessie/Stretch. Manage APCu, Opcache, Xdebug.
|
Install PHP (php-fpm optional) on Debian. Manage APCu, Opcache, Xdebug.
|
||||||
|
|
||||||
Managed versions: 5.6 and 7.0
|
Managed OS / Versions
|
||||||
|
---------------------
|
||||||
|
|
||||||
|
| OS | PHP 5.6 | PHP 7.0 | PHP 7.1 |
|
||||||
|
|:-------------: |:-----------------: |:-------------------------: |:-------------------------: |
|
||||||
|
| Debian Jessie | Yes (from Debian) | Yes (from [Dotdeb](https://www.dotdeb.org) or [Sury](https://deb.sury.org/)) | Yes (from [Dotdeb](https://www.dotdeb.org) or [Sury](https://deb.sury.org/)) |
|
||||||
|
| Debian Strech | No | Yes (from Debian) | Yes (from [Sury](https://deb.sury.org/)) |
|
||||||
|
|
||||||
Requirements
|
Requirements
|
||||||
------------
|
------------
|
||||||
|
|
||||||
If you need PHP-FPM, you must install a webserver with FastCGI support. You can use my [nginx role](https://github.com/HanXHX/ansible-nginx).
|
If you need PHP-FPM, you must install a webserver with FastCGI support. You can use my [nginx role](https://github.com/HanXHX/ansible-nginx).
|
||||||
On Debian Jessie, if you want PHP7.0, you must use [Dotdeb](https://www.dotdeb.org). You can use my [dotdeb role](https://github.com/HanXHX/ansible-debian-dotdeb).
|
|
||||||
|
|
||||||
Role Variables
|
Role Variables
|
||||||
--------------
|
--------------
|
||||||
@@ -20,7 +25,7 @@ You should look at [default vars](defaults/main.yml).
|
|||||||
|
|
||||||
### Writable vars
|
### Writable vars
|
||||||
|
|
||||||
- `php_version`: 5.6 (default) or 7.0
|
- `php_version`: 5.6 (default), 7.0, 7.1
|
||||||
- `php_install_fpm`: boolean, install and manage php-fpm (default is true)
|
- `php_install_fpm`: boolean, install and manage php-fpm (default is true)
|
||||||
- `php_install_xdebug`: boolean, install [Xdebug](http://xdebug.org)
|
- `php_install_xdebug`: boolean, install [Xdebug](http://xdebug.org)
|
||||||
- `php_extra_packages`: additional php packages to install (default is an empty list).
|
- `php_extra_packages`: additional php packages to install (default is an empty list).
|
||||||
|
|||||||
54
Vagrantfile
vendored
54
Vagrantfile
vendored
@@ -5,31 +5,53 @@
|
|||||||
|
|
||||||
Vagrant.configure("2") do |config|
|
Vagrant.configure("2") do |config|
|
||||||
|
|
||||||
vms = [
|
vms_debian = [
|
||||||
[ "jessie-php-5.6", "debian/contrib-jessie64", "192.168.33.88", "5.6" ],
|
{ :name => "debian-jessie-php56", :box => "debian/jessie64", :vars => { }},
|
||||||
[ "jessie-php-7.0", "debian/contrib-jessie64", "192.168.33.89", "7.0" ],
|
{ :name => "debian-jessie-php70", :box => "debian/jessie64", :vars => { "php_version": '7.0' }},
|
||||||
[ "stretch-php-5.6", "sharlak/debian_stretch_64", "192.168.33.90", "5.6" ],
|
{ :name => "debian-jessie-php71", :box => "debian/jessie64", :vars => { "php_version": '7.1' }},
|
||||||
[ "stretch-php-7.0", "sharlak/debian_stretch_64", "192.168.33.91", "7.0" ]
|
{ :name => "debian-stretch-php70", :box => "debian/stretch64", :vars => { }},
|
||||||
|
{ :name => "debian-stretch-php71", :box => "debian/stretch64", :vars => { "php_version": '7.1' }}
|
||||||
]
|
]
|
||||||
|
|
||||||
config.vm.provider "virtualbox" do |v|
|
conts = [
|
||||||
v.cpus = 1
|
{ :name => "docker-debian-jessie-php56", :docker => "hanxhx/vagrant-ansible:debian8", :vars => { }},
|
||||||
v.memory = 256
|
{ :name => "docker-debian-jessie-php70", :docker => "hanxhx/vagrant-ansible:debian8", :vars => { "php_version": '7.0' }},
|
||||||
end
|
{ :name => "docker-debian-jessie-php71", :docker => "hanxhx/vagrant-ansible:debian8", :vars => { "php_version": '7.1' }},
|
||||||
|
{ :name => "docker-debian-stretch-php70", :docker => "hanxhx/vagrant-ansible:debian9", :vars => { }},
|
||||||
|
{ :name => "docker-debian-stretch-php71", :docker => "hanxhx/vagrant-ansible:debian9", :vars => { "php_version": '7.1' }}
|
||||||
|
]
|
||||||
|
|
||||||
vms.each do |vm|
|
config.vm.network "private_network", type: "dhcp"
|
||||||
config.vm.define vm[0] do |m|
|
|
||||||
m.vm.box = vm[1]
|
|
||||||
m.vm.network "private_network", ip: vm[2]
|
|
||||||
|
|
||||||
|
conts.each do |opts|
|
||||||
|
config.vm.define opts[:name] do |m|
|
||||||
|
m.vm.provider "docker" do |d|
|
||||||
|
d.image = opts[:docker]
|
||||||
|
d.remains_running = true
|
||||||
|
d.has_ssh = true
|
||||||
|
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'
|
||||||
ansible.sudo = true
|
ansible.sudo = true
|
||||||
ansible.extra_vars = {
|
ansible.extra_vars = opts[:vars]
|
||||||
php_version: vm[3]
|
|
||||||
}
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
vms_debian.each do |opts|
|
||||||
|
config.vm.define opts[:name] do |m|
|
||||||
|
m.vm.box = opts[:box]
|
||||||
|
m.vm.provider "virtualbox" do |v|
|
||||||
|
v.cpus = 1
|
||||||
|
v.memory = 256
|
||||||
|
end
|
||||||
|
m.vm.provision "ansible" do |ansible|
|
||||||
|
ansible.playbook = "tests/test.yml"
|
||||||
|
ansible.verbose = 'vv'
|
||||||
|
ansible.sudo = true
|
||||||
|
ansible.extra_vars = opts[:vars]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
|
|
||||||
php_version: '5.6'
|
php_version: '{{ php_default_version }}'
|
||||||
php_install_fpm: true
|
php_install_fpm: true
|
||||||
php_install_xdebug: false
|
php_install_xdebug: false
|
||||||
php_extra_packages: []
|
php_extra_packages: []
|
||||||
@@ -100,3 +100,5 @@ php_fpm_poold:
|
|||||||
pm_min_spare_servers: 10
|
pm_min_spare_servers: 10
|
||||||
pm_max_spare_servers: 20
|
pm_max_spare_servers: 20
|
||||||
|
|
||||||
|
# Hack
|
||||||
|
php_default_version: 'NONE'
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
---
|
---
|
||||||
galaxy_info:
|
galaxy_info:
|
||||||
author: Emilien Mantel
|
author: Emilien Mantel
|
||||||
description: Install and configure PHP 5.6/7.0 (+ FPM is wanted)
|
description: Install and configure PHP 5.6/7.0/7.1 (+ FPM is wanted)
|
||||||
company:
|
company:
|
||||||
license: GPLv2
|
license: GPLv2
|
||||||
min_ansible_version: 1.9
|
min_ansible_version: 2.0
|
||||||
platforms:
|
platforms:
|
||||||
- name: Debian
|
- name: Debian
|
||||||
versions:
|
versions:
|
||||||
@@ -13,7 +13,11 @@ galaxy_info:
|
|||||||
- development
|
- development
|
||||||
- web
|
- web
|
||||||
- php
|
- php
|
||||||
|
- php5.6
|
||||||
|
- php5
|
||||||
- php7
|
- php7
|
||||||
|
- php7.0
|
||||||
|
- php7.1
|
||||||
- debian
|
- debian
|
||||||
dependencies: []
|
dependencies: []
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
|
|
||||||
- name: APT | Install PHP-FPM
|
- name: APT | Install PHP-FPM
|
||||||
apt: pkg={{ php_fpm_service }} state=latest
|
apt: pkg={{ php_fpm_service }} state=present
|
||||||
|
|
||||||
- name: LINEINFILE | PHP configuration
|
- name: LINEINFILE | PHP configuration
|
||||||
lineinfile: >
|
lineinfile: >
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
---
|
---
|
||||||
|
|
||||||
|
- name: INCLUDE_VARS | Related to OS
|
||||||
|
include_vars: "{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yml"
|
||||||
|
|
||||||
- name: ASSERT | Check variables
|
- name: ASSERT | Check variables
|
||||||
assert:
|
assert:
|
||||||
that: "php_version in php_managed_versions"
|
that: "php_version in php_managed_versions"
|
||||||
@@ -16,6 +19,7 @@
|
|||||||
with_flattened:
|
with_flattened:
|
||||||
- "{{ php_packages }}"
|
- "{{ php_packages }}"
|
||||||
- "{{ php_extra_packages }}"
|
- "{{ php_extra_packages }}"
|
||||||
|
notify: restart php-fpm
|
||||||
|
|
||||||
- name: INCLUDE | PHP-FPM
|
- name: INCLUDE | PHP-FPM
|
||||||
include: fpm.yml
|
include: fpm.yml
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
- name: APT | Install php-xdebug
|
- name: APT | Install php-xdebug
|
||||||
apt: >
|
apt: >
|
||||||
pkg="{{ php_apt_prefix }}xdebug"
|
pkg="{{ php_apt_prefix }}xdebug"
|
||||||
state=latest
|
state=present
|
||||||
update_cache=yes
|
update_cache=yes
|
||||||
cache_valid_time=3600
|
cache_valid_time=3600
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
FROM williamyeh/ansible:debian8-onbuild
|
|
||||||
|
|
||||||
RUN apt-get update
|
|
||||||
CMD ["sh", "tests/test.sh", "5.6"]
|
|
||||||
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
FROM williamyeh/ansible:debian8-onbuild
|
|
||||||
|
|
||||||
RUN apt-get update
|
|
||||||
CMD ["sh", "tests/test.sh", "7.0"]
|
|
||||||
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
php_version: '5.6'
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
php_version: '7.0'
|
|
||||||
7
tests/includes/dotdeb.yml
Normal file
7
tests/includes/dotdeb.yml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
- name: APT | Install DotDeb key
|
||||||
|
apt_key: url='http://www.dotdeb.org/dotdeb.gpg' state=present
|
||||||
|
|
||||||
|
- name: APT | Add Dotdeb repository
|
||||||
|
apt_repository: repo='deb http://packages.dotdeb.org {{ ansible_distribution_release }} all' state=present
|
||||||
7
tests/includes/sury.yml
Normal file
7
tests/includes/sury.yml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
- name: APT | Install Sury key
|
||||||
|
apt_key: url='https://packages.sury.org/php/apt.gpg' state=present
|
||||||
|
|
||||||
|
- name: APT | Add Sury repository
|
||||||
|
apt_repository: repo='deb https://packages.sury.org/php/ {{ ansible_distribution_release }} main' state=present
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
localhost
|
|
||||||
|
|
||||||
[php-5.6]
|
|
||||||
localhost
|
|
||||||
|
|
||||||
[php-7.0]
|
|
||||||
localhost
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# Thanks to https://servercheck.in/blog/testing-ansible-roles-travis-ci-github
|
|
||||||
|
|
||||||
DIR=$( dirname $0 )
|
|
||||||
PLAYBOOK="$DIR/test.yml"
|
|
||||||
ANSIBLE_ARG="localhost"
|
|
||||||
|
|
||||||
set -ev
|
|
||||||
|
|
||||||
ansible --version
|
|
||||||
|
|
||||||
# Check syntax
|
|
||||||
ansible-playbook -i localhost, -c local --syntax-check -vv $PLAYBOOK
|
|
||||||
|
|
||||||
# Check role
|
|
||||||
ansible-playbook -i localhost, -c local -e "php_version=$1" --become -vv $PLAYBOOK
|
|
||||||
|
|
||||||
# Check indempotence
|
|
||||||
ansible-playbook -i localhost, -c local -e "php_version=$1" --become -vv $PLAYBOOK \
|
|
||||||
| grep -q 'changed=0.*failed=0' \
|
|
||||||
&& (echo 'Idempotence test: pass' && exit 0) \
|
|
||||||
|| (echo 'Idempotence test: fail' && exit 1)
|
|
||||||
@@ -6,50 +6,73 @@
|
|||||||
php_extra_packages:
|
php_extra_packages:
|
||||||
- '{{ php_apt_prefix }}recode'
|
- '{{ php_apt_prefix }}recode'
|
||||||
php_install_xdebug: true
|
php_install_xdebug: true
|
||||||
|
|
||||||
pre_tasks:
|
pre_tasks:
|
||||||
- name: APT | Install DotDeb key
|
|
||||||
apt_key: url='http://www.dotdeb.org/dotdeb.gpg' state=present
|
- name: APT | Install packages
|
||||||
|
apt: pkg={{ item }} update_cache=yes cache_valid_time=3600
|
||||||
|
with_items: ['apt-transport-https', 'curl', 'lsb-release', 'ca-certificates']
|
||||||
|
|
||||||
|
- name: INCLUDE | Dotdeb
|
||||||
|
include: includes/dotdeb.yml
|
||||||
when: >
|
when: >
|
||||||
ansible_distribution_major_version | version_compare(8, 'eq') and
|
ansible_distribution_major_version | version_compare(8, 'eq') and
|
||||||
php_version | version_compare('7.0', 'ge')
|
php_version | version_compare('7.0', 'eq')
|
||||||
- name: APT | Add Dotdeb repository for Jessie + PHP7
|
|
||||||
apt_repository: repo='deb http://packages.dotdeb.org jessie all' state=present
|
- name: INCLUDE | Sury
|
||||||
|
include: includes/sury.yml
|
||||||
when: >
|
when: >
|
||||||
ansible_distribution_major_version | version_compare(8, 'eq') and
|
ansible_distribution_major_version | version_compare(9, 'le') and
|
||||||
php_version | version_compare('7.0', 'ge')
|
php_version | version_compare('7.1', 'eq')
|
||||||
|
|
||||||
- name: APT | Install nginx
|
- name: APT | Install nginx
|
||||||
apt: pkg=nginx state=present update_cache=yes cache_valid_time=3600
|
apt: pkg=nginx state=present update_cache=yes cache_valid_time=3600
|
||||||
|
|
||||||
- name: SHELL | Get nginx version
|
- name: SHELL | Get nginx version
|
||||||
shell: nginx -V 2>&1 | awk -F '/' '/nginx version/ { print $2 }'
|
shell: nginx -V 2>&1 | awk -F '/' '/nginx version/ { print $2 }'
|
||||||
register: nginx_version
|
register: nginx_version
|
||||||
changed_when: false
|
changed_when: false
|
||||||
|
|
||||||
- set_fact: nginx_include="fastcgi_params"
|
- set_fact: nginx_include="fastcgi_params"
|
||||||
when: nginx_version.stdout | version_compare('1.6', '<', true)
|
when: nginx_version.stdout | version_compare('1.6', '<', true)
|
||||||
|
|
||||||
- set_fact: nginx_include="fastcgi.conf"
|
- set_fact: nginx_include="fastcgi.conf"
|
||||||
when: nginx_version.stdout | version_compare('1.6', '>=', true)
|
when: nginx_version.stdout | version_compare('1.6', '>=', true)
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
|
|
||||||
- name: COPY | Vhost
|
- name: COPY | Vhost
|
||||||
copy: >
|
copy: >
|
||||||
dest=/etc/nginx/sites-enabled/{{ vhost }}
|
dest=/etc/nginx/sites-enabled/{{ vhost }}
|
||||||
content='server { server_name {{ vhost }}; root /var/www; location ~ \.php$ { include {{ nginx_include }}; fastcgi_pass unix:{{ php_default_fpm_sock }}; } }'
|
content='server { server_name {{ vhost }}; root /var/www; location ~ \.php$ { include {{ nginx_include }}; fastcgi_pass unix:{{ php_default_fpm_sock }}; } }'
|
||||||
notify: reload nginx
|
notify: reload nginx
|
||||||
|
|
||||||
handlers:
|
handlers:
|
||||||
|
|
||||||
- name: reload nginx
|
- name: reload nginx
|
||||||
service: name=nginx state=reloaded
|
service: name=nginx state=reloaded
|
||||||
|
|
||||||
roles:
|
roles:
|
||||||
- ../../
|
- ../../
|
||||||
|
|
||||||
post_tasks:
|
post_tasks:
|
||||||
|
|
||||||
- name: SHELL | Test php-cli
|
- name: SHELL | Test php-cli
|
||||||
shell: php -i | grep '^PHP Version' | head -n 1
|
shell: php -i | grep '^PHP Version => {{ php_version }}' | head -n 1
|
||||||
changed_when: false
|
changed_when: false
|
||||||
register: p
|
register: p
|
||||||
failed_when: p.stdout == ''
|
failed_when: p.stdout == ''
|
||||||
|
|
||||||
- name: FILE | Create /var/www
|
- name: FILE | Create /var/www
|
||||||
file: dest=/var/www state=directory
|
file: dest=/var/www state=directory
|
||||||
|
|
||||||
- name: COPY | Add phpinfo
|
- name: COPY | Add phpinfo
|
||||||
copy: dest=/var/www/phpinfo.php content='<?php phpinfo();'
|
copy: dest=/var/www/phpinfo.php content='<?php phpinfo();'
|
||||||
|
|
||||||
- name: SHELL | Check vhost
|
- name: SHELL | Check vhost
|
||||||
shell: "curl -v -H 'Host: {{ vhost }}' http://127.0.0.1/phpinfo.php 2> /dev/null | grep h1 | grep -o 'PHP Version [57].*<' | sed -r 's/<//g'"
|
shell: "curl -v -H 'Host: {{ vhost }}' http://127.0.0.1/phpinfo.php 2> /dev/null | grep h1 | grep -o 'PHP Version {{ php_version }}' | sed -r 's/<//g'"
|
||||||
|
args:
|
||||||
|
warn: false
|
||||||
changed_when: false
|
changed_when: false
|
||||||
register: c
|
register: c
|
||||||
failed_when: c.stdout == ''
|
failed_when: c.stdout == ''
|
||||||
|
|||||||
5
vars/Debian-8.yml
Normal file
5
vars/Debian-8.yml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
php_default_version: '5.6'
|
||||||
|
php_managed_versions:
|
||||||
|
- '5.6'
|
||||||
|
- '7.0'
|
||||||
|
- '7.1'
|
||||||
4
vars/Debian-9.yml
Normal file
4
vars/Debian-9.yml
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
php_default_version: '7.0'
|
||||||
|
php_managed_versions:
|
||||||
|
- '7.0'
|
||||||
|
- '7.1'
|
||||||
@@ -7,7 +7,3 @@ php_packages:
|
|||||||
- '{{ php_apt_prefix }}mcrypt'
|
- '{{ php_apt_prefix }}mcrypt'
|
||||||
- '{{ php_mysql_package }}'
|
- '{{ php_mysql_package }}'
|
||||||
- '{{ php_apt_prefix }}intl'
|
- '{{ php_apt_prefix }}intl'
|
||||||
|
|
||||||
php_managed_versions:
|
|
||||||
- '5.6'
|
|
||||||
- '7.0'
|
|
||||||
|
|||||||
8
vars/php-7.1.yml
Normal file
8
vars/php-7.1.yml
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
php_apt_prefix: 'php7.1-'
|
||||||
|
php_etc_dir: '/etc/php/7.1'
|
||||||
|
php_fpm_service: 'php7.1-fpm'
|
||||||
|
php_default_fpm_sock: '/var/run/php/php7.1-fpm.sock'
|
||||||
|
php_mods_dir: '/etc/php/7.1/mods-available'
|
||||||
|
php_mysql_package: 'php7.1-mysql'
|
||||||
Reference in New Issue
Block a user