Fix lint errors

new_release
Emilien Mantel 2021-08-31 10:51:29 +02:00
parent 99f4da524b
commit 387b03ddbf
7 changed files with 102 additions and 79 deletions

8
.ansible-lint 100644
View File

@ -0,0 +1,8 @@
---
# TODO: enable later
# enable_list:
# - fqcn-builtins
skip_list:
- role-name

View File

@ -1,7 +1,7 @@
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://travis-ci.org/HanXHX/ansible-php.svg?branch=master)](https://travis-ci.org/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.

View File

@ -6,28 +6,28 @@ galaxy_info:
license: GPLv2
min_ansible_version: 2.11
platforms:
- name: Debian
versions:
- stretch
- buster
- bullseye
- name: Ubuntu
versions:
- xenial
- bionic
- name: FreeBSD
versions:
- 11.0
- 11.1
- 12.0
- name: Debian
versions:
- stretch
- buster
- bullseye
- name: Ubuntu
versions:
- xenial
- bionic
- name: FreeBSD
versions:
- 11.0
- 11.1
- 12.0
galaxy_tags:
- development
- web
- php
- php-fpm
- php7
- debian
- ubuntu
- freebsd
- development
- web
- php
- fpm
- php7
- php8
- debian
- ubuntu
- freebsd
dependencies: []

View File

@ -17,7 +17,10 @@
dest: '{{ php_fpm_ini }}'
regexp: '^;?{{ item.key }}'
line: '{{ item.key }} = {{ item.value }}'
create: yes
create: true
owner: root
group: root
mode: 0644
loop: "{{ php_ini | combine(php_ini_fpm) | dict2items }}"
notify: restart php-fpm
@ -25,6 +28,9 @@
template:
src: etc/__php__/fpm/pool.d/pool.conf.j2
dest: '{{ php_fpm_pool_dir }}/{{ item.name }}.conf'
owner: root
group: root
mode: 0644
loop: "{{ ansible_local.hanxhx_php.fpm_pool }}"
notify: restart php-fpm

View File

@ -39,12 +39,15 @@
file:
path: /etc/ansible/facts.d
state: directory
recurse: yes
recurse: true
- name: COPY | Manage facts
copy:
content: "{ \"fpm_pool\": {{ php_fpm_full_pool | to_nice_json }} }"
dest: /etc/ansible/facts.d/hanxhx_php.fact
owner: root
group: root
mode: 0644
register: f
- name: SETUP | Gathers new facts
@ -57,7 +60,7 @@
apt:
pkg: "{{ pkgs }}"
state: present
update_cache: yes
update_cache: true
cache_valid_time: 3600
vars:
pkgs: "{{ php_packages + php_extra_packages | flatten }}"
@ -94,18 +97,18 @@
- block:
- name: COMMAND | Check if PHP-FPM is started (Docker)
command: 'service {{ php_fpm_service }} status'
args:
warn: false
register: dps
changed_when: false
failed_when: false
- name: COMMAND | Check if PHP-FPM is started (Docker)
command: 'service {{ php_fpm_service }} status'
args:
warn: false
register: dps
changed_when: false
failed_when: false
- name: COMMAND | Ensure PHP-FPM is started (Docker)
command: 'service {{ php_fpm_service }} start'
args:
warn: false
when: dps.stdout.find('is not running') != -1
- name: COMMAND | Ensure PHP-FPM is started (Docker)
command: 'service {{ php_fpm_service }} start'
args:
warn: false
when: dps.stdout.find('is not running') != -1
when: php_install_fpm and ansible_virtualization_type == 'docker'

View File

@ -2,25 +2,25 @@
- block:
- name: APT | Install APCu
apt:
pkg: "php-apcu"
- name: APT | Install APCu
apt:
pkg: "php-apcu"
- name: APT | Install Opcache
apt:
pkg: "{{ php_package_prefix }}opcache"
- name: APT | Install Opcache
apt:
pkg: "{{ php_package_prefix }}opcache"
when: ansible_os_family == 'Debian'
- block:
- name: PKGNG | Install APCu
pkgng:
name: "php{{ php_version | replace('.', '') }}-pecl-APCu"
- name: PKGNG | Install APCu
pkgng:
name: "php{{ php_version | replace('.', '') }}-pecl-APCu"
- name: PKGNG | Install Opcache
pkgng:
name: "{{ php_package_prefix }}opcache"
- name: PKGNG | Install Opcache
pkgng:
name: "{{ php_package_prefix }}opcache"
when: ansible_os_family == 'FreeBSD'
@ -28,10 +28,16 @@
template:
src: "etc/__php__/mods-available/opcache.ini.j2"
dest: "{{ php_mods_dir }}/opcache.ini"
owner: root
group: root
mode: 0644
notify: restart php-fpm
- name: TEMPLATE | Configure APCu
template:
src: "etc/__php__/mods-available/apcu.ini.j2"
dest: "{{ php_mods_dir }}/apcu.ini"
owner: root
group: root
mode: 0644
notify: restart php-fpm

View File

@ -2,41 +2,41 @@
- block:
- name: APT | Install xdebug
apt:
pkg: "{{ php_xdebug_package }}"
state: present
update_cache: yes
cache_valid_time: 3600
when: ansible_os_family == 'Debian'
- name: APT | Install xdebug
apt:
pkg: "{{ php_xdebug_package }}"
state: present
update_cache: true
cache_valid_time: 3600
when: ansible_os_family == 'Debian'
- name: PKGNG | Install xdebug
pkgng:
name: "{{ php_xdebug_package }}"
when: ansible_os_family == 'FreeBSD' and php_xdebug_package is defined
- name: PKGNG | Install xdebug
pkgng:
name: "{{ php_xdebug_package }}"
when: ansible_os_family == 'FreeBSD' and php_xdebug_package is defined
- name: TEMPLATE | Deploy module configurations
template:
src: "etc/__php__/mods-available/xdebug.ini.j2"
dest: "{{ php_mods_dir }}/xdebug.ini"
owner: root
mode: 0644
notify: restart php-fpm
- name: TEMPLATE | Deploy module configurations
template:
src: "etc/__php__/mods-available/xdebug.ini.j2"
dest: "{{ php_mods_dir }}/xdebug.ini"
owner: root
mode: 0644
notify: restart php-fpm
when: php_install_xdebug
- block:
- name: APT | Uninstall xdebug
apt:
pkg: "{{ php_xdebug_package }}"
state: absent
when: ansible_os_family == 'Debian'
- name: APT | Uninstall xdebug
apt:
pkg: "{{ php_xdebug_package }}"
state: absent
when: ansible_os_family == 'Debian'
- name: PKGNG | Uninstall xdebug
pkgng:
name: "{{ php_xdebug_package }}"
state: absent
when: ansible_os_family == 'FreeBSD'
- name: PKGNG | Uninstall xdebug
pkgng:
name: "{{ php_xdebug_package }}"
state: absent
when: ansible_os_family == 'FreeBSD'
when: not php_install_xdebug