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,9 +1,9 @@
|
||||
---
|
||||
|
||||
- block:
|
||||
- name: Install php7.0-fpm and deps
|
||||
apt: name={{ item }} state=present update_cache=yes
|
||||
loop:
|
||||
- name: Set php-fpm packages
|
||||
set_fact:
|
||||
php_fpm_packages:
|
||||
- php7.0-fpm
|
||||
# for WordPress
|
||||
- php7.0-mysql
|
||||
@ -13,6 +13,9 @@
|
||||
- php7.0-mbstring
|
||||
- php7.0-xml
|
||||
|
||||
- name: Install php7.0-fpm and deps
|
||||
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
|
||||
template: src=php7.0-pool.conf.j2 dest=/etc/php/7.0/fpm/pool.d/{{ item.domain_name }}.conf owner=root group=root mode=0644
|
||||
|
@ -1,9 +1,9 @@
|
||||
---
|
||||
|
||||
- block:
|
||||
- name: Install php-fpm and deps
|
||||
apt: name={{ item }} state=present update_cache=yes
|
||||
loop:
|
||||
- name: Set php-fpm packages
|
||||
set_fact:
|
||||
php_fpm_packages:
|
||||
- php-fpm
|
||||
# for WordPress
|
||||
- php-mysql
|
||||
@ -13,6 +13,9 @@
|
||||
- php-mbstring
|
||||
- php-xml
|
||||
|
||||
- name: Install php-fpm and deps
|
||||
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
|
||||
template: src=php7.2-pool.conf.j2 dest=/etc/php/7.2/fpm/pool.d/{{ item.domain_name }}.conf owner=root group=root mode=0644
|
||||
|
Loading…
Reference in New Issue
Block a user