Fix lint errors due to ansible-lint latest versions
parent
4aef107c1a
commit
85cab7d166
|
@ -1,7 +1,7 @@
|
||||||
Ansible PHP (+FPM) role for Debian / Ubuntu / FreeBSD
|
Ansible PHP (+FPM) role for Debian / Ubuntu / FreeBSD
|
||||||
=====================================================
|
=====================================================
|
||||||
|
|
||||||
[![Ansible Galaxy](http://img.shields.io/badge/ansible--galaxy-HanXHX.php-blue.svg)](https://galaxy.ansible.com/HanXHX/php) [![Build Status](https://app.travis-ci.com/HanXHX/ansible-php.svg?branch=master)](https://app.travis-ci.com/HanXHX/ansible-php)
|
[![Ansible Galaxy](http://img.shields.io/badge/ansible--galaxy-hanxhx.php-blue.svg)](https://galaxy.ansible.com/hanxhx.php) [![Build Status](https://app.travis-ci.com/HanXHX/ansible-php.svg?branch=master)](https://app.travis-ci.com/HanXHX/ansible-php)
|
||||||
|
|
||||||
Install PHP on Debian / Ubuntu / FreeBSD. Manage PHP-FPM, APCu, Opcache and Xdebug.
|
Install PHP on Debian / Ubuntu / FreeBSD. Manage PHP-FPM, APCu, Opcache and Xdebug.
|
||||||
|
|
||||||
|
@ -161,14 +161,14 @@ Example Playbook
|
||||||
|
|
||||||
- hosts: servers
|
- hosts: servers
|
||||||
roles:
|
roles:
|
||||||
- { role: HanXHX.php }
|
- { role: hanxhx.php }
|
||||||
|
|
||||||
### Debian Bullseye with PHP 8.0 CLI (no FPM)
|
### Debian Bullseye with PHP 8.0 CLI (no FPM)
|
||||||
|
|
||||||
- hosts: servers
|
- hosts: servers
|
||||||
roles:
|
roles:
|
||||||
- { role: HanXHX.sury }
|
- { role: HanXHX.sury }
|
||||||
- { role: HanXHX.php, php_version: '8.0', php_install_fpm: false }
|
- { role: hanxhx.php, php_version: '8.0', php_install_fpm: false }
|
||||||
|
|
||||||
License
|
License
|
||||||
-------
|
-------
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
---
|
---
|
||||||
galaxy_info:
|
galaxy_info:
|
||||||
author: Emilien Mantel
|
author: Emilien Mantel
|
||||||
description: Install and configure PHP 7.0/7.1/7.2/7.3/7.4/8.0
|
role_name: php
|
||||||
|
namespace: hanxhx
|
||||||
|
description: Install and configure PHP 7.x/8.x
|
||||||
company:
|
company:
|
||||||
license: GPLv2
|
license: GPLv2
|
||||||
min_ansible_version: 2.11
|
min_ansible_version: 2.11
|
||||||
|
|
|
@ -60,6 +60,8 @@
|
||||||
group: root
|
group: root
|
||||||
mode: 0644
|
mode: 0644
|
||||||
register: f
|
register: f
|
||||||
|
tags:
|
||||||
|
- skip_ansible_lint
|
||||||
|
|
||||||
- name: SETUP | Gathers new facts
|
- name: SETUP | Gathers new facts
|
||||||
ansible.builtin.setup:
|
ansible.builtin.setup:
|
||||||
|
@ -107,7 +109,9 @@
|
||||||
state: started
|
state: started
|
||||||
when: php_install_fpm and ansible_virtualization_type != 'docker'
|
when: php_install_fpm and ansible_virtualization_type != 'docker'
|
||||||
|
|
||||||
- block:
|
- name: BLOCK | Ensure PHP-FPM is started if running on Docker
|
||||||
|
when: php_install_fpm and ansible_virtualization_type == 'docker'
|
||||||
|
block:
|
||||||
|
|
||||||
- name: COMMAND | Check if PHP-FPM is started (Docker)
|
- name: COMMAND | Check if PHP-FPM is started (Docker)
|
||||||
ansible.builtin.command: 'service {{ php_fpm_service }} status'
|
ansible.builtin.command: 'service {{ php_fpm_service }} status'
|
||||||
|
@ -122,5 +126,3 @@
|
||||||
args:
|
args:
|
||||||
warn: false
|
warn: false
|
||||||
when: dps.stdout.find('is not running') != -1
|
when: dps.stdout.find('is not running') != -1
|
||||||
|
|
||||||
when: php_install_fpm and ansible_virtualization_type == 'docker'
|
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
---
|
---
|
||||||
|
|
||||||
- block:
|
- name: Install opcache/apcu on Debian
|
||||||
|
when: ansible_os_family == 'Debian'
|
||||||
|
block:
|
||||||
|
|
||||||
- name: APT | Install APCu
|
- name: APT | Install APCu
|
||||||
ansible.builtin.apt:
|
ansible.builtin.apt:
|
||||||
|
@ -12,9 +14,10 @@
|
||||||
pkg: "{{ php_package_prefix }}opcache"
|
pkg: "{{ php_package_prefix }}opcache"
|
||||||
install_recommends: false
|
install_recommends: false
|
||||||
|
|
||||||
when: ansible_os_family == 'Debian'
|
|
||||||
|
|
||||||
- block:
|
- name: Install opcache/apcu on FreeBSD
|
||||||
|
when: ansible_os_family == 'FreeBSD'
|
||||||
|
block:
|
||||||
|
|
||||||
- name: PKGNG | Install APCu
|
- name: PKGNG | Install APCu
|
||||||
community.general.pkgng:
|
community.general.pkgng:
|
||||||
|
@ -24,8 +27,6 @@
|
||||||
community.general.pkgng:
|
community.general.pkgng:
|
||||||
name: "{{ php_package_prefix }}opcache"
|
name: "{{ php_package_prefix }}opcache"
|
||||||
|
|
||||||
when: ansible_os_family == 'FreeBSD'
|
|
||||||
|
|
||||||
- name: TEMPLATE | Configure Opcache
|
- name: TEMPLATE | Configure Opcache
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: "etc/__php__/mods-available/opcache.ini.j2"
|
src: "etc/__php__/mods-available/opcache.ini.j2"
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
---
|
---
|
||||||
|
|
||||||
- block:
|
- name: BLOCK | Uninstall xdebug
|
||||||
|
when: php_install_xdebug
|
||||||
|
block:
|
||||||
|
|
||||||
- name: APT | Install xdebug
|
- name: APT | Install xdebug
|
||||||
ansible.builtin.apt:
|
ansible.builtin.apt:
|
||||||
|
@ -24,9 +26,10 @@
|
||||||
mode: 0644
|
mode: 0644
|
||||||
notify: restart php-fpm
|
notify: restart php-fpm
|
||||||
|
|
||||||
when: php_install_xdebug
|
|
||||||
|
|
||||||
- block:
|
- name: BLOCK | Uninstall xdebug
|
||||||
|
when: not php_install_xdebug
|
||||||
|
block:
|
||||||
|
|
||||||
- name: APT | Uninstall xdebug
|
- name: APT | Uninstall xdebug
|
||||||
ansible.builtin.apt:
|
ansible.builtin.apt:
|
||||||
|
@ -39,5 +42,3 @@
|
||||||
name: "{{ php_xdebug_package }}"
|
name: "{{ php_xdebug_package }}"
|
||||||
state: absent
|
state: absent
|
||||||
when: ansible_os_family == 'FreeBSD'
|
when: ansible_os_family == 'FreeBSD'
|
||||||
|
|
||||||
when: not php_install_xdebug
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
---
|
---
|
||||||
|
|
||||||
- hosts: all
|
- hosts: all
|
||||||
|
name: Test all
|
||||||
vars:
|
vars:
|
||||||
vhost: 'test.local'
|
vhost: 'test.local'
|
||||||
php_extra_packages:
|
php_extra_packages:
|
||||||
|
@ -71,7 +72,9 @@
|
||||||
state: started
|
state: started
|
||||||
when: ansible_virtualization_type != 'docker'
|
when: ansible_virtualization_type != 'docker'
|
||||||
|
|
||||||
- block:
|
- name: Start nginx if testing with Docker
|
||||||
|
when: ansible_virtualization_type == 'docker'
|
||||||
|
block:
|
||||||
|
|
||||||
- name: COMMAND | Docker nginx status
|
- name: COMMAND | Docker nginx status
|
||||||
ansible.builtin.command: service nginx status
|
ansible.builtin.command: service nginx status
|
||||||
|
@ -87,17 +90,15 @@
|
||||||
warn: false
|
warn: false
|
||||||
when: ngs.stdout.find('nginx is not running') != -1
|
when: ngs.stdout.find('nginx is not running') != -1
|
||||||
|
|
||||||
when: ansible_virtualization_type == 'docker'
|
|
||||||
|
|
||||||
handlers:
|
handlers:
|
||||||
|
|
||||||
- name: reload nginx
|
- name: Reload nginx
|
||||||
ansible.builtin.service:
|
ansible.builtin.service:
|
||||||
name: nginx
|
name: nginx
|
||||||
state: reloaded
|
state: reloaded
|
||||||
notify: docker reload nginx
|
notify: docker reload nginx
|
||||||
|
|
||||||
- name: docker reload nginx
|
- name: Docker reload nginx
|
||||||
ansible.builtin.command: service nginx reload
|
ansible.builtin.command: service nginx reload
|
||||||
args:
|
args:
|
||||||
warn: false
|
warn: false
|
||||||
|
@ -168,7 +169,9 @@
|
||||||
url: "http://localhost{{ php_fpm_poold.0.status_path }}"
|
url: "http://localhost{{ php_fpm_poold.0.status_path }}"
|
||||||
when: php_fpm_poold.0.status_path is defined
|
when: php_fpm_poold.0.status_path is defined
|
||||||
|
|
||||||
- block:
|
- name: Debian extra checks
|
||||||
|
when: ansible_os_family == 'Debian'
|
||||||
|
block:
|
||||||
|
|
||||||
- name: SHELL | Check if we installed multiple PHP versions
|
- name: SHELL | Check if we installed multiple PHP versions
|
||||||
ansible.builtin.shell: set -o pipefail && (dpkg -l | grep 'php[[:digit:]].*common' | wc -l)
|
ansible.builtin.shell: set -o pipefail && (dpkg -l | grep 'php[[:digit:]].*common' | wc -l)
|
||||||
|
@ -183,5 +186,3 @@
|
||||||
ansible.builtin.fail:
|
ansible.builtin.fail:
|
||||||
msg: "Multiple PHP versions detected"
|
msg: "Multiple PHP versions detected"
|
||||||
when: check_multiple_php.stdout != '1'
|
when: check_multiple_php.stdout != '1'
|
||||||
|
|
||||||
when: ansible_os_family == 'Debian'
|
|
||||||
|
|
Loading…
Reference in New Issue