Skip to content
This repository was archived by the owner on Feb 13, 2023. It is now read-only.

Commit df60dd1

Browse files
committed
Update PHP role to latest version.
1 parent 20b7654 commit df60dd1

File tree

13 files changed

+171
-95
lines changed

13 files changed

+171
-95
lines changed

provisioning/requirements.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ roles:
4343
- name: geerlingguy.nodejs
4444
version: 5.1.1
4545
- name: geerlingguy.php
46-
version: 4.5.1
46+
version: 4.6.1
4747
- name: geerlingguy.php-memcached
4848
version: 2.0.2
4949
- name: geerlingguy.php-mysql
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
skip_list:
2-
- '306'
3-
- '405'
4-
- '503'
5-
- '106'
2+
- 'yaml'
3+
- 'risky-shell-pipe'
4+
- 'no-handler'
5+
- 'role-name'
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
---
2+
name: CI
3+
'on':
4+
pull_request:
5+
push:
6+
branches:
7+
- master
8+
schedule:
9+
- cron: "0 4 * * 4"
10+
11+
defaults:
12+
run:
13+
working-directory: 'geerlingguy.php'
14+
15+
jobs:
16+
17+
lint:
18+
name: Lint
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Check out the codebase.
22+
uses: actions/checkout@v2
23+
with:
24+
path: 'geerlingguy.php'
25+
26+
- name: Set up Python 3.
27+
uses: actions/setup-python@v2
28+
with:
29+
python-version: '3.x'
30+
31+
- name: Install test dependencies.
32+
run: pip3 install yamllint
33+
34+
- name: Lint code.
35+
run: |
36+
yamllint .
37+
38+
molecule:
39+
name: Molecule
40+
runs-on: ubuntu-latest
41+
strategy:
42+
matrix:
43+
include:
44+
- distro: centos8
45+
playbook: converge.yml
46+
- distro: centos7
47+
playbook: converge.yml
48+
- distro: ubuntu2004
49+
playbook: converge.yml
50+
- distro: ubuntu1804
51+
playbook: converge.yml
52+
- distro: debian10
53+
playbook: converge.yml
54+
- distro: debian9
55+
playbook: converge.yml
56+
57+
- distro: centos7
58+
playbook: source-install.yml
59+
60+
steps:
61+
- name: Check out the codebase.
62+
uses: actions/checkout@v2
63+
with:
64+
path: 'geerlingguy.php'
65+
66+
- name: Set up Python 3.
67+
uses: actions/setup-python@v2
68+
with:
69+
python-version: '3.x'
70+
71+
- name: Install test dependencies.
72+
run: pip3 install ansible molecule[docker] docker
73+
74+
- name: Run Molecule tests.
75+
run: molecule test
76+
env:
77+
PY_COLORS: '1'
78+
ANSIBLE_FORCE_COLOR: '1'
79+
MOLECULE_DISTRO: ${{ matrix.distro }}
80+
MOLECULE_PLAYBOOK: ${{ matrix.playbook }}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
# This workflow requires a GALAXY_API_KEY secret present in the GitHub
3+
# repository or organization.
4+
#
5+
# See: https://github.com/marketplace/actions/publish-ansible-role-to-galaxy
6+
# See: https://github.com/ansible/galaxy/issues/46
7+
8+
name: Release
9+
'on':
10+
push:
11+
tags:
12+
- '*'
13+
14+
defaults:
15+
run:
16+
working-directory: 'geerlingguy.php'
17+
18+
jobs:
19+
20+
release:
21+
name: Release
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: Check out the codebase.
25+
uses: actions/checkout@v2
26+
with:
27+
path: 'geerlingguy.php'
28+
29+
- name: Set up Python 3.
30+
uses: actions/setup-python@v2
31+
with:
32+
python-version: '3.x'
33+
34+
- name: Install Ansible.
35+
run: pip3 install ansible-base
36+
37+
- name: Trigger a new import on Galaxy.
38+
run: ansible-galaxy role import --api-key ${{ secrets.GALAXY_API_KEY }} $(echo ${{ github.repository }} | cut -d/ -f1) $(echo ${{ github.repository }} | cut -d/ -f2)
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
*.retry
22
*/__pycache__
33
*.pyc
4+
.cache
5+

