mirror of
https://github.com/geerlingguy/ansible-role-php.git
synced 2024-11-28 12:45:16 +01:00
Merge branch 'master' into master
This commit is contained in:
commit
e71d49d319
4
.ansible-lint
Normal file
4
.ansible-lint
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
skip_list:
|
||||||
|
- '306'
|
||||||
|
- '405'
|
||||||
|
- '503'
|
4
.github/FUNDING.yml
vendored
Normal file
4
.github/FUNDING.yml
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
# These are supported funding model platforms
|
||||||
|
---
|
||||||
|
github: geerlingguy
|
||||||
|
patreon: geerlingguy
|
56
.github/stale.yml
vendored
Normal file
56
.github/stale.yml
vendored
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
# Configuration for probot-stale - https://github.com/probot/stale
|
||||||
|
|
||||||
|
# Number of days of inactivity before an Issue or Pull Request becomes stale
|
||||||
|
daysUntilStale: 90
|
||||||
|
|
||||||
|
# Number of days of inactivity before an Issue or Pull Request with the stale label is closed.
|
||||||
|
# Set to false to disable. If disabled, issues still need to be closed manually, but will remain marked as stale.
|
||||||
|
daysUntilClose: 30
|
||||||
|
|
||||||
|
# Only issues or pull requests with all of these labels are check if stale. Defaults to `[]` (disabled)
|
||||||
|
onlyLabels: []
|
||||||
|
|
||||||
|
# Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable
|
||||||
|
exemptLabels:
|
||||||
|
- pinned
|
||||||
|
- security
|
||||||
|
- planned
|
||||||
|
|
||||||
|
# Set to true to ignore issues in a project (defaults to false)
|
||||||
|
exemptProjects: false
|
||||||
|
|
||||||
|
# Set to true to ignore issues in a milestone (defaults to false)
|
||||||
|
exemptMilestones: false
|
||||||
|
|
||||||
|
# Set to true to ignore issues with an assignee (defaults to false)
|
||||||
|
exemptAssignees: false
|
||||||
|
|
||||||
|
# Label to use when marking as stale
|
||||||
|
staleLabel: stale
|
||||||
|
|
||||||
|
# Limit the number of actions per hour, from 1-30. Default is 30
|
||||||
|
limitPerRun: 30
|
||||||
|
|
||||||
|
pulls:
|
||||||
|
markComment: |-
|
||||||
|
This pull request has been marked 'stale' due to lack of recent activity. If there is no further activity, the PR will be closed in another 30 days. Thank you for your contribution!
|
||||||
|
|
||||||
|
Please read [this blog post](https://www.jeffgeerling.com/blog/2020/enabling-stale-issue-bot-on-my-github-repositories) to see the reasons why I mark pull requests as stale.
|
||||||
|
|
||||||
|
unmarkComment: >-
|
||||||
|
This pull request is no longer marked for closure.
|
||||||
|
|
||||||
|
closeComment: >-
|
||||||
|
This pull request has been closed due to inactivity. If you feel this is in error, please reopen the pull request or file a new PR with the relevant details.
|
||||||
|
|
||||||
|
issues:
|
||||||
|
markComment: |-
|
||||||
|
This issue has been marked 'stale' due to lack of recent activity. If there is no further activity, the issue will be closed in another 30 days. Thank you for your contribution!
|
||||||
|
|
||||||
|
Please read [this blog post](https://www.jeffgeerling.com/blog/2020/enabling-stale-issue-bot-on-my-github-repositories) to see the reasons why I mark issues as stale.
|
||||||
|
|
||||||
|
unmarkComment: >-
|
||||||
|
This issue is no longer marked for closure.
|
||||||
|
|
||||||
|
closeComment: >-
|
||||||
|
This issue has been closed due to inactivity. If you feel this is in error, please reopen the issue or file a new issue with the relevant details.
|
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,2 +1,3 @@
|
|||||||
*.retry
|
*.retry
|
||||||
tests/test.sh
|
*/__pycache__
|
||||||
|
*.pyc
|
||||||
|
82
.travis.yml
82
.travis.yml
@ -1,71 +1,33 @@
|
|||||||
---
|
---
|
||||||
|
language: python
|
||||||
services: docker
|
services: docker
|
||||||
|
|
||||||
env:
|
env:
|
||||||
# Test package install on all supported OSes.
|
global:
|
||||||
- distro: centos7
|
- ROLE_NAME: php
|
||||||
playbook: test.yml
|
matrix:
|
||||||
php_version: 7.0
|
- MOLECULE_DISTRO: centos8
|
||||||
- distro: fedora27
|
- MOLECULE_DISTRO: centos7
|
||||||
playbook: test.yml
|
- MOLECULE_DISTRO: ubuntu1804
|
||||||
php_version: 7.1
|
- MOLECULE_DISTRO: ubuntu1604
|
||||||
- distro: debian9
|
- MOLECULE_DISTRO: debian9
|
||||||
playbook: test.yml
|
|
||||||
php_version: 7.0
|
|
||||||
- distro: debian8
|
|
||||||
playbook: test.yml
|
|
||||||
php_version: 7.0
|
|
||||||
- distro: ubuntu1604
|
|
||||||
playbook: test.yml
|
|
||||||
php_version: 7.0
|
|
||||||
- distro: ubuntu1404
|
|
||||||
playbook: test.yml
|
|
||||||
php_version: 7.0
|
|
||||||
|
|
||||||
# Only test source install on latest supported OSes.
|
- MOLECULE_DISTRO: centos7
|
||||||
- distro: centos7
|
MOLECULE_PLAYBOOK: playbook-source.yml
|
||||||
playbook: test-source.yml
|
|
||||||
php_version: 7.1.9
|
install:
|
||||||
- distro: ubuntu1604
|
# Install test dependencies.
|
||||||
playbook: test-source.yml
|
- pip install molecule yamllint ansible-lint docker
|
||||||
php_version: 7.1.9
|
|
||||||
|
before_script:
|
||||||
|
# Use actual Ansible Galaxy role name for the project directory.
|
||||||
|
- cd ../
|
||||||
|
- mv ansible-role-$ROLE_NAME geerlingguy.$ROLE_NAME
|
||||||
|
- cd geerlingguy.$ROLE_NAME
|
||||||
|
|
||||||
script:
|
script:
|
||||||
# Configure test script so we can run extra tests after playbook is run.
|
|
||||||
- export container_id=$(date +%s)
|
|
||||||
- export cleanup=false
|
|
||||||
|
|
||||||
# Download test shim.
|
|
||||||
- wget -O ${PWD}/tests/test.sh https://gist.githubusercontent.com/geerlingguy/73ef1e5ee45d8694570f334be385e181/raw/
|
|
||||||
- chmod +x ${PWD}/tests/test.sh
|
|
||||||
|
|
||||||
# Run tests.
|
# Run tests.
|
||||||
- ${PWD}/tests/test.sh
|
- molecule test
|
||||||
|
|
||||||
# Ensure PHP is installed and at the right version.
|
|
||||||
- 'docker exec --tty ${container_id} env TERM=xterm which php'
|
|
||||||
- 'docker exec --tty ${container_id} env TERM=xterm test -x /usr/bin/php'
|
|
||||||
|
|
||||||
- 'docker exec --tty ${container_id} env TERM=xterm php --version'
|
|
||||||
- 'docker exec --tty ${container_id} env TERM=xterm /usr/bin/php --version | grep -qF "PHP ${php_version}"'
|
|
||||||
|
|
||||||
# Ensure PHP configurations have taken effect.
|
|
||||||
- docker exec --tty ${container_id} env TERM=xterm php -i | grep 'memory_limit.*192'
|
|
||||||
|
|
||||||
# Check the status of PHP-FPM.
|
|
||||||
- |
|
|
||||||
if [ "${playbook}" == "test.yml" ]; then
|
|
||||||
case "${distro}" in
|
|
||||||
"centos7"|"fedora24")
|
|
||||||
docker exec --tty ${container_id} env TERM=xterm systemctl --no-pager status php-fpm status
|
|
||||||
docker exec --tty ${container_id} env TERM=xterm systemctl --no-pager status php-fpm status | grep -qF "fpm.service; enabled"
|
|
||||||
;;
|
|
||||||
"debian8"|"ubuntu1604")
|
|
||||||
docker exec --tty ${container_id} env TERM=xterm systemctl --no-pager status php${php_version}-fpm status
|
|
||||||
docker exec --tty ${container_id} env TERM=xterm systemctl --no-pager status php${php_version}-fpm status | grep -qF "fpm.service; enabled"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
|
|
||||||
notifications:
|
notifications:
|
||||||
webhooks: https://galaxy.ansible.com/api/v1/notifications/
|
webhooks: https://galaxy.ansible.com/api/v1/notifications/
|
||||||
|
6
.yamllint
Normal file
6
.yamllint
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
extends: default
|
||||||
|
rules:
|
||||||
|
line-length:
|
||||||
|
max: 120
|
||||||
|
level: warning
|
14
README.md
14
README.md
@ -34,13 +34,17 @@ The default values for the HTTP server deamon are `httpd` (used by Apache) for R
|
|||||||
|
|
||||||
(RedHat/CentOS only) If you have enabled any additional repositories (might I suggest [geerlingguy.repo-epel](https://github.com/geerlingguy/ansible-role-repo-epel) or [geerlingguy.repo-remi](https://github.com/geerlingguy/ansible-role-repo-remi)), those repositories can be listed under this variable (e.g. `remi-php70,epel`). This can be handy, as an example, if you want to install the latest version of PHP 7.0, which is in the Remi repository.
|
(RedHat/CentOS only) If you have enabled any additional repositories (might I suggest [geerlingguy.repo-epel](https://github.com/geerlingguy/ansible-role-repo-epel) or [geerlingguy.repo-remi](https://github.com/geerlingguy/ansible-role-repo-remi)), those repositories can be listed under this variable (e.g. `remi-php70,epel`). This can be handy, as an example, if you want to install the latest version of PHP 7.0, which is in the Remi repository.
|
||||||
|
|
||||||
|
php_default_version_debian: "7.0"
|
||||||
|
|
||||||
|
(Debian/Ubuntu only) The default version of PHP in the given OS version repositories. Defaults to the latest Ubuntu LTS release. Ubuntu 18.04 needs this to be set to `"7.2"` since PHP 7.0 is not available in the default bionic packages.
|
||||||
|
|
||||||
|
**If you'd like to be able to switch PHP versions easily, or use a version that's not available in system packages**: You can use the [`geerlingguy.php-versions`](https://galaxy.ansible.com/geerlingguy/php-versions/) role to more easily switch between major PHP versions (e.g. 5.6, 7.1, 7.2).
|
||||||
|
|
||||||
php_packages_state: "present"
|
php_packages_state: "present"
|
||||||
|
|
||||||
If you have enabled any additional repositories such as [geerlingguy.repo-epel](https://github.com/geerlingguy/ansible-role-repo-epel) or [geerlingguy.repo-remi](https://github.com/geerlingguy/ansible-role-repo-remi), you may want an easy way to swap PHP versions on the fly. By default, this is set to `"present"`. You can override this variable to `"latest"` to upgrade to the latest available version. Combined with php_enablerepo`, a user now doesn't need to manually uninstall the existing PHP packages before installing them from a different repository.
|
If you have enabled any additional repositories such as [geerlingguy.repo-epel](https://github.com/geerlingguy/ansible-role-repo-epel) or [geerlingguy.repo-remi](https://github.com/geerlingguy/ansible-role-repo-remi), you may want an easy way to swap PHP versions on the fly. By default, this is set to `"present"`. You can override this variable to `"latest"` to upgrade to the latest available version. Combined with `php_enablerepo`, a user now doesn't need to manually uninstall the existing PHP packages before installing them from a different repository.
|
||||||
|
|
||||||
You can also use the [`geerlingguy.php-versions`](https://galaxy.ansible.com/geerlingguy/php-versions/) role to more easily switch between major PHP versions (e.g. 5.6, 7.0, 7.1, 7.2).
|
php_install_recommends: true
|
||||||
|
|
||||||
php_install_recommends: yes
|
|
||||||
|
|
||||||
(Debian/Ubuntu only) Whether to install recommended packages when installing `php_packages`; you might want to set this to `no` explicitly if you're installing a PPA that recommends certain packages you don't want (e.g. Ondrej's `php` PPA will install `php7.0-cli` if you install `php-pear` alongside `php5.6-cli`... which is often not desired!).
|
(Debian/Ubuntu only) Whether to install recommended packages when installing `php_packages`; you might want to set this to `no` explicitly if you're installing a PPA that recommends certain packages you don't want (e.g. Ondrej's `php` PPA will install `php7.0-cli` if you install `php-pear` alongside `php5.6-cli`... which is often not desired!).
|
||||||
|
|
||||||
@ -73,6 +77,8 @@ Specific settings inside the default `www.conf` PHP-FPM pool. If you'd like to m
|
|||||||
|
|
||||||
By default, all the extra defaults below are applied through the php.ini included with this role. You can self-manage your php.ini file (if you need more flexility in its configuration) by setting this to `false` (in which case all the below variables will be ignored).
|
By default, all the extra defaults below are applied through the php.ini included with this role. You can self-manage your php.ini file (if you need more flexility in its configuration) by setting this to `false` (in which case all the below variables will be ignored).
|
||||||
|
|
||||||
|
php_fpm_pool_user: "[apache|nginx|other]" # default varies by OS
|
||||||
|
php_fpm_pool_group: "[apache|nginx|other]" # default varies by OS
|
||||||
php_memory_limit: "256M"
|
php_memory_limit: "256M"
|
||||||
php_max_execution_time: "60"
|
php_max_execution_time: "60"
|
||||||
php_max_input_time: "60"
|
php_max_input_time: "60"
|
||||||
|
@ -3,12 +3,15 @@
|
|||||||
# for RHEL/CentOS.
|
# for RHEL/CentOS.
|
||||||
php_enablerepo: ""
|
php_enablerepo: ""
|
||||||
|
|
||||||
|
# Default PHP version to install on Debian-based OSes.
|
||||||
|
php_default_version_debian: "7.0"
|
||||||
|
|
||||||
# PHP package state; use 'present' to make sure it's installed, or 'latest' if
|
# PHP package state; use 'present' to make sure it's installed, or 'latest' if
|
||||||
# you want to upgrade or switch versions using a new repo.
|
# you want to upgrade or switch versions using a new repo.
|
||||||
php_packages_state: present
|
php_packages_state: present
|
||||||
|
|
||||||
# Whether to install recommended packages. Used only for Debian/Ubuntu.
|
# Whether to install recommended packages. Used only for Debian/Ubuntu.
|
||||||
php_install_recommends: yes
|
php_install_recommends: true
|
||||||
|
|
||||||
# Set this to false if you're not using PHP with Apache/Nginx/etc.
|
# Set this to false if you're not using PHP with Apache/Nginx/etc.
|
||||||
php_enable_webserver: true
|
php_enable_webserver: true
|
||||||
|
@ -6,22 +6,24 @@ galaxy_info:
|
|||||||
description: PHP for RedHat/CentOS/Fedora/Debian/Ubuntu.
|
description: PHP for RedHat/CentOS/Fedora/Debian/Ubuntu.
|
||||||
company: "Midwestern Mac, LLC"
|
company: "Midwestern Mac, LLC"
|
||||||
license: "license (BSD, MIT)"
|
license: "license (BSD, MIT)"
|
||||||
min_ansible_version: 2.0
|
min_ansible_version: 2.4
|
||||||
platforms:
|
platforms:
|
||||||
- name: EL
|
- name: EL
|
||||||
versions:
|
versions:
|
||||||
- 6
|
- 6
|
||||||
- 7
|
- 7
|
||||||
- name: Fedora
|
- 8
|
||||||
versions:
|
- name: Fedora
|
||||||
- all
|
versions:
|
||||||
- name: Debian
|
- all
|
||||||
versions:
|
- name: Debian
|
||||||
- all
|
versions:
|
||||||
- name: Ubuntu
|
- all
|
||||||
versions:
|
- name: Ubuntu
|
||||||
- trusty
|
versions:
|
||||||
- xenial
|
- trusty
|
||||||
|
- xenial
|
||||||
|
- bionic
|
||||||
galaxy_tags:
|
galaxy_tags:
|
||||||
- development
|
- development
|
||||||
- web
|
- web
|
||||||
|
@ -1,20 +1,33 @@
|
|||||||
---
|
---
|
||||||
- hosts: all
|
- name: Converge
|
||||||
|
hosts: all
|
||||||
|
become: true
|
||||||
|
|
||||||
vars:
|
vars:
|
||||||
php_enable_webserver: false
|
php_enable_webserver: false
|
||||||
php_enable_php_fpm: true
|
php_enable_php_fpm: true
|
||||||
php_memory_limit: "192M"
|
php_memory_limit: "192M"
|
||||||
php_enablerepo: "remi,remi-php70"
|
php_enablerepo: "remi,remi-php70"
|
||||||
php_install_recommends: no
|
php_install_recommends: false
|
||||||
|
|
||||||
|
handlers:
|
||||||
|
- name: update apt cache
|
||||||
|
apt: update_cache=true
|
||||||
|
when: ansible_os_family == 'Debian'
|
||||||
|
|
||||||
pre_tasks:
|
pre_tasks:
|
||||||
- name: Update apt cache.
|
- name: Update apt cache.
|
||||||
apt: update_cache=yes cache_valid_time=600
|
apt: update_cache=true cache_valid_time=600
|
||||||
when: ansible_os_family == 'Debian'
|
when: ansible_os_family == 'Debian'
|
||||||
changed_when: false
|
changed_when: false
|
||||||
|
|
||||||
# Ubuntu-specific tasks.
|
# Ubuntu-specific tasks.
|
||||||
|
- name: Ensure dirmngr is installed (gnupg dependency).
|
||||||
|
apt:
|
||||||
|
name: dirmngr
|
||||||
|
state: present
|
||||||
|
when: ansible_distribution == 'Ubuntu'
|
||||||
|
|
||||||
- name: Add repository for PHP 7.
|
- name: Add repository for PHP 7.
|
||||||
apt_repository: repo='ppa:ondrej/php'
|
apt_repository: repo='ppa:ondrej/php'
|
||||||
when: ansible_distribution == 'Ubuntu'
|
when: ansible_distribution == 'Ubuntu'
|
||||||
@ -22,10 +35,10 @@
|
|||||||
# Debian-specific tasks.
|
# Debian-specific tasks.
|
||||||
- name: Add dependencies for PHP versions (Debian).
|
- name: Add dependencies for PHP versions (Debian).
|
||||||
apt:
|
apt:
|
||||||
name: "{{ item }}"
|
name:
|
||||||
with_items:
|
- apt-transport-https
|
||||||
- apt-transport-https
|
- ca-certificates
|
||||||
- ca-certificates
|
state: present
|
||||||
when: ansible_distribution == "Debian"
|
when: ansible_distribution == "Debian"
|
||||||
|
|
||||||
- name: Add Ondrej Sury's apt key (Debian).
|
- name: Add Ondrej Sury's apt key (Debian).
|
||||||
@ -38,14 +51,19 @@
|
|||||||
apt_repository:
|
apt_repository:
|
||||||
repo: "deb https://packages.sury.org/php/ {{ ansible_distribution_release }} main"
|
repo: "deb https://packages.sury.org/php/ {{ ansible_distribution_release }} main"
|
||||||
state: present
|
state: present
|
||||||
register: php_ondrej_debian_repo
|
|
||||||
when: ansible_distribution == "Debian"
|
when: ansible_distribution == "Debian"
|
||||||
|
notify: update apt cache
|
||||||
|
|
||||||
- name: Update apt caches after repo is added (Debian).
|
- meta: flush_handlers
|
||||||
apt: update_cache=yes
|
|
||||||
when: php_ondrej_debian_repo.changed and (ansible_distribution == "Debian")
|
|
||||||
|
|
||||||
roles:
|
roles:
|
||||||
- role: geerlingguy.repo-remi
|
- role: geerlingguy.repo-remi
|
||||||
when: ansible_os_family == 'RedHat' and ansible_distribution != 'Fedora'
|
when:
|
||||||
- role_under_test
|
- ansible_os_family == 'RedHat'
|
||||||
|
- ansible_distribution != 'Fedora'
|
||||||
|
- role: geerlingguy.php
|
||||||
|
|
||||||
|
post_tasks:
|
||||||
|
- name: Confirm PHP configuration is correct.
|
||||||
|
shell: php -i | grep 'memory_limit.*192'
|
||||||
|
changed_when: false
|
21
molecule/default/molecule.yml
Normal file
21
molecule/default/molecule.yml
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
---
|
||||||
|
dependency:
|
||||||
|
name: galaxy
|
||||||
|
driver:
|
||||||
|
name: docker
|
||||||
|
lint: |
|
||||||
|
set -e
|
||||||
|
yamllint .
|
||||||
|
ansible-lint
|
||||||
|
platforms:
|
||||||
|
- name: instance
|
||||||
|
image: "geerlingguy/docker-${MOLECULE_DISTRO:-centos7}-ansible:latest"
|
||||||
|
command: ${MOLECULE_DOCKER_COMMAND:-""}
|
||||||
|
volumes:
|
||||||
|
- /sys/fs/cgroup:/sys/fs/cgroup:ro
|
||||||
|
privileged: true
|
||||||
|
pre_build_image: true
|
||||||
|
provisioner:
|
||||||
|
name: ansible
|
||||||
|
playbooks:
|
||||||
|
converge: ${MOLECULE_PLAYBOOK:-converge.yml}
|
32
molecule/default/playbook-source.yml
Normal file
32
molecule/default/playbook-source.yml
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
---
|
||||||
|
- name: Converge
|
||||||
|
hosts: all
|
||||||
|
become: true
|
||||||
|
|
||||||
|
vars:
|
||||||
|
php_enable_webserver: false
|
||||||
|
php_install_from_source: true
|
||||||
|
php_source_clone_dir: /root/php-src
|
||||||
|
php_source_make_command: "make --jobs=2"
|
||||||
|
php_version: "7.1.17"
|
||||||
|
php_source_version: "php-{{ php_version }}"
|
||||||
|
php_memory_limit: "192M"
|
||||||
|
|
||||||
|
pre_tasks:
|
||||||
|
- name: Update apt cache.
|
||||||
|
apt: update_cache=true cache_valid_time=600
|
||||||
|
when: ansible_os_family == 'Debian'
|
||||||
|
changed_when: false
|
||||||
|
|
||||||
|
roles:
|
||||||
|
- role: geerlingguy.git
|
||||||
|
- role: geerlingguy.php
|
||||||
|
|
||||||
|
post_tasks:
|
||||||
|
- name: Confirm PHP configuration is correct.
|
||||||
|
shell: php -i | grep 'memory_limit.*192'
|
||||||
|
changed_when: false
|
||||||
|
|
||||||
|
- name: Check the installed PHP version.
|
||||||
|
shell: '/usr/bin/php --version | grep -qF "PHP {{ php_version }}"'
|
||||||
|
changed_when: false
|
@ -22,7 +22,7 @@
|
|||||||
dest: "{{ item }}/{{ php_apc_conf_filename }}"
|
dest: "{{ item }}/{{ php_apc_conf_filename }}"
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
force: yes
|
force: true
|
||||||
mode: 0644
|
mode: 0644
|
||||||
with_items: "{{ php_extension_conf_paths }}"
|
with_items: "{{ php_extension_conf_paths }}"
|
||||||
when: php_enable_apc
|
when: php_enable_apc
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
mode: 0644
|
mode: 0644
|
||||||
force: no
|
force: false
|
||||||
when: php_enable_php_fpm
|
when: php_enable_php_fpm
|
||||||
|
|
||||||
- name: Configure php-fpm pool (if enabled).
|
- name: Configure php-fpm pool (if enabled).
|
||||||
@ -73,7 +73,7 @@
|
|||||||
service:
|
service:
|
||||||
name: "{{ php_fpm_daemon }}"
|
name: "{{ php_fpm_daemon }}"
|
||||||
state: started
|
state: started
|
||||||
enabled: yes
|
enabled: true
|
||||||
when: php_enable_php_fpm and ansible_distribution != "Debian"
|
when: php_enable_php_fpm and ansible_distribution != "Debian"
|
||||||
|
|
||||||
# See: https://github.com/ansible/ansible/issues/22303
|
# See: https://github.com/ansible/ansible/issues/22303
|
||||||
@ -81,6 +81,6 @@
|
|||||||
service:
|
service:
|
||||||
name: "{{ php_fpm_daemon }}"
|
name: "{{ php_fpm_daemon }}"
|
||||||
state: started
|
state: started
|
||||||
enabled: yes
|
enabled: true
|
||||||
use: service
|
use: service
|
||||||
when: php_enable_php_fpm and ansible_distribution == "Debian"
|
when: php_enable_php_fpm and ansible_distribution == "Debian"
|
||||||
|
@ -22,10 +22,10 @@
|
|||||||
dest: "{{ item }}/{{ php_opcache_conf_filename }}"
|
dest: "{{ item }}/{{ php_opcache_conf_filename }}"
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
force: yes
|
force: true
|
||||||
mode: 0644
|
mode: 0644
|
||||||
with_items: "{{ php_extension_conf_paths }}"
|
with_items: "{{ php_extension_conf_paths }}"
|
||||||
when: php_opcache_enable
|
when: php_opcache_enable | bool
|
||||||
notify: restart webserver
|
notify: restart webserver
|
||||||
|
|
||||||
- name: Remove OpCache config file if OpCache is disabled.
|
- name: Remove OpCache config file if OpCache is disabled.
|
||||||
@ -33,5 +33,5 @@
|
|||||||
path: "{{ item }}/{{ php_opcache_conf_filename }}"
|
path: "{{ item }}/{{ php_opcache_conf_filename }}"
|
||||||
state: absent
|
state: absent
|
||||||
with_items: "{{ php_extension_conf_paths }}"
|
with_items: "{{ php_extension_conf_paths }}"
|
||||||
when: not php_opcache_enable
|
when: not php_opcache_enable | bool
|
||||||
notify: restart webserver
|
notify: restart webserver
|
||||||
|
@ -1,28 +1,29 @@
|
|||||||
---
|
---
|
||||||
- name: Ensure dependencies for building from source are installed (RedHat).
|
- name: Ensure dependencies for building from source are installed (RedHat).
|
||||||
package: "name={{ item }} state=present"
|
package:
|
||||||
with_items:
|
name:
|
||||||
- autoconf
|
- autoconf
|
||||||
- automake
|
- automake
|
||||||
- libtool
|
- libtool
|
||||||
- bison
|
- bison
|
||||||
- make
|
- make
|
||||||
- curl-devel
|
- curl-devel
|
||||||
- recode-devel
|
- recode-devel
|
||||||
- aspell-devel
|
- aspell-devel
|
||||||
- libxml2-devel
|
- libxml2-devel
|
||||||
- pkgconfig
|
- pkgconfig
|
||||||
- libmcrypt-devel
|
- libmcrypt-devel
|
||||||
- t1lib-devel
|
- t1lib-devel
|
||||||
- libXpm-devel
|
- libXpm-devel
|
||||||
- libpng-devel
|
- libpng-devel
|
||||||
- libjpeg-turbo-devel
|
- libjpeg-turbo-devel
|
||||||
- bzip2-devel
|
- bzip2-devel
|
||||||
- openssl-devel
|
- openssl-devel
|
||||||
- freetype-devel
|
- freetype-devel
|
||||||
- libicu-devel
|
- libicu-devel
|
||||||
- mariadb-devel
|
- mariadb-devel
|
||||||
- gmp-devel
|
- gmp-devel
|
||||||
|
state: present
|
||||||
when: ansible_os_family == 'RedHat'
|
when: ansible_os_family == 'RedHat'
|
||||||
|
|
||||||
- name: Update apt cache (Debian).
|
- name: Update apt cache (Debian).
|
||||||
@ -30,28 +31,29 @@
|
|||||||
when: ansible_os_family == 'Debian'
|
when: ansible_os_family == 'Debian'
|
||||||
|
|
||||||
- name: Ensure dependencies for building from source are installed (Debian).
|
- name: Ensure dependencies for building from source are installed (Debian).
|
||||||
apt: "pkg={{ item }} state=present"
|
apt:
|
||||||
with_items:
|
name:
|
||||||
- build-essential
|
- build-essential
|
||||||
- autoconf
|
- autoconf
|
||||||
- automake
|
- automake
|
||||||
- libtool
|
- libtool
|
||||||
- bison
|
- bison
|
||||||
- pkg-config
|
- pkg-config
|
||||||
- re2c
|
- re2c
|
||||||
- libxml2-dev
|
- libxml2-dev
|
||||||
- libcurl4-openssl-dev
|
- libcurl4-openssl-dev
|
||||||
- libbz2-dev
|
- libbz2-dev
|
||||||
- libjpeg-dev
|
- libjpeg-dev
|
||||||
- libpng12-dev
|
- libpng-dev
|
||||||
- libxpm-dev
|
- libxpm-dev
|
||||||
- libfreetype6-dev
|
- libfreetype6-dev
|
||||||
- libgmp3-dev
|
- libgmp3-dev
|
||||||
- libmcrypt-dev
|
- libmcrypt-dev
|
||||||
- libmysqlclient-dev
|
- libmysqlclient-dev
|
||||||
- libpspell-dev
|
- libpspell-dev
|
||||||
- librecode-dev
|
- librecode-dev
|
||||||
- libssl-dev
|
- libssl-dev
|
||||||
|
state: present
|
||||||
when: ansible_os_family == 'Debian'
|
when: ansible_os_family == 'Debian'
|
||||||
|
|
||||||
- name: Define php_fpm_daemon (if not defined already).
|
- name: Define php_fpm_daemon (if not defined already).
|
||||||
@ -68,7 +70,7 @@
|
|||||||
src: "{{ php_source_install_gmp_path }}"
|
src: "{{ php_source_install_gmp_path }}"
|
||||||
dest: /usr/include/gmp.h
|
dest: /usr/include/gmp.h
|
||||||
state: link
|
state: link
|
||||||
when: gmp_file.stat.exists == false
|
when: not gmp_file.stat.exists
|
||||||
|
|
||||||
- name: Check if PHP is installed.
|
- name: Check if PHP is installed.
|
||||||
command: which php
|
command: which php
|
||||||
@ -81,7 +83,7 @@
|
|||||||
repo: "{{ php_source_repo }}"
|
repo: "{{ php_source_repo }}"
|
||||||
dest: "{{ php_source_clone_dir }}"
|
dest: "{{ php_source_clone_dir }}"
|
||||||
version: "{{ php_source_version }}"
|
version: "{{ php_source_version }}"
|
||||||
accept_hostkey: yes
|
accept_hostkey: true
|
||||||
depth: "{{ php_source_clone_depth }}"
|
depth: "{{ php_source_clone_depth }}"
|
||||||
when: php_installed.rc != 0
|
when: php_installed.rc != 0
|
||||||
|
|
||||||
@ -93,19 +95,19 @@
|
|||||||
when: php_installed.rc != 0
|
when: php_installed.rc != 0
|
||||||
|
|
||||||
- name: Build configure script.
|
- name: Build configure script.
|
||||||
shell: >
|
command: >
|
||||||
./buildconf --force
|
./buildconf --force
|
||||||
chdir={{ php_source_clone_dir }}
|
chdir={{ php_source_clone_dir }}
|
||||||
when: php_installed.rc != 0
|
when: php_installed.rc != 0
|
||||||
|
|
||||||
- name: Run configure script.
|
- name: Run configure script.
|
||||||
shell: >
|
command: >
|
||||||
{{ php_source_configure_command }}
|
{{ php_source_configure_command }}
|
||||||
chdir={{ php_source_clone_dir }}
|
chdir={{ php_source_clone_dir }}
|
||||||
when: php_installed.rc != 0
|
when: php_installed.rc != 0
|
||||||
|
|
||||||
- name: Make and install PHP.
|
- name: Make and install PHP.
|
||||||
shell: >
|
command: >
|
||||||
{{ item }}
|
{{ item }}
|
||||||
chdir={{ php_source_clone_dir }}
|
chdir={{ php_source_clone_dir }}
|
||||||
with_items:
|
with_items:
|
||||||
|
@ -49,25 +49,22 @@
|
|||||||
when: php_fpm_conf_path is not defined
|
when: php_fpm_conf_path is not defined
|
||||||
|
|
||||||
# Setup/install tasks.
|
# Setup/install tasks.
|
||||||
- include: setup-RedHat.yml
|
- include_tasks: setup-RedHat.yml
|
||||||
when: (php_install_from_source == false) and (ansible_os_family == 'RedHat')
|
when:
|
||||||
static: no
|
- not php_install_from_source
|
||||||
|
- ansible_os_family == 'RedHat'
|
||||||
|
|
||||||
- include: setup-Debian.yml
|
- include_tasks: setup-Debian.yml
|
||||||
when: (php_install_from_source == false) and (ansible_os_family == 'Debian')
|
when:
|
||||||
static: no
|
- not php_install_from_source
|
||||||
|
- ansible_os_family == 'Debian'
|
||||||
|
|
||||||
# Install PHP from source when php_install_from_source is true.
|
# Install PHP from source when php_install_from_source is true.
|
||||||
- include: install-from-source.yml
|
- include_tasks: install-from-source.yml
|
||||||
when: php_install_from_source == true
|
when: php_install_from_source
|
||||||
static: no
|
|
||||||
|
|
||||||
# Configure PHP.
|
# Configure PHP.
|
||||||
- include: configure.yml
|
- include_tasks: configure.yml
|
||||||
static: no
|
- include_tasks: configure-apcu.yml
|
||||||
- include: configure-apcu.yml
|
- include_tasks: configure-opcache.yml
|
||||||
static: no
|
- include_tasks: configure-fpm.yml
|
||||||
- include: configure-opcache.yml
|
|
||||||
static: no
|
|
||||||
- include: configure-fpm.yml
|
|
||||||
static: no
|
|
||||||
|
@ -4,10 +4,9 @@
|
|||||||
|
|
||||||
- name: Ensure PHP packages are installed.
|
- name: Ensure PHP packages are installed.
|
||||||
apt:
|
apt:
|
||||||
name: "{{ item }}"
|
name: "{{ php_packages }}"
|
||||||
state: "{{ php_packages_state }}"
|
state: "{{ php_packages_state }}"
|
||||||
install_recommends: "{{ php_install_recommends }}"
|
install_recommends: "{{ php_install_recommends }}"
|
||||||
with_items: "{{ php_packages }}"
|
|
||||||
register: php_package_install
|
register: php_package_install
|
||||||
notify: restart webserver
|
notify: restart webserver
|
||||||
|
|
||||||
@ -24,5 +23,5 @@
|
|||||||
path: "{{ item }}/{{ php_opcache_conf_filename }}"
|
path: "{{ item }}/{{ php_opcache_conf_filename }}"
|
||||||
state: absent
|
state: absent
|
||||||
with_items: "{{ php_extension_conf_paths }}"
|
with_items: "{{ php_extension_conf_paths }}"
|
||||||
when: php_opcache_enable and php_package_install.changed
|
when: php_opcache_enable | bool and php_package_install.changed
|
||||||
notify: restart webserver
|
notify: restart webserver
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
---
|
---
|
||||||
- name: Ensure PHP packages are installed.
|
- name: Ensure PHP packages are installed.
|
||||||
package:
|
package:
|
||||||
name: "{{ item }}"
|
name: "{{ php_packages }}"
|
||||||
state: "{{ php_packages_state }}"
|
state: "{{ php_packages_state }}"
|
||||||
enablerepo: "{{ php_enablerepo }}"
|
enablerepo: "{{ php_enablerepo | default(omit, true) }}"
|
||||||
with_items: "{{ php_packages }}"
|
|
||||||
notify: restart webserver
|
notify: restart webserver
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
|
|
||||||
engine = On
|
engine = On
|
||||||
short_open_tag = {{ php_short_open_tag }}
|
short_open_tag = {{ php_short_open_tag }}
|
||||||
asp_tags = Off
|
|
||||||
precision = {{ php_precision }}
|
precision = {{ php_precision }}
|
||||||
output_buffering = {{ php_output_buffering }}
|
output_buffering = {{ php_output_buffering }}
|
||||||
|
|
||||||
@ -64,7 +63,6 @@ auto_prepend_file =
|
|||||||
auto_append_file =
|
auto_append_file =
|
||||||
|
|
||||||
default_mimetype = "text/html"
|
default_mimetype = "text/html"
|
||||||
always_populate_raw_post_data = -1
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
; Paths and Directories ;
|
; Paths and Directories ;
|
||||||
@ -189,8 +187,6 @@ session.gc_probability = {{ php_session_gc_probability }}
|
|||||||
session.gc_divisor = {{ php_session_gc_divisor }}
|
session.gc_divisor = {{ php_session_gc_divisor }}
|
||||||
session.gc_maxlifetime = {{ php_session_gc_maxlifetime }}
|
session.gc_maxlifetime = {{ php_session_gc_maxlifetime }}
|
||||||
|
|
||||||
session.bug_compat_42 = Off
|
|
||||||
session.bug_compat_warn = Off
|
|
||||||
session.referer_check =
|
session.referer_check =
|
||||||
|
|
||||||
session.cache_limiter = nocache
|
session.cache_limiter = nocache
|
||||||
|
@ -1,11 +0,0 @@
|
|||||||
# Ansible Role tests
|
|
||||||
|
|
||||||
To run the test playbook(s) in this directory:
|
|
||||||
|
|
||||||
1. Install and start Docker.
|
|
||||||
1. Download the test shim (see .travis.yml file for the URL) into `tests/test.sh`:
|
|
||||||
- `wget -O tests/test.sh https://gist.githubusercontent.com/geerlingguy/73ef1e5ee45d8694570f334be385e181/raw/`
|
|
||||||
1. Make the test shim executable: `chmod +x tests/test.sh`.
|
|
||||||
1. Run (from the role root directory) `distro=[distro] playbook=[playbook] ./tests/test.sh`
|
|
||||||
|
|
||||||
If you don't want the container to be automatically deleted after the test playbook is run, add the following environment variables: `cleanup=false container_id=$(date +%s)`
|
|
@ -1,20 +0,0 @@
|
|||||||
---
|
|
||||||
- hosts: all
|
|
||||||
|
|
||||||
vars:
|
|
||||||
php_enable_webserver: false
|
|
||||||
php_install_from_source: true
|
|
||||||
php_source_clone_dir: /root/php-src
|
|
||||||
php_source_make_command: "make --jobs=2"
|
|
||||||
php_source_version: "php-7.1.9"
|
|
||||||
php_memory_limit: "192M"
|
|
||||||
|
|
||||||
pre_tasks:
|
|
||||||
- name: Update apt cache.
|
|
||||||
apt: update_cache=yes cache_valid_time=600
|
|
||||||
when: ansible_os_family == 'Debian'
|
|
||||||
changed_when: false
|
|
||||||
|
|
||||||
roles:
|
|
||||||
- geerlingguy.git
|
|
||||||
- role_under_test
|
|
@ -1,36 +1,36 @@
|
|||||||
---
|
---
|
||||||
__php_packages:
|
__php_packages:
|
||||||
- php7.0-common
|
- php{{ php_default_version_debian }}-common
|
||||||
- php7.0-cli
|
- php{{ php_default_version_debian }}-cli
|
||||||
- php7.0-dev
|
- php{{ php_default_version_debian }}-dev
|
||||||
- php7.0-fpm
|
- php{{ php_default_version_debian }}-fpm
|
||||||
- libpcre3-dev
|
- libpcre3-dev
|
||||||
- php7.0-gd
|
- php{{ php_default_version_debian }}-gd
|
||||||
- php7.0-curl
|
- php{{ php_default_version_debian }}-curl
|
||||||
- php7.0-imap
|
- php{{ php_default_version_debian }}-imap
|
||||||
- php7.0-json
|
- php{{ php_default_version_debian }}-json
|
||||||
- php7.0-opcache
|
- php{{ php_default_version_debian }}-opcache
|
||||||
- php7.0-xml
|
- php{{ php_default_version_debian }}-xml
|
||||||
- php7.0-mbstring
|
- php{{ php_default_version_debian }}-mbstring
|
||||||
- php-sqlite3
|
- php-sqlite3
|
||||||
- php-apcu
|
- php-apcu
|
||||||
__php_webserver_daemon: "apache2"
|
__php_webserver_daemon: "apache2"
|
||||||
|
|
||||||
# Vendor-specific configuration paths on Debian/Ubuntu make my brain asplode.
|
# Vendor-specific configuration paths on Debian/Ubuntu make my brain asplode.
|
||||||
__php_conf_paths:
|
__php_conf_paths:
|
||||||
- /etc/php/7.0/fpm
|
- /etc/php/{{ php_default_version_debian }}/fpm
|
||||||
- /etc/php/7.0/apache2
|
- /etc/php/{{ php_default_version_debian }}/apache2
|
||||||
- /etc/php/7.0/cli
|
- /etc/php/{{ php_default_version_debian }}/cli
|
||||||
|
|
||||||
__php_extension_conf_paths:
|
__php_extension_conf_paths:
|
||||||
- /etc/php/7.0/fpm/conf.d
|
- /etc/php/{{ php_default_version_debian }}/fpm/conf.d
|
||||||
- /etc/php/7.0/apache2/conf.d
|
- /etc/php/{{ php_default_version_debian }}/apache2/conf.d
|
||||||
- /etc/php/7.0/cli/conf.d
|
- /etc/php/{{ php_default_version_debian }}/cli/conf.d
|
||||||
|
|
||||||
__php_apc_conf_filename: 20-apcu.ini
|
__php_apc_conf_filename: 20-apcu.ini
|
||||||
__php_opcache_conf_filename: 10-opcache.ini
|
__php_opcache_conf_filename: 10-opcache.ini
|
||||||
__php_fpm_daemon: php7.0-fpm
|
__php_fpm_daemon: php{{ php_default_version_debian }}-fpm
|
||||||
__php_fpm_conf_path: "/etc/php/7.0/fpm"
|
__php_fpm_conf_path: "/etc/php/{{ php_default_version_debian }}/fpm"
|
||||||
__php_fpm_pool_conf_path: "{{ __php_fpm_conf_path }}/pool.d/www.conf"
|
__php_fpm_pool_conf_path: "{{ __php_fpm_conf_path }}/pool.d/www.conf"
|
||||||
|
|
||||||
__php_fpm_pool_user: www-data
|
__php_fpm_pool_user: www-data
|
||||||
|
@ -6,7 +6,6 @@ __php_packages:
|
|||||||
- php-devel
|
- php-devel
|
||||||
- php-fpm
|
- php-fpm
|
||||||
- php-gd
|
- php-gd
|
||||||
- php-imap
|
|
||||||
- php-ldap
|
- php-ldap
|
||||||
- php-mbstring
|
- php-mbstring
|
||||||
- php-opcache
|
- php-opcache
|
||||||
|
Loading…
Reference in New Issue
Block a user