Merge branch 'master' of adellam/ansible-roles into master

This commit is contained in:
Andrea Dell'Amico 2019-12-26 17:11:51 +01:00 committed by Gitea
commit 1238be3fd6
5 changed files with 33 additions and 35 deletions

View File

@ -11,14 +11,14 @@ phpfpm_remove_php_module: True
# centos_install_release_scl: True
# if we want the RH SCL package
php_install_rh_scl: False
php_rh_scl_shortver: 56
php_rh_scl_major: 5
php_rh_scl_minor: 6
php_rh_scl_shortver: 72
php_rh_scl_major: 7
php_rh_scl_minor: 2
php_rh_scl_version: '{{ php_rh_scl_major }}.{{ php_rh_scl_minor }}'
php_rh_scl_confdir: '/etc/opt/rh/rh-php{{ php_rh_scl_shortver }}'
php_remi_repo_url: 'http://rpms.remirepo.net/enterprise/remi-release-7.rpm'
php_remi_enable_repo: True
php_shortver: 56
php_shortver: 72
php_ini_values:
- { option: 'upload_max_filesize', value: '4096M' }

View File

@ -1,9 +1,9 @@
---
- import_tasks: php-service.yml
- import_tasks: php-fpm.yml
when: not php_install_rh_scl
when: not php_install_rh_scl | bool
- import_tasks: php-rh-sclfpm.yml
when: php_install_rh_scl
when: php_install_rh_scl | bool

View File

@ -1,17 +1,16 @@
---
- name: Install the Remi repository package
yum: name='{{ php_remi_repo_url }}' state=present
when: php_remi_enable_repo
when: php_remi_enable_repo | bool
tags: [ 'php', 'remi_repo' ]
- name: Enable the required Remi repo
command: yum-config-manager --enable remi-php{{ php_shortver }}
when: php_remi_enable_repo
when: php_remi_enable_repo | bool
tags: [ 'php', 'remi_repo' ]
- name: install the php-fpm package. We assume that apache is the web server of choice.
yum: pkg={{ item }} state={{ pkg_state }}
with_items: php_fpm_packages
yum: pkg={{ php_fpm_packages }} state={{ pkg_state }}
tags: php
- name: Set the timezone if we defined one
@ -22,26 +21,26 @@
- name: Set some other php.ini values
ini_file: dest={{ php_conf_dir }}/php.ini section=Date option={{ item.option }} value={{ item.value }} backup=yes
with_items: php_ini_values
with_items: '{{ php_ini_values }}'
when: php_ini_values is defined
notify: Reload php-fpm
tags: [ 'php', 'php_ini' ]
- name: Remove the standard www pool if needed
copy: content="" dest={{ php_conf_dir }}/php-fpm.d/www.conf owner=root group=root mode=0444
when: phpfpm_remove_default_pool
when: phpfpm_remove_default_pool | bool
notify: Restart php-fpm
tags: [ 'php', 'fpm_pool' ]
- name: Create the base sessions directory
file: dest={{ phpfpm_session_prefix }} owner=root group=root mode=0755 state=directory
when: phpfpm_use_default_template
when: phpfpm_use_default_template | bool
tags: [ 'php', 'fpm_pool', 'php_session' ]
- name: Create the directories where to store the sessions files. One for each pool
file: dest={{ phpfpm_session_prefix }}/{{ item.pool_name }} owner={{ item.user }} group={{ item.group }} mode=0750 state=directory
with_items: phpfpm_pools
when: phpfpm_use_default_template
with_items: '{{ phpfpm_pools }}'
when: phpfpm_use_default_template | bool
tags: [ 'php', 'fpm_pool', 'php_session' ]
- name: Install the php-fpm main config file
@ -51,20 +50,20 @@
- name: Install the php-fpm pools
template: src=php-fpm-pool.conf.j2 dest={{ php_conf_dir }}/php-fpm.d/{{ item.pool_name }}.conf owner=root group=root mode=0444
with_items: phpfpm_pools
when: phpfpm_use_default_template
with_items: '{{ phpfpm_pools }}'
when: phpfpm_use_default_template | bool
notify: Restart php-fpm
tags: [ 'php', 'fpm_pool', 'fpm_conf', 'fpm_pool_conf' ]
- name: Ensure that php-fpm is running and enabled
service: name=php-fpm state=started enabled=yes
when: phpfpm_service_enabled
when: phpfpm_service_enabled | bool
ignore_errors: True
tags: php
- name: Ensure that php-fpm is stopped if it is not meant to be running
service: name=php-fpm state=stopped enabled=no
when: not phpfpm_service_enabled
when: not phpfpm_service_enabled| bool
ignore_errors: True
tags: php

