civictechro/website-alba-iulia-smart-city

View on GitHub
trellis/roles/php/tasks/main.yml

Summary

Maintainability
Test Coverage
---
- name: Add PHP 7.2 PPA
  apt_repository:
    repo: "ppa:ondrej/php"
    update_cache: yes

- name: Install PHP 7.2
  apt:
    name: "{{ item.key }}"
    state: "{{ item.value }}"
    cache_valid_time: "{{ apt_cache_valid_time }}"
  with_dict: "{{ php_extensions }}"

- name: Start php7.2-fpm service
  service:
    name: php7.2-fpm
    state: started
    enabled: true

- name: Check for existing php7.1-fpm service
  stat:
    path: /etc/init.d/php7.1-fpm
  register: php71_status

- name: Stop php7.1-fpm service if it exists
  service:
    name: php7.1-fpm
    state: stopped
    enabled: false
  register: service_stopped
  when: php71_status.stat.exists
  notify: reload php-fpm

- name: PHP configuration file
  template:
    src: php.ini.j2
    dest: /etc/php/7.2/fpm/php.ini
  notify: reload php-fpm