provisioning/roles/geerlingguy.php/.travis.yml

Lines changed: 0 additions & 38 deletions
This file was deleted.

provisioning/roles/geerlingguy.php/README.md

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Ansible Role: PHP
22

3-
[![Build Status](https://travis-ci.org/geerlingguy/ansible-role-php.svg?branch=master)](https://travis-ci.org/geerlingguy/ansible-role-php)
3+
[![CI](https://github.com/geerlingguy/ansible-role-php/workflows/CI/badge.svg?event=push)](https://github.com/geerlingguy/ansible-role-php/actions?query=workflow%3ACI)
44

55
Installs PHP on RedHat/CentOS and Debian/Ubuntu servers.
66

@@ -71,14 +71,22 @@ Control over the fpm daemon's state; set these to `stopped` and `false` if you w
7171

7272
The handler restarts PHP-FPM by default. Setting the value to `reloaded` will reload the service, intead of restarting it.
7373

74-
php_fpm_listen: "127.0.0.1:9000"
75-
php_fpm_listen_allowed_clients: "127.0.0.1"
76-
php_fpm_pm_max_children: 50
77-
php_fpm_pm_start_servers: 5
78-
php_fpm_pm_min_spare_servers: 5
79-
php_fpm_pm_max_spare_servers: 5
8074

81-
Specific settings inside the default `www.conf` PHP-FPM pool. If you'd like to manage additional settings, you can do so either by replacing the file with your own template or using `lineinfile` like this role does inside `tasks/configure-fpm.yml`.
75+
php_fpm_pools:
76+
- pool_name: www
77+
pool_template: www.conf.j2
78+
pool_listen: "127.0.0.1:9000"
79+
pool_listen_allowed_clients: "127.0.0.1"
80+
pool_pm: dynamic
81+
pool_pm_max_children: 5
82+
pool_pm_start_servers: 2
83+
pool_pm_min_spare_servers: 1
84+
pool_pm_max_spare_servers: 3
85+
pool_pm_max_requests: 500
86+
87+
List of PHP-FPM pool to create. By default, www pool is created. To setup a new pool, add an item to php_fpm_pools list.
88+
89+
Specific settings inside the default `www.conf.j2` PHP-FPM pool. If you'd like to manage additional settings, you can do so either by replacing the file with your own template using `pool_template`.
8290

8391
### php.ini settings
8492

provisioning/roles/geerlingguy.php/defaults/main.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,20 @@ php_fpm_pm_max_children: 50
3030
php_fpm_pm_start_servers: 5
3131
php_fpm_pm_min_spare_servers: 5
3232
php_fpm_pm_max_spare_servers: 5
33+
php_fpm_pm_max_requests: 0
34+
35+
# PHP-FPM pool configuration.
36+
php_fpm_pools:
37+
- pool_name: www
38+
pool_template: www.conf.j2
39+
pool_listen: "{{ php_fpm_listen }}"
40+
pool_listen_allowed_clients: "{{ php_fpm_listen_allowed_clients }}"
41+
pool_pm: dynamic
42+
pool_pm_max_children: "{{ php_fpm_pm_max_children }}"
43+
pool_pm_start_servers: "{{ php_fpm_pm_start_servers }}"
44+
pool_pm_min_spare_servers: "{{ php_fpm_pm_min_spare_servers }}"
45+
pool_pm_max_spare_servers: "{{ php_fpm_pm_max_spare_servers }}"
46+
pool_php_fpm_pm_max_requests: "{{ php_fpm_pm_max_requests }}"
3347

3448
# The executable to run when calling PHP from the command line.
3549
php_executable: "php"

provisioning/roles/geerlingguy.php/meta/main.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ galaxy_info:
1111
platforms:
1212
- name: EL
1313
versions:
14-
- 6
1514
- 7
1615
- 8
1716
- name: Fedora

provisioning/roles/geerlingguy.php/molecule/default/molecule.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@ dependency:
33
name: galaxy
44
driver:
55
name: docker
6-
lint: |
7-
set -e
8-
yamllint .
9-
ansible-lint
106
platforms:
117
- name: instance
128
image: "geerlingguy/docker-${MOLECULE_DISTRO:-centos7}-ansible:latest"

provisioning/roles/geerlingguy.php/tasks/configure-fpm.yml

Lines changed: 5 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -33,40 +33,15 @@
3333
mode: 0755
3434
when: php_fpm_pool_conf_path_dir_stat.stat.islnk is not defined
3535

36-
- name: Ensure the default pool exists.
36+
- name: Create fpm pools.
3737
template:
38-
src: www.conf.j2
39-
dest: "{{ php_fpm_pool_conf_path }}"
38+
src: "{{ item.pool_template | default('www.conf.j2', true) }}"
39+
dest: "{{ php_fpm_pool_conf_path | dirname }}/{{ item.pool_name }}.conf"
4040
owner: root
4141
group: root
4242
mode: 0644
43-
force: false
44-
when: php_enable_php_fpm
45-
46-
- name: Configure php-fpm pool (if enabled).
47-
lineinfile:
48-
dest: "{{ php_fpm_pool_conf_path }}"
49-
regexp: "{{ item.regexp }}"
50-
line: "{{ item.line }}"
51-
state: present
52-
mode: 0644
53-
with_items:
54-
- regexp: "^user.?=.+$"
55-
line: "user = {{ php_fpm_pool_user }}"
56-
- regexp: "^group.?=.+$"
57-
line: "group = {{ php_fpm_pool_group }}"
58-
- regexp: "^listen.?=.+$"
59-
line: "listen = {{ php_fpm_listen }}"
60-
- regexp: '^listen\.allowed_clients.?=.+$'
61-
line: "listen.allowed_clients = {{ php_fpm_listen_allowed_clients }}"
62-
- regexp: '^pm\.max_children.?=.+$'
63-
line: "pm.max_children = {{ php_fpm_pm_max_children }}"
64-
- regexp: '^pm\.start_servers.?=.+$'
65-
line: "pm.start_servers = {{ php_fpm_pm_start_servers }}"
66-
- regexp: '^pm\.min_spare_servers.?=.+$'
67-
line: "pm.min_spare_servers = {{ php_fpm_pm_min_spare_servers }}"
68-
- regexp: '^pm\.max_spare_servers.?=.+$'
69-
line: "pm.max_spare_servers = {{ php_fpm_pm_max_spare_servers }}"
43+
force: true
44+
loop: "{{ php_fpm_pools | default([], true) }}"
7045
when: php_enable_php_fpm
7146
notify: restart php-fpm
7247

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
1-
[www]
2-
listen = 127.0.0.1:9000
3-
listen.allowed_clients = 127.0.0.1
1+
; {{ ansible_managed }}
2+
3+
[{{ item.pool_name | mandatory }}]
4+
listen = {{ item.pool_listen | mandatory }}
5+
listen.allowed_clients = {{ item.pool_listen_allowed_clients | default('127.0.0.1', true) }}
46
user = {{ php_fpm_pool_user }}
57
group = {{ php_fpm_pool_group }}
68

79
listen.owner = {{ php_fpm_pool_user }}
810
listen.group = {{ php_fpm_pool_group }}
911

10-
pm = dynamic
11-
pm.max_children = 50
12-
pm.start_servers = 5
13-
pm.min_spare_servers = 5
14-
pm.max_spare_servers = 5
15-
pm.max_requests = 500
12+
pm = {{ item.pool_pm | default('dynamic', true) }}
13+
pm.max_children = {{ item.pool_pm_max_children | default(50, true) }}
14+
pm.start_servers = {{ item.pool_pm_start_servers | default(5, true) }}
15+
pm.min_spare_servers = {{ item.pool_pm_min_spare_servers | default(5, true) }}
16+
pm.max_spare_servers = {{ item.pool_pm_max_spare_servers | default(5, true) }}
17+
pm.max_requests = {{ item.pool_pm_max_requests | default(500, true) }}

0 commit comments

Comments
 (0)