View File

@ -1,24 +1,23 @@
---
- name: install the php-fpm package from RH SCL. We assume that apache is the web server of choice.
yum: pkg={{ item }} state={{ pkg_state }}
with_items: php_rh_scl_packages
when: php_install_rh_scl
yum: pkg={{ php_rh_scl_packages }} state={{ pkg_state }}
when: php_install_rh_scl | bool
tags: php
- name: Set the timezone if we defined one, RH SCL version
ini_file: dest={{ php_rh_scl_confdir }}/php.ini section=Date option=date.timezone value={{ timezone }} backup=yes
when:
- timezone is defined
- php_install_rh_scl
- php_install_rh_scl | bool
notify: Reload php-fpm
tags: [ 'php', 'php_ini' ]
- name: Set some other php.ini values
ini_file: dest={{ php_rh_scl_confdir }}/php.ini section=Date option={{ item.option }} value={{ item.value }} backup=yes
with_items: php_ini_values
with_items: '{{ php_ini_values }}'
when:
- php_ini_values is defined
- php_install_rh_scl
- php_install_rh_scl | bool
notify: Reload php-fpm
tags: [ 'php', 'php_ini' ]
@ -26,19 +25,19 @@
copy: content="" dest={{ php_rh_scl_confdir }}/php-fpm.d/www.conf owner=root group=root mode=0444
when:
- phpfpm_remove_default_pool
- php_install_rh_scl
- php_install_rh_scl | bool
notify: Restart php-fpm
tags: [ 'php', 'fpm_pool' ]
- name: Create the base sessions directory, RH SCL version
file: dest={{ phpfpm_rh_scl_session_prefix }} owner=root group=root mode=0755 state=directory
when: phpfpm_use_default_template
when: phpfpm_use_default_template | bool
tags: [ 'php', 'fpm_pool', 'php_session' ]
- name: Create the directories where to store the sessions files. One for each pool, RH SCL version
file: dest={{ phpfpm_rh_scl_session_prefix }}/{{ item.pool_name }} owner={{ item.user }} group={{ item.group }} mode=0750 state=directory
with_items: phpfpm_pools
when: phpfpm_use_default_template
with_items: '{{ phpfpm_pools }}'
when: phpfpm_use_default_template | bool
tags: [ 'php', 'fpm_pool', 'php_session' ]
- name: Install the php-fpm main config file, RH SCL version
@ -48,20 +47,20 @@
- name: Install the php-fpm pools, RH SCL version
template: src=php-fpm-pool.conf.j2 dest={{ php_rh_scl_confdir }}/php-fpm.d/{{ item.pool_name }}.conf owner=root group=root mode=0444
with_items: phpfpm_pools
when: phpfpm_use_default_template
with_items: '{{ phpfpm_pools }}'
when: phpfpm_use_default_template | bool
notify: Restart php-fpm
tags: [ 'php', 'fpm_pool', 'fpm_conf', 'fpm_pool_conf' ]
- name: Ensure that php-fpm is running and enabled, RH SCL version
service: name='rh-php{{ php_rh_scl_shortver }}-php-fpm' state=started enabled=yes
when: phpfpm_service_enabled
when: phpfpm_service_enabled | bool
ignore_errors: True
tags: php
- name: Ensure that php-fpm is stopped if it is not meant to be running, RH SCL version
service: name='rh-php{{ php_rh_scl_shortver }}-php-fpm' state=stopped enabled=no
when: not phpfpm_service_enabled
when: not phpfpm_service_enabled | bool
ignore_errors: True
tags: php

View File

@ -1,7 +1,7 @@
---
- name: Remove the php apache module if it is possible. We assume that apache is the web server of choice.
yum: pkg={{ item }} state=absent
when: phpfpm_remove_php_module
when: phpfpm_remove_php_module | bool
with_items:
- php
tags: php
@ -25,7 +25,7 @@
- name: Create the users under the php-fpm processes will run
user: name={{ item.user }} comment="{{ item.user }}" home={{ item.homedir }} createhome={{ item.createhome }} shell=/sbin/nologin
with_items: phpfpm_pools
when: phpfpm_create_users
when: phpfpm_create_users | bool
notify: Restart php-fpm
ignore_errors: True
tags: [ 'php', 'fpm_pool' ]