Merge pull request #195 from geerlingguy/191-debian-tests

Fixes #191: Add automated tests for Debian 8, fix systemd service issue.
This commit is contained in:
Jeff Geerling 2017-05-16 22:27:00 -05:00 committed by GitHub
commit d3006d2897
3 changed files with 56 additions and 1 deletions

View File

@ -9,6 +9,9 @@ env:
- distro: fedora24
playbook: test.yml
php_version: 5.6
- distro: debian8
playbook: test.yml
php_version: 7.0
- distro: ubuntu1604
playbook: test.yml
php_version: 7.0
@ -49,5 +52,20 @@ script:
# Ensure PHP configurations have taken effect.
- docker exec --tty ${container_id} env TERM=xterm php -i | grep 'memory_limit.*192'
# Check the status of PHP-FPM.
- |
if [ "${playbook}" == "test.yml" ]; then
case "${distro}" in
"centos7"|"fedora24")
docker exec --tty ${container_id} env TERM=xterm systemctl --no-pager status php-fpm status
docker exec --tty ${container_id} env TERM=xterm systemctl --no-pager status php-fpm status | grep -qF "fpm.service; enabled"
;;
"debian8"|"ubuntu1604")
docker exec --tty ${container_id} env TERM=xterm systemctl --no-pager status php${php_version}-fpm status
docker exec --tty ${container_id} env TERM=xterm systemctl --no-pager status php${php_version}-fpm status | grep -qF "fpm.service; enabled"
;;
esac
fi
notifications:
webhooks: https://galaxy.ansible.com/api/v1/notifications/

View File

@ -74,4 +74,13 @@
name: "{{ php_fpm_daemon }}"
state: started
enabled: yes
when: php_enable_php_fpm
when: php_enable_php_fpm and ansible_distribution != "Debian"
# See: https://github.com/ansible/ansible/issues/22303
- name: Ensure php-fpm is started and enabled at boot (if configured, Debian).
service:
name: "{{ php_fpm_daemon }}"
state: started
enabled: yes
use: service
when: php_enable_php_fpm and ansible_distribution == "Debian"

View File

@ -3,6 +3,7 @@
vars:
php_enable_webserver: false
php_enable_php_fpm: true
php_memory_limit: "192M"
php_enablerepo: "remi,remi-php70"
php_install_recommends: no
@ -13,6 +14,7 @@
when: ansible_os_family == 'Debian'
changed_when: false
# Ubuntu-specific tasks.
- include_vars: test-vars-ubuntu1204.yml
when: ansible_distribution == 'Ubuntu' and ansible_distribution_version == '12.04'
@ -24,6 +26,32 @@
apt_repository: repo='ppa:ondrej/php'
when: ansible_distribution == 'Ubuntu' and ansible_distribution_version == '12.04'
# Debian-specific tasks.
- name: Add dependencies for PHP versions (Debian).
apt:
name: "{{ item }}"
with_items:
- apt-transport-https
- ca-certificates
when: ansible_distribution == "Debian"
- name: Add Ondrej Sury's apt key (Debian).
apt_key:
url: https://packages.sury.org/php/apt.gpg
state: present
when: ansible_distribution == "Debian"
- name: Add Ondrej Sury's repo (Debian).
apt_repository:
repo: "deb https://packages.sury.org/php/ {{ ansible_distribution_release }} main"
state: present
register: php_ondrej_debian_repo
when: ansible_distribution == "Debian"
- name: Update apt caches after repo is added (Debian).
apt: update_cache=yes
when: php_ondrej_debian_repo.changed and (ansible_distribution == "Debian")
roles:
- role: geerlingguy.repo-remi
when: ansible_os_family == 'RedHat' and ansible_distribution != 'Fedora'