diff --git a/.travis.yml b/.travis.yml index 2f1809c..a1d9a40 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,33 +1,37 @@ env: - - PLATFORM='docker-debian-stretch-php70' ANSIBLE_VERSION='ansible>=2.6,<2.7' - - PLATFORM='docker-debian-buster-php73' ANSIBLE_VERSION='ansible>=2.6,<2.7' - - PLATFORM='docker-ubuntu-xenial-php70' ANSIBLE_VERSION='ansible>=2.6,<2.7' - - PLATFORM='docker-ubuntu-bionic-php72' ANSIBLE_VERSION='ansible>=2.6,<2.7' - - PLATFORM='docker-ubuntu-bionic-php72' ANSIBLE_VERSION='ansible>=2.6,<2.7' - - PLATFORM='docker-debian-stretch-php70' ANSIBLE_VERSION='ansible>=2.7,<2.8' - - PLATFORM='docker-debian-stretch-php74' ANSIBLE_VERSION='ansible>=2.7,<2.8' - - PLATFORM='docker-debian-buster-php73' ANSIBLE_VERSION='ansible>=2.7,<2.8' - - PLATFORM='docker-debian-buster-php74' ANSIBLE_VERSION='ansible>=2.7,<2.8' - - PLATFORM='docker-ubuntu-xenial-php70' ANSIBLE_VERSION='ansible>=2.7,<2.8' - - PLATFORM='docker-ubuntu-bionic-php72' ANSIBLE_VERSION='ansible>=2.7,<2.8' - - PLATFORM='docker-ubuntu-bionic-php72' ANSIBLE_VERSION='ansible>=2.7,<2.8' + global: + - VAGRANT_VERSION='2.2.18' + jobs: + - PLATFORM='docker-debian-stretch-php70' ANSIBLE_VERSION='ansible>=2.11,<2.12' + - PLATFORM='docker-debian-stretch-php74' ANSIBLE_VERSION='ansible>=2.11,<2.12' + - PLATFORM='docker-debian-buster-php73' ANSIBLE_VERSION='ansible>=2.11,<2.12' + - PLATFORM='docker-debian-bullseye-php74' ANSIBLE_VERSION='ansible>=2.11,<2.12' + - PLATFORM='docker-debian-bullseye-php80' ANSIBLE_VERSION='ansible>=2.11,<2.12' + - PLATFORM='docker-debian-buster-php74' ANSIBLE_VERSION='ansible>=2.11,<2.12' + - PLATFORM='docker-ubuntu-xenial-php70' ANSIBLE_VERSION='ansible>=2.11,<2.12' + - PLATFORM='docker-ubuntu-bionic-php72' ANSIBLE_VERSION='ansible>=2.11,<2.12' -sudo: required - -dist: trusty +os: + - linux +dist: focal language: python -python: 2.7 +python: + - 3.8 services: - docker before_install: - - wget https://releases.hashicorp.com/vagrant/2.0.1/vagrant_2.0.1_x86_64.deb - - sudo dpkg -i vagrant_2.0.1_x86_64.deb + - sudo apt-get -q update + - sudo apt-get install -y yamllint + - sudo wget -nv https://releases.hashicorp.com/vagrant/${VAGRANT_VERSION}/vagrant_${VAGRANT_VERSION}_x86_64.deb + - sudo dpkg -i vagrant_${VAGRANT_VERSION}_x86_64.deb install: - - pip install "$ANSIBLE_VERSION" + - sudo pip install "ansible-core$ANSIBLE_VERSION" + - sudo pip install ansible-lint + - ansible-galaxy collection install ansible.posix community.general script: - VAGRANT_DEFAULT_PROVIDER=docker vagrant up $PLATFORM @@ -37,6 +41,14 @@ script: && (echo 'Idempotence test: pass' && exit 0) || (echo 'Idempotence test: fail' && exit 1) - VAGRANT_DEFAULT_PROVIDER=docker vagrant status + - > + yamllint . + && (echo 'YAML lint test: pass' && exit 0) + || (echo 'YAML lint test: fail' && exit 1) + - > + ansible-lint -v tests/test.yml + && (echo 'Ansible lint test: pass' && exit 0) + || (echo 'Ansible lint test: fail' && exit 1) notifications: webhooks: https://galaxy.ansible.com/api/v1/notifications/ diff --git a/README.md b/README.md index 16c2bd1..0b51194 100644 --- a/README.md +++ b/README.md @@ -8,14 +8,16 @@ Install PHP on Debian / Ubuntu / FreeBSD. Manage PHP-FPM, APCu, Opcache and Xdeb Managed OS / Versions --------------------- -| OS | PHP 7.0 | PHP 7.1 | PHP 7.2 | PHP 7.3 | PHP 7.4 | -|:---------------------:|:-------------------:|:--------------------------:|:--------------------------:|:-------------------------:|:--------------------------: -| Debian Stretch (9) | :heavy_check_mark: | :heavy_check_mark: (Sury) | :heavy_check_mark: (Sury) | :heavy_check_mark: (Sury) | :heavy_check_mark: (Sury) | -| Debian Buster (10) | :x: | :x: | :x: | :heavy_check_mark: | :heavy_check_mark: (Sury) | -| Ubuntu Xenial (16.04) | :heavy_check_mark: | :x: | :x: | :x: | :x: | -| Ubuntu Bionic (18.04) | :x: | :x: | :heavy_check_mark: | :x: | :x: | -| FreeBSD 11 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | Need tests... | -| FreeBSD 12 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | Need tests... | +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: + +| OS | PHP 7.0 | PHP 7.1 | PHP 7.2 | PHP 7.3 | PHP >= 7.4 | +|:---------------------:|:-------------------:|:--------------------:|:--------------------:|:--------------------:|:--------------------: +| Ubuntu Xenial (16.04) | :heavy_check_mark: | :x: | :x: | :x: | :x: | +| Ubuntu Bionic (18.04) | :x: | :x: | :heavy_check_mark: | :x: | :x: | +| FreeBSD 11 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | Need tests... | +| FreeBSD 12 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | Need tests... | Links: - [Sury](https://deb.sury.org/) @@ -160,12 +162,12 @@ Example Playbook roles: - { role: HanXHX.php } -### Debian Stretch with PHP 7.2 CLI (no FPM) +### Debian Bullseye with PHP 8.0 CLI (no FPM) - hosts: servers roles: - { role: HanXHX.sury } - - { role: HanXHX.php, php_version: '7.2', php_install_fpm: false } + - { role: HanXHX.php, php_version: '8.0', php_install_fpm: false } License ------- diff --git a/Vagrantfile b/Vagrantfile index d0b5a26..b6cdf49 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -6,15 +6,14 @@ 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-php73", :box => "debian/stretch64", :vars => { "php_version": '7.3' }}, - { :name => "debian-stretch-php74", :box => "debian/stretch64", :vars => { "php_version": '7.4' }}, - { :name => "debian-buster-php73", :box => "debian/buster64", :vars => { }}, - { :name => "debian-buster-php74", :box => "debian/buster64", :vars => { "php_version": '7.4' }}, - { :name => "ubuntu-xenial-php70", :box => "ubuntu/xenial64", :vars => { }}, - { :name => "ubuntu-bionic-php72", :box => "ubuntu/bionic64", :vars => { }}, + { :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-php74", :box => "debian/buster64", :vars => { "php_version": '7.4' }}, + { :name => "debian-bullseye-php74", :box => "debian/bullseye64", :vars => { }}, + { :name => "debian-bullseye-php80", :box => "debian/bullseye64", :vars => { "php_version": '8.0' }}, + { :name => "ubuntu-xenial-php70", :box => "ubuntu/xenial64", :vars => { }}, + { :name => "ubuntu-bionic-php72", :box => "ubuntu/bionic64", :vars => { }}, ] vms_freebsd = [ @@ -23,15 +22,14 @@ Vagrant.configure("2") do |config| ] 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-php73", :docker => "hanxhx/vagrant-ansible:debian9", :vars => { "php_version": '7.3' }}, - { :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-php74", :docker => "hanxhx/vagrant-ansible:debian10", :vars => { "php_version": '7.4' }}, - { :name => "docker-ubuntu-xenial-php70", :docker => "hanxhx/vagrant-ansible:ubuntu16.04", :vars => { }}, - { :name => "docker-ubuntu-bionic-php72", :docker => "hanxhx/vagrant-ansible:ubuntu18.04", :vars => { }}, + { :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-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-php80", :docker => "hanxhx/vagrant-ansible:debian11", :vars => { "php_version": '8.0' }}, + { :name => "docker-ubuntu-xenial-php70", :docker => "hanxhx/vagrant-ansible:ubuntu16.04", :vars => { }}, + { :name => "docker-ubuntu-bionic-php72", :docker => "hanxhx/vagrant-ansible:ubuntu18.04", :vars => { }}, ] config.vm.network "private_network", type: "dhcp" @@ -43,7 +41,12 @@ Vagrant.configure("2") do |config| d.remains_running = true d.has_ssh = true end - m.vm.provision "shell", inline: "apt-get update && apt-get install -y python python-apt" + + 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 "ansible" do |ansible| ansible.playbook = "tests/test.yml" ansible.verbose = 'vv' @@ -61,6 +64,11 @@ Vagrant.configure("2") do |config| v.memory = 256 end 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| ansible.playbook = "tests/test.yml" ansible.verbose = 'vv' diff --git a/meta/main.yml b/meta/main.yml index 9469381..5c3de13 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -1,15 +1,16 @@ --- galaxy_info: author: Emilien Mantel - description: Install and configure PHP 7.0/7.1/7.2/7.3 + description: Install and configure PHP 7.0/7.1/7.2/7.3/7.4/8.0 company: license: GPLv2 - min_ansible_version: 2.6 + min_ansible_version: 2.11 platforms: - name: Debian versions: - stretch - buster + - bullseye - name: Ubuntu versions: - xenial diff --git a/tests/includes/pre_Debian.yml b/tests/includes/pre_Debian.yml index 546526f..00ffada 100644 --- a/tests/includes/pre_Debian.yml +++ b/tests/includes/pre_Debian.yml @@ -14,12 +14,11 @@ - apt-transport-https - ca-certificates - curl + - gpg - lsb-release - nginx - vim - name: INCLUDE_TASKS | Sury include_tasks: Debian/sury.yml - when: - ((ansible_distribution_major_version is version('9', 'eq')) and (php_version is version('7.1', 'ge'))) or - ((ansible_distribution_major_version is version('10', 'eq')) and (php_version is version('7.4', 'ge'))) + when: php_version != php_default_version diff --git a/vars/Debian-bullseye.yml b/vars/Debian-bullseye.yml new file mode 100644 index 0000000..aeb930d --- /dev/null +++ b/vars/Debian-bullseye.yml @@ -0,0 +1 @@ +php_default_version: '7.4'