From e87d158424aee26436b42001988087799f07a592 Mon Sep 17 00:00:00 2001 From: Emilien Mantel Date: Sun, 18 Mar 2018 19:30:21 +0100 Subject: [PATCH] Manage Ubuntu 16.04/18.04 --- .gitignore | 1 + .travis.yml | 8 ++++++++ README.md | 18 ++++++++++-------- Vagrantfile | 21 +++++++++++++-------- meta/main.yml | 5 +++++ tasks/main.yml | 2 +- vars/{Debian-9.yml => Debian-stretch.yml} | 0 vars/Ubuntu-bionic.yml | 1 + vars/Ubuntu-xenial.yml | 1 + 9 files changed, 40 insertions(+), 17 deletions(-) rename vars/{Debian-9.yml => Debian-stretch.yml} (100%) create mode 100644 vars/Ubuntu-bionic.yml create mode 100644 vars/Ubuntu-xenial.yml diff --git a/.gitignore b/.gitignore index c7cdbe1..62ff262 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .vagrant* *.swp *.retry +*.log diff --git a/.travis.yml b/.travis.yml index 7cbdecf..8f12eba 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,6 +7,14 @@ env: - PLATFORM='docker-debian-stretch-php71' ANSIBLE_VERSION='ansible>=2.2,<2.3' - PLATFORM='docker-debian-stretch-php70' ANSIBLE_VERSION='ansible>=2.3,<2.4' - PLATFORM='docker-debian-stretch-php71' ANSIBLE_VERSION='ansible>=2.3,<2.4' + - PLATFORM='docker-ubuntu-xenial-php70' ANSIBLE_VERSION='ansible>=2.0,<2.1' + - PLATFORM='docker-ubuntu-xenial-php70' ANSIBLE_VERSION='ansible>=2.1,<2.2' + - PLATFORM='docker-ubuntu-xenial-php70' ANSIBLE_VERSION='ansible>=2.2,<2.3' + - PLATFORM='docker-ubuntu-xenial-php70' ANSIBLE_VERSION='ansible>=2.3,<2.4' + - PLATFORM='docker-ubuntu-bionic-php72' ANSIBLE_VERSION='ansible>=2.0,<2.1' + - PLATFORM='docker-ubuntu-bionic-php72' ANSIBLE_VERSION='ansible>=2.1,<2.2' + - PLATFORM='docker-ubuntu-bionic-php72' ANSIBLE_VERSION='ansible>=2.2,<2.3' + - PLATFORM='docker-ubuntu-bionic-php72' ANSIBLE_VERSION='ansible>=2.3,<2.4' sudo: required diff --git a/README.md b/README.md index 03a2e77..bddd6f2 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,18 @@ -Ansible PHP (+FPM) role for Debian -================================== +Ansible PHP (+FPM) role for Debian / Ubuntu +=========================================== [![Ansible Galaxy](http://img.shields.io/badge/ansible--galaxy-HanXHX.php-blue.svg)](https://galaxy.ansible.com/HanXHX/php) [![Build Status](https://travis-ci.org/HanXHX/ansible-php.svg?branch=master)](https://travis-ci.org/HanXHX/ansible-php) -Install PHP (php-fpm optional) on Debian. Manage APCu, Opcache, Xdebug. +Install PHP (php-fpm optional) on Debian / Ubuntu. Manage APCu, Opcache, Xdebug. Managed OS / Versions --------------------- -| OS | PHP 7.0 | PHP 7.1 | PHP 7.2 | -|:-------------:|:------------:|:-------------:|:------------:| -| Debian Strech | Yes | Yes (Sury) | Yes (Sury) | +| OS | PHP 7.0 | PHP 7.1 | PHP 7.2 | +|:---------------------:|:------------:|:-------------:|:------------:| +| Debian Strech (9) | Yes | Yes (Sury) | Yes (Sury) | +| Ubuntu Xenial (16.04) | Yes | No | No | +| Ubuntu Bionic (18.04) | No | No | Yes | Links: - [Dotdeb](https://www.dotdeb.org) @@ -28,7 +30,7 @@ You should look at [default vars](defaults/main.yml). ### Writable vars -- `php_version`: 7.0 (default on Stretch), 7.1, 7.2 +- `php_version`: 7.0, 7.1, 7.2 - `php_install_fpm`: boolean, install and manage php-fpm (default is true) - `php_install_xdebug`: boolean, install [Xdebug](http://xdebug.org) - `php_extra_packages`: additional php packages to install (default is an empty list). @@ -150,7 +152,7 @@ Example Playbook roles: - { role: HanXHX.php } -### Debian Jessie with PHP 7.2 CLI (no FPM) +### Debian Stretch with PHP 7.2 CLI (no FPM) - hosts: servers roles: diff --git a/Vagrantfile b/Vagrantfile index 0042d3d..b41f7f0 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -8,13 +8,17 @@ Vagrant.configure("2") do |config| vms_debian = [ { :name => "debian-stretch-php70", :box => "debian/stretch64", :vars => { }}, { :name => "debian-stretch-php71", :box => "debian/stretch64", :vars => { "php_version": '7.1' }}, - { :name => "debian-stretch-php72", :box => "debian/stretch64", :vars => { "php_version": '7.2' }} + { :name => "debian-stretch-php72", :box => "debian/stretch64", :vars => { "php_version": '7.2' }}, + { :name => "ubuntu-xenial-php70", :box => "ubuntu/xenial64", :vars => { }}, + { :name => "ubuntu-bionic-php72", :box => "ubuntu/bionic64", :vars => { }}, ] conts = [ { :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' }}, - { :name => "docker-debian-stretch-php72", :docker => "hanxhx/vagrant-ansible:debian9", :vars => { "php_version": '7.2' }} + { :name => "docker-debian-stretch-php72", :docker => "hanxhx/vagrant-ansible:debian9", :vars => { "php_version": '7.2' }}, + { :name => "docker-ubuntu-xenial-php70", :docker => "hanxhx/vagrant-ansible:16.04", :vars => { }}, + { :name => "docker-ubuntu-bionic-php72", :docker => "hanxhx/vagrant-ansible:18.04", :vars => { }}, ] config.vm.network "private_network", type: "dhcp" @@ -42,12 +46,13 @@ Vagrant.configure("2") do |config| v.cpus = 1 v.memory = 256 end - m.vm.provision "ansible" do |ansible| - ansible.playbook = "tests/test.yml" - ansible.verbose = 'vv' - ansible.become = true - ansible.extra_vars = opts[:vars] - end + m.vm.provision "shell", inline: "apt-get update && apt-get install -y ifupdown python" + m.vm.provision "ansible" do |ansible| + ansible.playbook = "tests/test.yml" + ansible.verbose = 'vv' + ansible.become = true + ansible.extra_vars = opts[:vars] + end end end end diff --git a/meta/main.yml b/meta/main.yml index 24afd92..99079d2 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -9,6 +9,10 @@ galaxy_info: - name: Debian versions: - stretch + - name: Ubuntu + versions: + - xenial + - bionic galaxy_tags: - development - web @@ -16,5 +20,6 @@ galaxy_info: - php-fpm - php7 - debian + - ubuntu dependencies: [] diff --git a/tasks/main.yml b/tasks/main.yml index 576c195..ea7b473 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -4,7 +4,7 @@ include_vars: "OS_Family_{{ ansible_os_family }}.yml" - name: INCLUDE_VARS | Related to OS version - include_vars: "{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yml" + include_vars: "{{ ansible_distribution }}-{{ ansible_distribution_release }}.yml" - name: APT | Install PHP packages apt: diff --git a/vars/Debian-9.yml b/vars/Debian-stretch.yml similarity index 100% rename from vars/Debian-9.yml rename to vars/Debian-stretch.yml diff --git a/vars/Ubuntu-bionic.yml b/vars/Ubuntu-bionic.yml new file mode 100644 index 0000000..ebebaae --- /dev/null +++ b/vars/Ubuntu-bionic.yml @@ -0,0 +1 @@ +php_default_version: '7.2' diff --git a/vars/Ubuntu-xenial.yml b/vars/Ubuntu-xenial.yml new file mode 100644 index 0000000..ba02b4c --- /dev/null +++ b/vars/Ubuntu-xenial.yml @@ -0,0 +1 @@ +php_default_version: '7.0'