Moved PHP-FPM into it's own role

pull/63/head
Ivan Grynenko 8 years ago
parent 9aeea4fe77
commit 8a5430336b
  1. 2
      lamp_centos7/hosts
  2. 3
      lamp_centos7/roles/php-fpm/handlers/main.yml
  3. 35
      lamp_centos7/roles/php-fpm/tasks/main.yml
  4. 15
      lamp_centos7/roles/php-fpm/templates/wordpress.conf
  5. 22
      lamp_centos7/roles/web/tasks/install_httpd.yml
  6. 9
      lamp_centos7/site.yml

@ -3,5 +3,3 @@
[dbservers]
122.129.219.67:221

@ -0,0 +1,3 @@
---
- name: restart php-fpm
service: name=php-fpm state=restarted

@ -0,0 +1,35 @@
---
- name: Install php-fpm and deps
yum: name={{ item }} state=present
with_items:
- php
- php-fpm
- php-enchant
- php-IDNA_Convert
- php-mbstring
- php-mysql
- php-PHPMailer
- php-process
- php-simplepie
- php-xml
- php-gd
- php-mbstring
- php-opcache
- php-pdo-dblib
- php-pecl-apcu
- php-pecl-memcached
- php-pecl-uploadprogress
- php-pecl-uuid
- php-pspell
- php-soap
- php-twig
- php-twig-ctwig
- php-xmlrpc
- name: Disable default pool
command: mv /etc/php-fpm.d/www.conf /etc/php-fpm.d/www.disabled creates=/etc/php-fpm.d/www.disabled
notify: restart php-fpm
- name: Copy php-fpm configuration
template: src=wordpress.conf dest=/etc/php-fpm.d/
notify: restart php-fpm

@ -0,0 +1,15 @@
[wordpress]
listen = /var/run/php-fpm/wordpress.sock
listen.owner = nginx
listen.group = nginx
listen.mode = 0660
user = wordpress
group = wordpress
pm = dynamic
pm.max_children = 10
pm.start_servers = 1
pm.min_spare_servers = 1
pm.max_spare_servers = 3
pm.max_requests = 500
chdir = /srv/wordpress/
php_admin_value[open_basedir] = /srv/wordpress/:/tmp

@ -1,28 +1,10 @@
---
# These tasks install http and the php modules.
- name: Install http and php etc
yum: name={{ item }} state=present
- name: Install http and libraries
yum: name={{ item }} state=latest
with_items:
- httpd
- php
- php-mysql
- php-fpm
- php-gd
- php-mbstring
- php-mcrypt
- php-opcache
- php-pdo-dblib
- php-pecl-apcu
- php-pecl-memcached
- php-pecl-uploadprogress
- php-pecl-uuid
- php-pspell
- php-soap
- php-twig
- php-twig-ctwig
- php-xml
- php-xmlrpc
- git
- libsemanage-python
- libselinux-python

@ -1,5 +1,5 @@
---
# This playbook deploys the whole application stack in this site.
# This playbook deploys the whole application stack in this site.
- name: apply common configuration to all nodes
hosts: all
@ -15,6 +15,13 @@
roles:
- web
- name: deploy PHP-FPM
hosts: webservers
remote_user: root
roles:
- php-fpm
- name: deploy MySQL and configure the databases
hosts: dbservers
remote_user: root