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:
parent
45517a1421
commit
7aed78016c
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user