Skip to content

Commit 0d84489

Browse files
committed
Add ability to restart php-fpm service
1 parent 5b6f9e1 commit 0d84489

File tree

5 files changed

+23
-2
lines changed

5 files changed

+23
-2
lines changed

README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
> `franklinkim.environment` is an [Ansible](http://www.ansible.com) role which:
99
>
1010
> * adds `/etc/environment` variables
11+
> * adds php-fpm `pool.d/www.conf` variables
1112
1213
## Installation
1314

@@ -42,7 +43,12 @@ Here is a list of all the default variables for this role, which are also availa
4243
4344
# Path to the environment files
4445
system_environment_file: /etc/environment
45-
php_fpm_environmnet_file: # Set this to ennable php-fpm environment variables
46+
47+
# Set this to ennable php-fpm environment variables
48+
php_fpm_environmnet_file:
49+
# Set this if you want the php-fpm service restarted
50+
php_fpm_service_name:
51+
4652
# The environment file owner
4753
environment_file_owner: root
4854
# The environment file group
@@ -74,6 +80,7 @@ This is an example playbook:
7480
- franklinkim.environment
7581
vars:
7682
php_fpm_environment_file: /etc/php-fpm.www.conf
83+
php_fpm_service_name: # Specify this to restart the php-fpm service
7784
environment_config:
7885
LC_ALL: en_US.UTF-8 # Added to system environment
7986
APP_ENV:

defaults/main.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@
22

33
# Path to the environment files
44
system_environment_file: /etc/environment
5-
php_fpm_environmnet_file: # Set this to ennable php-fpm environment variables
5+
6+
# Set this to ennable php-fpm environment variables
7+
php_fpm_environmnet_file:
8+
# Set this if you want the php-fpm service restarted
9+
php_fpm_service_name:
10+
611
# The environment file owner
712
environment_file_owner: root
813
# The environment file group

meta/readme.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ badges: |
99
[![GitHub Stars](https://img.shields.io/github/stars/weareinteractive/ansible-environment.svg)](https://github.com/weareinteractive/ansible-environment)
1010
description: |
1111
> * adds `/etc/environment` variables
12+
> * adds php-fpm `pool.d/www.conf` variables

tasks/config.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,10 @@
5656
line: 'env[{{ item.key }}] = "{{ item.value.value }}"'
5757
with_dict: "{{ environment_config }}"
5858
when: php_fpm_environment_file is defined and (item.value.environments is defined and 'php-fpm' in item.value.environments)
59+
60+
- name: restart php-fpm
61+
systemd:
62+
name: "{{ php_fpm_service_name }}"
63+
state: restarted
64+
when: php_fpm_service_name is defined
65+

tests/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
- franklinkim.environment
66
vars:
77
php_fpm_environment_file: /etc/php-fpm.www.conf
8+
php_fpm_service_name: # Specify this to restart the php-fpm service
89
environment_config:
910
LC_ALL: en_US.UTF-8 # Added to system environment
1011
APP_ENV:

0 commit comments

Comments
 (0)