roles/php-fpm: Use set_fact to set packages

Instead of looping over a list of items to install, we can actually
just give a list directly to the apt module. This allows the module
to install all packages in one transaction, which is faster as well
as slightly safer for some dependency resolution scenarios.
This commit is contained in:
Alan Orth 2018-04-29 16:10:53 +03:00
parent 45517a1421
commit 7aed78016c
Signed by: alanorth
GPG Key ID: 0FB860CC9C45B1B9
2 changed files with 26 additions and 20 deletions

View File

@ -1,17 +1,20 @@
---
- block:
- name: Set php-fpm packages
set_fact:
php_fpm_packages:
- php7.0-fpm
# for WordPress
- php7.0-mysql
- php7.0-gd
- php7.0-curl
# for Piwik
- php7.0-mbstring
- php7.0-xml
- name: Install php7.0-fpm and deps
apt: name={{ item }} state=present update_cache=yes
loop:
- php7.0-fpm
# for WordPress
- php7.0-mysql
- php7.0-gd
- php7.0-curl
# for Piwik
- php7.0-mbstring
- php7.0-xml
apt: name={{ php_fpm_packages }} state=present update_cache=yes
# only copy php-fpm config for vhosts that need WordPress or PHP
- name: Copy php-fpm pool config

View File

@ -1,17 +1,20 @@
---
- block:
- name: Set php-fpm packages
set_fact:
php_fpm_packages:
- php-fpm
# for WordPress
- php-mysql
- php-gd
- php-curl
# for Piwik
- php-mbstring
- php-xml
- name: Install php-fpm and deps
apt: name={{ item }} state=present update_cache=yes
loop:
- php-fpm
# for WordPress
- php-mysql
- php-gd
- php-curl
# for Piwik
- php-mbstring
- php-xml
apt: name={{ php_fpm_packages }} state=present update_cache=yes
# only copy php-fpm config for vhosts that need WordPress or PHP
- name: Copy php-fpm pool config