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 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. Install PHP on Debian / Ubuntu / FreeBSD. Manage PHP-FPM, APCu, Opcache and Xdebug.

View File

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

View File

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

View File

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

View File

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

View File

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