mirror of
https://github.com/HanXHX/ansible-nginx.git
synced 2026-04-11 12:52:10 +07:00
Drop PHP version support (useless) + fix some bugs
This commit is contained in:
@@ -6,24 +6,6 @@
|
||||
state: present
|
||||
when: nginx_backports
|
||||
|
||||
- block:
|
||||
|
||||
- name: APT | Install apt-transport-https
|
||||
apt:
|
||||
pkg: apt-transport-https
|
||||
update_cache: yes
|
||||
cache_valid_time: 3600
|
||||
|
||||
- name: APT_KEY | Install GPG key
|
||||
apt_key:
|
||||
url: 'https://packages.sury.org/php/apt.gpg'
|
||||
|
||||
- name: APT_REPOSITORY | Add APT repository
|
||||
apt_repository:
|
||||
repo: 'deb https://packages.sury.org/php {{ ansible_distribution_release }} main'
|
||||
|
||||
when: sury | default(false)
|
||||
|
||||
- name: APT | Install needed packages
|
||||
apt:
|
||||
pkg: "{{ packages }}"
|
||||
@@ -44,12 +26,19 @@
|
||||
|
||||
- name: APT | Install PHP
|
||||
apt:
|
||||
pkg: "{{ item.version | php_fpm_package }}"
|
||||
pkg: "{{ pkgs }}"
|
||||
update_cache: yes
|
||||
cache_valid_time: 3600
|
||||
state: present
|
||||
loop: "{{ nginx_php }}"
|
||||
register: apt_php
|
||||
vars:
|
||||
pkgs:
|
||||
- php-cli
|
||||
- php-fpm
|
||||
|
||||
- name: SHELL | Get current PHP version
|
||||
shell: php --version | awk '/^PHP/ { print $2 }' | grep -o -E '^.{3}'
|
||||
changed_when: false
|
||||
register: cur_php_version
|
||||
|
||||
- name: SERVICE | Force start fcgiwrap
|
||||
service:
|
||||
@@ -58,11 +47,10 @@
|
||||
|
||||
# Bypasses Ansible+Docker issue. With service module... php is not really started!
|
||||
- name: COMMAND | Force start PHP
|
||||
command: "service {{ item.version | php_fpm_service }} start"
|
||||
command: "service php{{ cur_php_version.stdout }}-fpm start"
|
||||
args:
|
||||
creates: "{{ item.version | php_default_upstream_socket }}"
|
||||
creates: "/run/php/php{{ cur_php_version.stdout }}-fpm.pid"
|
||||
warn: false
|
||||
loop: "{{ nginx_php }}"
|
||||
|
||||
- name: GET_URL | Download ngrok
|
||||
get_url:
|
||||
@@ -88,7 +76,7 @@
|
||||
include_role:
|
||||
name: "{{ playbook_dir }}/HanXHX.php"
|
||||
vars:
|
||||
php_version: "{{ nginx_php.0.version }}"
|
||||
php_version: "{{ cur_php_version.stdout }}"
|
||||
php_autoremove_default_pool: false
|
||||
php_fpm_poold:
|
||||
- name: 'hx_unix'
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
- hosts: all
|
||||
pre_tasks:
|
||||
|
||||
- name: INCLUDE_TASKS | Pre_tasks related to OS version
|
||||
include_tasks: "includes/pre_{{ ansible_distribution }}.yml"
|
||||
|
||||
@@ -23,6 +24,7 @@
|
||||
src: "file/test.key"
|
||||
dest: "{{ int_ansible_ssl_dir }}/test.key"
|
||||
|
||||
- debug: var=nginx_sites
|
||||
- name: COPY | Add all hosts in /etc/hosts
|
||||
copy:
|
||||
content: |
|
||||
@@ -203,7 +205,7 @@
|
||||
- '/'
|
||||
- '/a'
|
||||
- name: 'test-php.local'
|
||||
php_version: "{{ nginx_php.1.version if nginx_php.1 is defined else nginx_php.0.version }}"
|
||||
php_upstream: "manual"
|
||||
upstream_params:
|
||||
- 'fastcgi_param FOO bar;'
|
||||
redirect_from:
|
||||
@@ -274,6 +276,9 @@
|
||||
ssl_name: '{{ ngrok.stdout }}'
|
||||
headers:
|
||||
'X-acme': '1'
|
||||
|
||||
#nginx_php: "{{ __nginx_php + [{'upstream_name': 'manual', 'sockets': [{'host': '127.0.0.1', 'port': '9636' }] }] }}"
|
||||
nginx_php: "{{ [{'upstream_name': 'manual', 'sockets': [{'host': '127.0.0.1', 'port': '9636' }] }] }}"
|
||||
nginx_dh_length: 1024
|
||||
roles:
|
||||
- ../../
|
||||
@@ -374,7 +379,7 @@
|
||||
when: >
|
||||
item.template is defined and
|
||||
(item.template == '_php' or item.template == '_php_index' or item.template == '_php_index2')
|
||||
failed_when: p.content.find('PHP Version ' + item.php_version if 'php_version' in item else nginx_php.0.version) == -1
|
||||
failed_when: p.content.find('PHP Version') == -1
|
||||
|
||||
- name: -- VERIFY INDEX2 --
|
||||
uri:
|
||||
|
||||
Reference in New Issue
Block a user