Commit 8c298545 authored by nimrod's avatar nimrod
Browse files

- Install package, start service, test for said functionality.

- Include OpenBSD 5.9 in supported OSes.
- Better assertions.
parent f9bb7d26
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@ galaxy_info:
  platforms:
  - name: OpenBSD
    versions:
    - 5.9
    - 6.0
  - name: Ubuntu
    versions:
+22 −2
Original line number Diff line number Diff line
@@ -4,5 +4,25 @@
- name: Assertions
  assert:
    that:
        - ansible_os_family in ['OpenBSD', 'Debian']
        - ansible_distribution_release in ['6.0', 'jessie', 'trusty']
        - ansible_os_family in php_fpm_service
        - ansible_distribution_release in ['6.0', '5.9', 'jessie', 'trusty']

- name: APT install
  when: ansible_pkg_mgr == 'apt'
  apt:
      name: php5-fpm
      state: present
      update_cache: yes
      cache_valid_time: 3600

- name: pkg install
  when: ansible_pkg_mgr == 'openbsd_pkg'
  openbsd_pkg:
      name: '{{ php_fpm_pkg_version[ansible_distribution_release] }}'
      state: present

- name: Enable service
  service:
      name: '{{ php_fpm_service[ansible_os_family] }}'
      state: started
      enabled: yes

tests/test_php-fpm.py

0 → 100644
+15 −0
Original line number Diff line number Diff line
from testinfra.utils.ansible_runner import AnsibleRunner

testinfra_hosts = AnsibleRunner('.molecule/ansible_inventory').get_hosts('all')


def test_php_fpm_service(Service, SystemInfo):
    if SystemInfo.type == 'openbsd':
        service = Service('php56_fpm')
    elif SystemInfo.type == 'debian':
        service = Service('php5-fpm')
    assert service.is_running
    try:
        assert service.is_enabled
    except NotImplementedError:
        pass
+8 −0
Original line number Diff line number Diff line
---
# vars file for php-fpm

php_fpm_pkg_version:
    '5.9': php-fastcgi-5.6.18
    '6.0': php-fastcgi-5.6.23p0

php_fpm_service:
    OpenBSD: php56_fpm
    Debian: php5-fpm