ansible-role-php/molecule/default/playbook.yml

66 lines
1.7 KiB
YAML
Raw Normal View History

2016-02-16 17:25:40 +01:00
---
2018-09-29 21:41:26 +02:00
- name: Converge
hosts: all
become: true
2016-02-16 17:25:40 +01:00
vars:
php_enable_webserver: false
2017-05-15 06:10:58 +02:00
php_enable_php_fpm: true
php_memory_limit: "192M"
php_enablerepo: "remi,remi-php70"
2018-09-29 21:41:26 +02:00
php_install_recommends: false
2016-02-16 17:25:40 +01:00
2018-09-29 21:47:37 +02:00
handlers:
- name: update apt cache
apt: update_cache=true
when: ansible_os_family == 'Debian'
2016-02-16 17:25:40 +01:00
pre_tasks:
- name: Update apt cache.
2018-09-29 21:41:26 +02:00
apt: update_cache=true cache_valid_time=600
when: ansible_os_family == 'Debian'
2016-11-23 17:40:54 +01:00
changed_when: false
2017-05-15 06:10:58 +02:00
# Ubuntu-specific tasks.
- name: Add repository for PHP 7.
apt_repository: repo='ppa:ondrej/php'
when: ansible_distribution == 'Ubuntu'
2016-02-16 22:59:49 +01:00
2017-05-15 06:10:58 +02:00
# Debian-specific tasks.
- name: Add dependencies for PHP versions (Debian).
apt:
2018-09-29 21:41:26 +02:00
name:
- apt-transport-https
- ca-certificates
state: present
2017-05-15 06:10:58 +02:00
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
when: ansible_distribution == "Debian"
2018-09-29 21:47:37 +02:00
notify: update apt cache
2017-05-15 06:10:58 +02:00
2018-09-29 21:47:37 +02:00
- meta: flush_handlers
2017-05-15 06:10:58 +02:00
2016-02-16 17:25:40 +01:00
roles:
- role: geerlingguy.repo-remi
2018-09-29 21:41:26 +02:00
when:
- ansible_os_family == 'RedHat'
- ansible_distribution != 'Fedora'
2018-09-29 23:15:09 +02:00
- role: geerlingguy.php
2018-09-29 21:41:26 +02:00
post_tasks:
- name: Confirm PHP configuration is correct.
2019-03-24 01:22:27 +01:00
shell: |
set -o pipefail
php -i | grep 'memory_limit.*192'
2018-09-29 21:41:26 +02:00
changed_when: false